Skip to content

Commit

Permalink
cast explicitely to uint8
Browse files Browse the repository at this point in the history
  • Loading branch information
francois.parquet committed Jul 12, 2018
1 parent 0299114 commit b11bbef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions levels.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package onelog

const (
// INFO is the numeric code for INFO log level
INFO = 0x1
INFO = uint8(0x1)
// DEBUG is the numeric code for DEBUG log level
DEBUG = 0x2
DEBUG = uint8(0x2)
// WARN is the numeric code for WARN log level
WARN = 0x4
WARN = uint8(0x4)
// ERROR is the numeric code for ERROR log level
ERROR = 0x8
ERROR = uint8(0x8)
// FATAL is the numeric code for FATAL log level
FATAL = 0x10
FATAL = uint8(0x10)
)

// ALL is a shortcut to INFO | DEBUG | WARN | ERROR | FATAL to enable all logging levels
Expand Down
4 changes: 2 additions & 2 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var logClose = []byte("}\n")
var msgKey = "message"

// LevelText personalises the text for a specific level.
func LevelText(level int, txt string) {
func LevelText(level uint8, txt string) {
Levels[level] = txt
genLevelSlices()
}
Expand Down Expand Up @@ -393,7 +393,7 @@ func (l *Logger) FatalWithFields(msg string, fields func(Entry)) {
enc.Release()
}

func (l *Logger) beginEntry(level int, msg string, enc *Encoder) {
func (l *Logger) beginEntry(level uint8, msg string, enc *Encoder) {
enc.AppendBytes(levelsJSON[level])
enc.AppendString(msg)
if l.ctx != nil {
Expand Down

0 comments on commit b11bbef

Please sign in to comment.