actually make use of the LogLevel type

why else would it be defined?
and this is sane anyway.
This commit is contained in:
Dieter Plaetinck
2016-02-01 17:48:42 +13:00
parent 3f5b33b060
commit bf943ddba3
4 changed files with 15 additions and 14 deletions
+5 -5
View File
@@ -46,8 +46,8 @@ var (
// ConsoleWriter implements LoggerInterface and writes messages to terminal.
type ConsoleWriter struct {
lg *log.Logger
Level int `json:"level"`
Formatting bool `json:"formatting"`
Level LogLevel `json:"level"`
Formatting bool `json:"formatting"`
}
// create ConsoleWriter returning as LoggerInterface.
@@ -63,7 +63,7 @@ func (cw *ConsoleWriter) Init(config string) error {
return json.Unmarshal([]byte(config), cw)
}
func (cw *ConsoleWriter) WriteMsg(msg string, skip, level int) error {
func (cw *ConsoleWriter) WriteMsg(msg string, skip int, level LogLevel) error {
if cw.Level > level {
return nil
}
@@ -82,11 +82,11 @@ func (_ *ConsoleWriter) Flush() {
func (_ *ConsoleWriter) Destroy() {
}
func printConsole(level int, msg string) {
func printConsole(level LogLevel, msg string) {
consoleWriter.WriteMsg(msg, 0, level)
}
func printfConsole(level int, format string, v ...interface{}) {
func printfConsole(level LogLevel, format string, v ...interface{}) {
consoleWriter.WriteMsg(fmt.Sprintf(format, v...), 0, level)
}