Example #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()
}
Example #2
0
func (this *StandardSinkFilter) shouldSeverity(msg core.LogMessage) bool {
	var result bool
	switch this.filter.Severity.CmpOp {
	case core.FILTER_CMP_NONE:
		result = true
	case core.FILTER_CMP_GE:
		result = this.severityComparator.ge(msg.Severity(), this.filter.Severity.Level)
	case core.FILTER_CMP_EQ:
		result = this.severityComparator.eq(msg.Severity(), this.filter.Severity.Level)
	case core.FILTER_CMP_LT:
		result = this.severityComparator.lt(msg.Severity(), this.filter.Severity.Level)
	case core.FILTER_CMP_GT:
		result = this.severityComparator.gt(msg.Severity(), this.filter.Severity.Level)
	}
	return result
}