Ejemplo n.º 1
0
func (this *StandardSinkFormatter) GetFormattedMessage(msg core.LogMessage) string {
	var b bytes.Buffer
	this.compiledTemplate.Execute(
		&b,
		map[string]interface{}{
			"time":     msg.Time().Format(this.timeFormat),
			"severity": msg.Severity(),
			"message":  strings.Replace(msg.Message(), "\n", "\n\t", -1),
			"tags":     strings.Join(msg.Tags(), ","),
		},
	)
	return b.String()
}
Ejemplo n.º 2
0
func (this *StandardSinkFilter) shouldTags(msg core.LogMessage) bool {
	if this.filter.Tags != nil && len(this.filter.Tags) > 0 {
		msgTags := msg.Tags()
		for _, filterTag := range this.filter.Tags {
			for _, messageTag := range msgTags {
				if filterTag == messageTag {
					return true
				}
			}
		}
		return false
	}
	return true
}