Documentation ¶
Index ¶
- Variables
- func Debug(format string, a ...interface{})
- func Debugb(framesBackward int, format string, a ...interface{})
- func Error(format string, a ...interface{})
- func Errorb(framesBackward int, format string, a ...interface{})
- func Fatal(format string, a ...interface{})
- func FatalCheck(err error)
- func FatalCheckf(err error, format string, a ...interface{})
- func Info(format string, a ...interface{})
- func Infob(framesBackward int, format string, a ...interface{})
- func LogDefault(writer *os.File, time, level string, maxLength int, caller, message string)
- func LogPlain(writer *os.File, time, level string, maxLength int, caller, message string)
- func Panic(format string, a ...interface{})
- func Plain(format string, a ...interface{})
- func Plainb(framesBackward int, format string, a ...interface{})
- func Stack(err error)
- func Stackb(framesBackward int, err error)
- type Level
Constants ¶
This section is empty.
Variables ¶
var ( LogLevel = LOG_INFO DateFormat = "2006-01-02 15:04:05.000" FormatFunctions = map[Level]func(*os.File, string, string, int, string, string){ LOG_PLAIN: LogPlain, LOG_DEBUG: LogDefault, LOG_INFO: LogDefault, LOG_ERROR: LogDefault, LOG_FATAL: LogDefault, LOG_PANIC: LogDefault, } // The current maximum length printed for caller information. This is updated each time something gets printed CallerColumnWidth = 0 LevelStrings = map[Level]string{ LOG_PLAIN: "", LOG_DEBUG: "[DEBUG]", LOG_INFO: "[INFO] ", LOG_ERROR: "[ERROR]", LOG_FATAL: "[FATAL]", LOG_PANIC: "[PANIC]", } LevelOutputs = map[Level]*os.File{ LOG_PLAIN: os.Stdout, LOG_DEBUG: os.Stdout, LOG_INFO: os.Stdout, LOG_ERROR: os.Stderr, LOG_FATAL: os.Stderr, LOG_PANIC: os.Stderr, } )
Functions ¶
func Debugb ¶
Debugb is equal to Debug(...) but can go back in the stack and can therefore show function positions from previous functions.
func Errorb ¶
Errorb is equal to Error(...) but can go back in the stack and can therefore show function positions from previous functions.
func FatalCheck ¶
func FatalCheck(err error)
FatalCheck checks if the error exists (!= nil). If so, it'll fatal with the error message.
func FatalCheckf ¶
FatalCheckf checks if the error exists. If so, it'll print the error message and fatals with the given format message.
func Infob ¶
Infob is equal to Info(...) but can go back in the stack and can therefore show function positions from previous functions.
func LogDefault ¶
func Plainb ¶
Plainb is equal to Plain(...) but can go back in the stack and can therefore show function positions from previous functions.
func Stack ¶
func Stack(err error)
Stack tries to print the stack trace of the given error using the %+v format string. When using the https://github.com/pkg/errors package, a full error stack trace will be output. If normal errors are used, just print the error.