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...)) }