Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, args ...interface{})
- func GetDefaultErrorLevel() string
- func GetDefaultLevel() string
- func GetLevel() string
- func GetSupportedLevels() []string
- func IncreaseLevel(levels int)
- func Info(v ...interface{})
- func Infof(format string, args ...interface{})
- func Log(level Level, v ...interface{})
- func Logf(level Level, format string, args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(v ...interface{})
- func SetLevel(levelName string)
- func SetLevelFromEnv()
- func Spam(v ...interface{})
- func Spamf(format string, args ...interface{})
- func Verbose(v ...interface{})
- func Verbosef(format string, args ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, args ...interface{})
- type Level
- type LevelConfig
- type Logger
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Printf(format string, args ...interface{})
- func (l *Logger) Println(v ...interface{})
- func (l *Logger) Spam(v ...interface{})
- func (l *Logger) Spamf(format string, args ...interface{})
- func (l *Logger) Verbose(v ...interface{})
- func (l *Logger) Verbosef(format string, args ...interface{})
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) WithDefaultLevel(level Level) *Logger
- func (l *Logger) WithOutput(output io.Writer) *Logger
Constants ¶
const ( // DisableLevel disables all leveled logs (some output, such as usage, will be // still printed). DisableLevel = iota // FatalLevel logs indicates serious errors, which make program unable to // running. FatalLevel // ErrorLevel logs indicates errors which prevent program to perform some // function. ErrorLevel // WarnLevel logs indicates some less serious errors, which doesn't affect // program execution. WarnLevel // InfoLevel logs confirmates that things are working as expected. InfoLevel // VerboseLevel logs contain detailed information that should be // understandable to experienced users to provide insight in the software’s // behavior. VerboseLevel // DebugLevel logs contain detailed information, typically of interest only // when diagnosing problems. DebugLevel // SpamLevel logs are too verbose for regular debbuging. SpamLevel )
const DefaultErrorLevel = ErrorLevel
DefaultErrorLevel represents default level for error logs.
const DefaultLevel = InfoLevel
DefaultLevel represents default level for non-error logs.
const MaxLevel = SpamLevel
MaxLevel represents maximum level for logs.
Variables ¶
var LevelNames = []string{"disable", "fatal", "error", "warn", "info", "verbose", "debug", "spam"}
LevelNames contains all supported names of logging levels.
Functions ¶
func Debug ¶
func Debug(v ...interface{})
Debug will print only when logger's Level is debug or spam.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf will print only when logger's Level is debug or spam.
func Error ¶
func Error(v ...interface{})
Error will print only when logger's Level is error, warn, info, verbose, debug or spam.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf will print only when logger's Level is error, warn, info, verbose, debug or spam.
func Fatal ¶
func Fatal(v ...interface{})
Fatal `os.Exit(1)` exit no matter the level of the logger. If the logger's level is fatal, error, warn, info, verbose debug or spam then it will print the log message too.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf will `os.Exit(1)` no matter the level of the logger. If the logger's level is fatal, error, warn, info, verbose debug or spam then it will print the log message too.
func GetDefaultErrorLevel ¶ added in v1.1.0
func GetDefaultErrorLevel() string
GetDefaultErrorLevel returns default error logging level name.
func GetDefaultLevel ¶
func GetDefaultLevel() string
GetDefaultLevel returns default logging level name.
func GetSupportedLevels ¶ added in v1.1.0
func GetSupportedLevels() []string
GetSupportedLevels returns supported logging levels.
func IncreaseLevel ¶
func IncreaseLevel(levels int)
IncreaseLevel changes current level by specified number.
func Info ¶
func Info(v ...interface{})
Info will print only when logger's Level is info, verbose, debug or spam.
func Infof ¶
func Infof(format string, args ...interface{})
Infof will print only when logger's Level is info, verbose, debug or spam.
func Printf ¶ added in v1.1.0
func Printf(format string, args ...interface{})
Printf prints a log message without levels and colors.
func Println ¶
func Println(v ...interface{})
Println prints a log message without levels and colors.
func SetLevel ¶
func SetLevel(levelName string)
SetLevel sets minimum level for logs, logs with level above specified value will not be printed.
func SetLevelFromEnv ¶
func SetLevelFromEnv()
SetLevelFromEnv sets minimum level for logs based on environment variables
func Spamf ¶
func Spamf(format string, args ...interface{})
Spamf will print when logger's Level is spam.
func Verbose ¶
func Verbose(v ...interface{})
Verbose will print only when logger's Level is verbose, debug or spam.
func Verbosef ¶
func Verbosef(format string, args ...interface{})
Verbosef will print only when logger's Level is verbose, debug or spam.
Types ¶
type LevelConfig ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) Debug ¶ added in v1.1.0
func (l *Logger) Debug(v ...interface{})
Debug will print only when logger's Level is debug or spam.
func (*Logger) Debugf ¶ added in v1.1.0
Debugf will print only when logger's Level is debug or spam.
func (*Logger) Error ¶ added in v1.1.0
func (l *Logger) Error(v ...interface{})
Error will print only when logger's Level is error, warn, info, verbose, debug or spam.
func (*Logger) Errorf ¶ added in v1.1.0
Errorf will print only when logger's Level is error, warn, info, verbose, debug or spam.
func (*Logger) Fatal ¶ added in v1.1.0
func (l *Logger) Fatal(v ...interface{})
Fatal `os.Exit(1)` exit no matter the level of the logger. If the logger's level is fatal, error, warn, info, verbose debug or spam then it will print the log message too.
func (*Logger) Fatalf ¶ added in v1.1.0
Fatalf will `os.Exit(1)` no matter the level of the logger. If the logger's level is fatal, error, warn, info, verbose debug or spam then it will print the log message too.
func (*Logger) Info ¶ added in v1.1.0
func (l *Logger) Info(v ...interface{})
Info will print only when logger's Level is info, verbose, debug or spam.
func (*Logger) Infof ¶ added in v1.1.0
Infof will print only when logger's Level is info, verbose, debug or spam.
func (*Logger) Printf ¶ added in v1.1.0
Printf formats according to the specified format without levels and colors.
func (*Logger) Println ¶
func (l *Logger) Println(v ...interface{})
Println prints a log message without levels and colors.
func (*Logger) Spam ¶ added in v1.1.0
func (l *Logger) Spam(v ...interface{})
Spam will print when logger's Level is spam.
func (*Logger) Verbose ¶ added in v1.1.0
func (l *Logger) Verbose(v ...interface{})
Verbose will print only when logger's Level is verbose, debug or spam.
func (*Logger) Verbosef ¶ added in v1.1.0
Verbosef will print only when logger's Level is verbose, debug or spam.
func (*Logger) Warn ¶ added in v1.1.0
func (l *Logger) Warn(v ...interface{})
Warn will print only when logger's Level is warn, info, verbose, debug or spam.
func (*Logger) Warnf ¶ added in v1.1.0
Warnf will print only when logger's Level is warn, info, verbose, debug or spam.
func (*Logger) WithDefaultLevel ¶ added in v1.1.1
WithDefaultLevel allows to set default level for logger