Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#119 Add log level constants #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions log/filterlogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

package log

const (
LevelError = iota
LevelInfo
LevelDebug
LevelTrace
)

type filterLogger struct {
level int
logger Logger
Expand Down
13 changes: 13 additions & 0 deletions log/filterlogger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}