This repository has been archived by the owner on Oct 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.go
70 lines (56 loc) · 1.85 KB
/
common.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* CommonLog
*
* Copyright © 2015 Trevor N. Suarez (Rican7)
*/
package commonlog
import (
"github.com/Rican7/commonlog/level"
)
/**
* Types
*/
type common struct {
LevelLogger
}
/**
* Functions
*/
// NewLogger creates a new Logger instance from a LevelLogger by using a common
// pass-through pattern for each separate level-specific logging method to the
// passed LevelLogger.Log() method
func NewLogger(l LevelLogger) Logger {
return &common{l}
}
// Emergency calls the LevelLogger's Log() method with the level.Emergency level
func (l *common) Emergency(format string, args ...interface{}) {
l.Log(level.EMERGENCY, format, args...)
}
// Alert calls the LevelLogger's Log() method with the level.Alert level
func (l *common) Alert(format string, args ...interface{}) {
l.Log(level.ALERT, format, args...)
}
// Critical calls the LevelLogger's Log() method with the level.Critical level
func (l *common) Critical(format string, args ...interface{}) {
l.Log(level.CRITICAL, format, args...)
}
// Error calls the LevelLogger's Log() method with the level.Error level
func (l *common) Error(format string, args ...interface{}) {
l.Log(level.ERROR, format, args...)
}
// Warning calls the LevelLogger's Log() method with the level.Warning level
func (l *common) Warning(format string, args ...interface{}) {
l.Log(level.WARNING, format, args...)
}
// Notice calls the LevelLogger's Log() method with the level.Notice level
func (l *common) Notice(format string, args ...interface{}) {
l.Log(level.NOTICE, format, args...)
}
// Info calls the LevelLogger's Log() method with the level.Info level
func (l *common) Info(format string, args ...interface{}) {
l.Log(level.INFO, format, args...)
}
// Debug calls the LevelLogger's Log() method with the level.Debug level
func (l *common) Debug(format string, args ...interface{}) {
l.Log(level.DEBUG, format, args...)
}