Documentation ¶
Index ¶
- Variables
- func CheckError(err error)
- func Debug(args ...interface{})
- func DebugDump(arg interface{}, prefix string)
- func DebugSeparator(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func ErrorDump(arg interface{}, prefix string)
- func ErrorSeparator(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func FormattedStackTrace(err error) string
- func Info(args ...interface{})
- func InfoDump(arg interface{}, prefix string)
- func InfoSeparator(args ...interface{})
- func Infof(format string, args ...interface{})
- func StackTrace(err error)
- func Warn(args ...interface{})
- func WarnDump(arg interface{}, prefix string)
- func WarnSeparator(args ...interface{})
- func Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var DebugMode = false
DebugMode indicates if debug information should be printed or not
If the environment variable called DEBUG is set to 1, this will default to true. In all other cases, debug mode is false by default.
var DefaultTimeFormat = "2006-01-02 15:04:05.000"
DefaultTimeFormat is the default format to use for the timestamps
var OsExit = os.Exit
OsExit is the function to exit the app when a fatal error happens
var PrintColors = false
PrintColors indicates if the messages should be printed in color or not
var PrintTimestamp = false
PrintTimestamp indicates if the log messages should include a timestamp or not
var Stderr io.Writer = os.Stderr
Stderr is the writer to where the stderr messages should be written (defaults to os.Stderr)
var Stdout io.Writer = os.Stdout
Stdout is the writer to where the stdout messages should be written (defaults to os.Stdout)
var TestingTimeFormat = "test"
TestingTimeFormat is the format to use for the timestamps during testing
var TimeFormat = DefaultTimeFormat
TimeFormat is the format to use for the timestamps
var TimeZone *time.Location
TimeZone indicates in which timezone the time should be formatted
Functions ¶
func CheckError ¶
func CheckError(err error)
CheckError checks if the error is not nil and if that's the case, it will print a fatal message and exits the program with exit code 1.
If DebugMode is enabled a stack trace will also be printed to stderr
func Debug ¶
func Debug(args ...interface{})
Debug prints a debug message
Only shown if DebugMode is set to true
func DebugDump ¶
func DebugDump(arg interface{}, prefix string)
DebugDump dumps the argument as a debug message with an optional prefix
func DebugSeparator ¶
func DebugSeparator(args ...interface{})
DebugSeparator prints a debug separator
Only shown if DebugMode is set to true
func Debugf ¶ added in v1.0.3
func Debugf(format string, args ...interface{})
Debugf prints a debug message with a format and arguments
Only shown if DebugMode is set to true
func ErrorDump ¶
func ErrorDump(arg interface{}, prefix string)
ErrorDump dumps the argument as an err message with an optional prefix to stderr
func ErrorSeparator ¶ added in v1.0.6
func ErrorSeparator(args ...interface{})
ErrorSeparator prints an error separator
func Errorf ¶ added in v1.0.3
func Errorf(format string, args ...interface{})
Errorf prints an error message with a format and arguments
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a fatal error message to stdout and exits the program with exit code 1
func Fatalf ¶ added in v1.0.3
func Fatalf(format string, args ...interface{})
Fatalf prints a fatal message with a format and arguments
func FormattedStackTrace ¶
FormattedStackTrace returns a formatted stacktrace for err
func InfoDump ¶
func InfoDump(arg interface{}, prefix string)
InfoDump dumps the argument as an info message with an optional prefix
func Infof ¶ added in v1.0.3
func Infof(format string, args ...interface{})
Infof prints an info message with a format and arguments
func StackTrace ¶
func StackTrace(err error)
StackTrace prints an error message with the stacktrace of err to stderr
func WarnDump ¶
func WarnDump(arg interface{}, prefix string)
WarnDump dumps the argument as a warning message with an optional prefix
func WarnSeparator ¶ added in v1.0.6
func WarnSeparator(args ...interface{})
WarnSeparator prints a warning separator
Types ¶
This section is empty.