package matrix import ( "fmt" "log" ) type logger struct{ Level uint } func (l logger) Error(message string, args ...interface{}) { if l.Level > 0 { logLevel("error", message, args...) } } func (l logger) Warn(message string, args ...interface{}) { if l.Level > 1 { logLevel("warning", message, args...) } } func (l logger) Debug(message string, args ...interface{}) { if l.Level > 2 { logLevel("debug", message, args...) } } func (l logger) Trace(message string, args ...interface{}) { if l.Level > 3 { logLevel("trace", message, args...) } } func logLevel(level, message string, args ...interface{}) { log.Print("[", level, "] ", fmt.Sprintf(message, args...)) }