forked from go-coldbrew/log
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.go
More file actions
37 lines (29 loc) · 930 Bytes
/
utils.go
File metadata and controls
37 lines (29 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package log
import (
"context"
"github.com/netbookai/log/loggers"
)
//SetLevel sets the log level to filter logs
func SetLevel(level loggers.Level) {
GetLogger().SetLevel(level)
}
//GetLevel returns the current log level
func GetLevel() loggers.Level {
return GetLogger().GetLevel()
}
//Debug writes out a debug log to global logger
func Debug(ctx context.Context, args ...interface{}) {
GetLogger().Log(ctx, loggers.DebugLevel, 1, args...)
}
//Info writes out an info log to global logger
func Info(ctx context.Context, args ...interface{}) {
GetLogger().Log(ctx, loggers.InfoLevel, 1, args...)
}
//Warn writes out a warning log to global logger
func Warn(ctx context.Context, args ...interface{}) {
GetLogger().Log(ctx, loggers.WarnLevel, 1, args...)
}
//Error writes out an error log to global logger
func Error(ctx context.Context, args ...interface{}) {
GetLogger().Log(ctx, loggers.ErrorLevel, 1, args...)
}