Files
AynaLivePlayer/pkg/logger/logger.go
Aynakeya 5cc5948a85 Merge 1.0.x branch (#8)
* rewrite

* update submodule

* make width height configurable

* update dependency

* update

* update file

* update dep

* fix basic config layout

* update plugin management

* more stuff

* add blacklist

* fix todo

* fix windows gethandle

* update windows update guide

* update windows build guide

* include go mod tidy in script

* update todo

* fix source session

* fix text output

* add plugin play duration control

* fix id diange not working

* update todo

* update version number
2024-04-22 21:21:02 -07:00

50 lines
1.2 KiB
Go

package logger
type LogLevel uint32
const (
LogLevelError LogLevel = iota
LogLevelWarn
LogLevelInfo
LogLevelDebug
)
type LogField map[string]interface{}
func (f LogField) Flatten() []interface{} {
var res []interface{}
for k, v := range f {
res = append(res, k, v)
}
return res
}
type ILogger interface {
Debug(args ...interface{})
Debugf(format string, args ...interface{})
DebugW(message string, keysAndValues ...interface{})
DebugS(message string, fields LogField)
Info(args ...interface{})
Infof(format string, args ...interface{})
InfoW(message string, keysAndValues ...interface{})
InfoS(message string, fields LogField)
Warn(args ...interface{})
Warnf(format string, args ...interface{})
WarnW(message string, keysAndValues ...interface{})
WarnS(message string, fields LogField)
Error(args ...interface{})
Errorf(format string, args ...interface{})
ErrorW(message string, keysAndValues ...interface{})
ErrorS(message string, fields LogField)
WithPrefix(prefix string) ILogger
SetLogLevel(level LogLevel)
}
type LogMessage struct {
Timestamp int64
Level LogLevel
Prefix string
Message string
Data map[string]interface{}
}