36 lines
773 B
Go
36 lines
773 B
Go
|
package loggo
|
||
|
|
||
|
// struct for log levels
|
||
|
type logLevel struct {
|
||
|
level int
|
||
|
name string
|
||
|
}
|
||
|
|
||
|
// debug log level (level = 0, name = "debug")
|
||
|
var DebugLevel = logLevel{0, "debug"}
|
||
|
|
||
|
// info log level (level = 1, name = "info")
|
||
|
var InfoLevel = logLevel{1, "info"}
|
||
|
|
||
|
// warning log level (level = 2, name = "warning")
|
||
|
var WarningLevel = logLevel{2, "warning"}
|
||
|
|
||
|
// error log level (level = 3, name = "error")
|
||
|
var ErrorLevel = logLevel{3, "error"}
|
||
|
|
||
|
// fatal log level (level = 4, name = "fatal")
|
||
|
var FatalLevel = logLevel{4, "fatal"}
|
||
|
|
||
|
// current log level (defaults to: "infoLevel")
|
||
|
var currentLevel = InfoLevel
|
||
|
|
||
|
// return current set log level
|
||
|
func GetLogLevel() logLevel {
|
||
|
return currentLevel
|
||
|
}
|
||
|
|
||
|
// set current log level
|
||
|
func SetLogLevel(level logLevel) {
|
||
|
currentLevel = level
|
||
|
}
|