| @@ -2,7 +2,6 @@ package logger | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| ) | ||||
|  | ||||
| type Level int8 | ||||
| @@ -19,7 +18,7 @@ const ( | ||||
| 	WarnLevel | ||||
| 	// ErrorLevel level. Logs. Used for errors that should definitely be noted. | ||||
| 	ErrorLevel | ||||
| 	// FatalLevel level. Logs and then calls `logger.Exit(1)`. highest level of severity. | ||||
| 	// FatalLevel level. Logs and then calls `os.Exit(1)`. highest level of severity. | ||||
| 	FatalLevel | ||||
| ) | ||||
|  | ||||
| @@ -63,60 +62,5 @@ func GetLevel(levelStr string) (Level, error) { | ||||
| 	case FatalLevel.String(): | ||||
| 		return FatalLevel, nil | ||||
| 	} | ||||
| 	return InfoLevel, fmt.Errorf("Unknown Level String: '%s', defaulting to InfoLevel", levelStr) | ||||
| } | ||||
|  | ||||
| func Info(args ...interface{}) { | ||||
| 	DefaultLogger.Log(InfoLevel, args...) | ||||
| } | ||||
|  | ||||
| func Infof(template string, args ...interface{}) { | ||||
| 	DefaultLogger.Logf(InfoLevel, template, args...) | ||||
| } | ||||
|  | ||||
| func Trace(args ...interface{}) { | ||||
| 	DefaultLogger.Log(TraceLevel, args...) | ||||
| } | ||||
|  | ||||
| func Tracef(template string, args ...interface{}) { | ||||
| 	DefaultLogger.Logf(TraceLevel, template, args...) | ||||
| } | ||||
|  | ||||
| func Debug(args ...interface{}) { | ||||
| 	DefaultLogger.Log(DebugLevel, args...) | ||||
| } | ||||
|  | ||||
| func Debugf(template string, args ...interface{}) { | ||||
| 	DefaultLogger.Logf(DebugLevel, template, args...) | ||||
| } | ||||
|  | ||||
| func Warn(args ...interface{}) { | ||||
| 	DefaultLogger.Log(WarnLevel, args...) | ||||
| } | ||||
|  | ||||
| func Warnf(template string, args ...interface{}) { | ||||
| 	DefaultLogger.Logf(WarnLevel, template, args...) | ||||
| } | ||||
|  | ||||
| func Error(args ...interface{}) { | ||||
| 	DefaultLogger.Log(ErrorLevel, args...) | ||||
| } | ||||
|  | ||||
| func Errorf(template string, args ...interface{}) { | ||||
| 	DefaultLogger.Logf(ErrorLevel, template, args...) | ||||
| } | ||||
|  | ||||
| func Fatal(args ...interface{}) { | ||||
| 	DefaultLogger.Log(FatalLevel, args...) | ||||
| 	os.Exit(1) | ||||
| } | ||||
|  | ||||
| func Fatalf(template string, args ...interface{}) { | ||||
| 	DefaultLogger.Logf(FatalLevel, template, args...) | ||||
| 	os.Exit(1) | ||||
| } | ||||
|  | ||||
| // Returns true if the given level is at or lower the current logger level | ||||
| func V(lvl Level) bool { | ||||
| 	return DefaultLogger.Options().Level <= lvl | ||||
| 	return InfoLevel, fmt.Errorf("unknown Level String: '%s', use InfoLevel", levelStr) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user