本文整理匯總了Golang中github.com/chatoooo/logoon/core.LogMessage.Severity方法的典型用法代碼示例。如果您正苦於以下問題:Golang LogMessage.Severity方法的具體用法?Golang LogMessage.Severity怎麽用?Golang LogMessage.Severity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/chatoooo/logoon/core.LogMessage
的用法示例。
在下文中一共展示了LogMessage.Severity方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetFormattedMessage
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()
}
示例2: shouldSeverity
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
}