mirror of
https://github.com/mmatczuk/go-http-tunnel.git
synced 2026-05-15 14:16:17 -06:00
#119 Add log level constants
This commit is contained in:
parent
10e3e0d19a
commit
d49708d480
2 changed files with 20 additions and 0 deletions
|
|
@ -4,6 +4,13 @@
|
|||
|
||||
package log
|
||||
|
||||
const (
|
||||
LevelError = iota
|
||||
LevelInfo
|
||||
LevelDebug
|
||||
LevelTrace
|
||||
)
|
||||
|
||||
type filterLogger struct {
|
||||
level int
|
||||
logger Logger
|
||||
|
|
|
|||
|
|
@ -29,3 +29,16 @@ func TestFilterLogger_Log(t *testing.T) {
|
|||
f.Log("level", 3)
|
||||
f.Log("level", 4)
|
||||
}
|
||||
|
||||
func TestFilterLogger_Level(t *testing.T) {
|
||||
for i, j := range map[int]int{
|
||||
LevelError: 0,
|
||||
LevelInfo: 1,
|
||||
LevelDebug: 2,
|
||||
LevelTrace: 3,
|
||||
} {
|
||||
if i != j {
|
||||
t.Fatalf("Log levels not as expected %d != %d", i, j)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue