mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 20:54:22 -06:00
54ad791c7e
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
28 lines
586 B
Go
28 lines
586 B
Go
package live
|
|
|
|
import "github.com/centrifugal/centrifuge"
|
|
|
|
// Write to the standard log15 logger
|
|
func handleLog(msg centrifuge.LogEntry) {
|
|
arr := make([]interface{}, 0)
|
|
for k, v := range msg.Fields {
|
|
if v == nil {
|
|
v = "<nil>"
|
|
} else if v == "" {
|
|
v = "<empty>"
|
|
}
|
|
arr = append(arr, k, v)
|
|
}
|
|
|
|
switch msg.Level {
|
|
case centrifuge.LogLevelDebug:
|
|
loggerCF.Debug(msg.Message, arr...)
|
|
case centrifuge.LogLevelError:
|
|
loggerCF.Error(msg.Message, arr...)
|
|
case centrifuge.LogLevelInfo:
|
|
loggerCF.Info(msg.Message, arr...)
|
|
default:
|
|
loggerCF.Debug(msg.Message, arr...)
|
|
}
|
|
}
|