mirror of
https://github.com/unpoller/unpoller.git
synced 2026-03-31 06:24:19 -04:00
move to the pkg dir
This commit is contained in:
38
pkg/lokiunifi/logger.go
Normal file
38
pkg/lokiunifi/logger.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package lokiunifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/unpoller/unpoller/core/webserver"
|
||||
)
|
||||
|
||||
// Logf logs a message.
|
||||
func (l *Loki) Logf(msg string, v ...interface{}) {
|
||||
webserver.NewOutputEvent(PluginName, PluginName, &webserver.Event{
|
||||
Ts: time.Now(),
|
||||
Msg: fmt.Sprintf(msg, v...),
|
||||
Tags: map[string]string{"type": "info"},
|
||||
})
|
||||
l.Collect.Logf(msg, v...)
|
||||
}
|
||||
|
||||
// LogErrorf logs an error message.
|
||||
func (l *Loki) LogErrorf(msg string, v ...interface{}) {
|
||||
webserver.NewOutputEvent(PluginName, PluginName, &webserver.Event{
|
||||
Ts: time.Now(),
|
||||
Msg: fmt.Sprintf(msg, v...),
|
||||
Tags: map[string]string{"type": "error"},
|
||||
})
|
||||
l.Collect.LogErrorf(msg, v...)
|
||||
}
|
||||
|
||||
// LogDebugf logs a debug message.
|
||||
func (l *Loki) LogDebugf(msg string, v ...interface{}) {
|
||||
webserver.NewOutputEvent(PluginName, PluginName, &webserver.Event{
|
||||
Ts: time.Now(),
|
||||
Msg: fmt.Sprintf(msg, v...),
|
||||
Tags: map[string]string{"type": "debug"},
|
||||
})
|
||||
l.Collect.LogDebugf(msg, v...)
|
||||
}
|
||||
Reference in New Issue
Block a user