Documentation
¶
Overview ¶
Package clog provides coloured logging.
Index ¶
- func Debug(args ...any)
- func Debugf(format string, args ...any)
- func Debugln(args ...any)
- func Fatal(args ...any)
- func Fatalf(format string, args ...any)
- func Fatalln(args ...any)
- func Info(args ...any)
- func Infof(format string, args ...any)
- func Infoln(args ...any)
- func SetDebugOutput(w io.Writer)
- func SetDebugPrefix(usePrefix bool)
- func SetErrorOutput(w io.Writer)
- func SetErrorPrefix(usePrefix bool)
- func SetInfoOutput(w io.Writer)
- func SetInfoPrefix(usePrefix bool)
- func SetMainPrefixName(name string)
- func SetPathLevel(path string, level Level)
- func SetWarnOutput(w io.Writer)
- func SetWarnPrefix(usePrefix bool)
- func Warn(args ...any)
- func Warnf(format string, args ...any)
- func Warnln(args ...any)
- type Level
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
func Fatal(args ...any)
Fatal outputs the given fatal error message to standard error and terminates the application.
func Fatalf ¶
Fatalf outputs the given fatal error message to standard error and terminates the application.
func Fatalln ¶
func Fatalln(args ...any)
Fatalln outputs the given fatal error message to standard error and terminates the application.
func SetDebugOutput ¶
SetDebugOutput sets the output writer of debug messages.
func SetDebugPrefix ¶
func SetDebugPrefix(usePrefix bool)
SetDebugPrefix sets whether to use a prefix for debug messages.
func SetErrorOutput ¶
SetErrorOutput sets the output writer of fatal error messages.
func SetErrorPrefix ¶
func SetErrorPrefix(usePrefix bool)
SetErrorPrefix sets whether to use a prefix for error messages.
func SetInfoOutput ¶
SetInfoOutput sets the output writer of info messages.
func SetInfoPrefix ¶
func SetInfoPrefix(usePrefix bool)
SetInfoPrefix sets whether to use a prefix for info messages.
func SetMainPrefixName ¶
func SetMainPrefixName(name string)
SetMainPrefixName sets the prefix name used for the 'main' package.
func SetPathLevel ¶
SetPathLevel sets the log level of the given path at package (e.g. "github.com/user/repo/pkg") or function (e.g. "github.com/user/repo/pkg.Func") granularity.
For function ganularity of leaf node functions, function inlining may have to be disabled (use the `//go:noinline` build tag).
func SetWarnOutput ¶
SetWarnOutput sets the output writer of non-fatal warning messages.
func SetWarnPrefix ¶
func SetWarnPrefix(usePrefix bool)
SetWarnPrefix sets whether to use a prefix for warning messages.
func Warn ¶
func Warn(args ...any)
Warn outputs the given non-fatal warning message to standard error.
Types ¶
type Level ¶
type Level int
Level specifies a log level which denotes the importance or severity of a log event.
const ( // LevelDebug is used for debug messages (Magenta). LevelDebug Level = -4 // LevelInfo is used for informational messages (Cyan). LevelInfo Level = 0 // LevelWarn is used for non-fatal warnings (Red). LevelWarn Level = 4 // LevelError is used for fatal errors (Red). LevelError Level = 8 )
Common log levels.