-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
49 lines (39 loc) · 1.24 KB
/
logger.go
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
38
39
40
41
42
43
44
45
46
47
48
49
package log
import (
"os"
)
var logger *Logger
func init() {
config := DefaultConfig
config.CallerSkip++
logger = New(os.Stderr, config)
}
// SetFormat sets the logging format for the default package logger
func SetFormat(f Format) {
logger.SetFormat(f)
}
// SetLevel sets the logging level for the default package logger
func SetLevel(l Level) {
logger.SetLevel(l)
}
// Debug creates a new log entry with the given message with the default package logger.
func Debug(message string) (entry Entry) {
return logger.Debug(message)
}
// Info creates a new log entry with the given message with the default package logger.
func Info(message string) (entry Entry) {
return logger.Info(message)
}
// Warn creates a new log entry with the given message with the default package logger.
func Warn(message string) (entry Entry) {
return logger.Warn(message)
}
// Error creates a new log entry with the given message with the default package logger.
func Error(message string) (entry Entry) {
return logger.Error(message)
}
// Fatal creates a new log entry with the given message with the default package logger.
// After write, Fatal calls os.Exit(1) terminating the running program
func Fatal(message string) (entry Entry) {
return logger.Fatal(message)
}