Documentation ¶
Index ¶
- Constants
- Variables
- func Critical(message string)
- func Criticalf(format string, a ...interface{})
- func Debug(message string)
- func Debugf(format string, a ...interface{})
- func Error(message string)
- func Errorf(format string, a ...interface{})
- func Fatal(message string)
- func Fatalf(format string, a ...interface{})
- func Info(message string)
- func Infof(format string, a ...interface{})
- func IsValidLevel(i int) error
- func Log(lvl Lvl, message string)
- func Notice(message string)
- func Noticef(format string, a ...interface{})
- func Panic(message string)
- func Panicf(format string, a ...interface{})
- func SetDefaultFormat()
- func SetLevel(id int, name, color string, emoji int)
- func StackAsCritical(message string)
- func StackAsError(message string)
- func Warning(message string)
- func Warningf(format string, a ...interface{})
- type Format
- type Level
- type Logger
- func (l *Logger) Critical(message string)
- func (l *Logger) Criticalf(format string, a ...interface{})
- func (l *Logger) Debug(message string)
- func (l *Logger) Debugf(format string, a ...interface{})
- func (l *Logger) Error(message string)
- func (l *Logger) Errorf(format string, a ...interface{})
- func (l *Logger) Fatal(message string)
- func (l *Logger) Fatalf(format string, a ...interface{})
- func (l *Logger) Info(message string)
- func (l *Logger) Infof(format string, a ...interface{})
- func (l *Logger) Log(lvl Lvl, message string)
- func (l *Logger) Notice(message string)
- func (l *Logger) Noticef(format string, a ...interface{})
- func (l *Logger) Output(calldepth int, s string) error
- func (l *Logger) Panic(message string)
- func (l *Logger) Panicf(format string, a ...interface{})
- func (l *Logger) SetFormat(format string)
- func (l *Logger) SetLogLevel(level Lvl)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) StackAsCritical(message string)
- func (l *Logger) StackAsError(message string)
- func (l *Logger) Warning(message string)
- func (l *Logger) Warningf(format string, a ...interface{})
- type Lvl
Constants ¶
const ( // CLITimeFmt command line interface CLITimeFmt string = "rfc822" // DefTimeFmt default time format DefTimeFmt string = "rfc3339" // DetailedTimeFmt has nanoseconds DetailedTimeFmt string = "rfc3339Nano" // CLIFormat command line interface CLIFormat string = "cli" // PlainFormat just print message PlainFormat string = "plain" // PlainFormatWithEmoji just print message with emoji PlainFormatWithEmoji string = "plain-emoji" // StdFormat standard format StdFormat string = "std" // StdFormatWithEmoji same as above with an emoji StdFormatWithEmoji string = "std-emoji" // SimpleFormat short SimpleFormat string = "simple" // JSONFormat initial attempt at supporting json JSONFormat string = "json" )
Variables ¶
var ( // Formats exported formats Formats = map[string]Format{ CLITimeFmt: { Name: CLITimeFmt, // contains filtered or unexported fields }, DefTimeFmt: { Name: DefTimeFmt, // contains filtered or unexported fields }, DetailedTimeFmt: { Name: DetailedTimeFmt, // contains filtered or unexported fields }, CLIFormat: { Name: CLIFormat, // contains filtered or unexported fields }, PlainFormat: { Name: PlainFormat, // contains filtered or unexported fields }, PlainFormatWithEmoji: { Name: PlainFormatWithEmoji, // contains filtered or unexported fields }, StdFormat: { Name: StdFormat, // contains filtered or unexported fields }, StdFormatWithEmoji: { Name: StdFormatWithEmoji, // contains filtered or unexported fields }, SimpleFormat: { Name: SimpleFormat, // contains filtered or unexported fields }, JSONFormat: { Name: JSONFormat, // contains filtered or unexported fields }, } )
var ( // Levels map all levels to their stuff (a color). also i spent a lot of time deciding these defaults Levels = map[Lvl]Level{ LCrit: initLvl( 1, "FATAL", "Red", 128557, ), LErr: initLvl( 2, "ERROR", "Magenta", 128545, ), LWarn: initLvl( 3, "WARN", "Yellow", 128548, ), LNotice: initLvl( 4, "NOTICE", "Green", 128516, ), LInfo: initLvl( 5, "INFO", "Cyan", 128523, ), LDebug: initLvl( 6, "DEBUG", "White", 128533, ), } )
Functions ¶
func Criticalf ¶
func Criticalf(format string, a ...interface{})
Criticalf logs a message at Critical level using the same syntax and options as fmt.Printf
func Debugf ¶
func Debugf(format string, a ...interface{})
Debugf logs a message at Debug level using the same syntax and options as fmt.Printf
func Errorf ¶
func Errorf(format string, a ...interface{})
Errorf logs a message at Error level using the same syntax and options as fmt.Printf
func Fatal ¶
func Fatal(message string)
Fatal is just like func l.Critical logger except that it is followed by exit to program
func Fatalf ¶
func Fatalf(format string, a ...interface{})
Fatalf is just like func l.CriticalF logger except that it is followed by exit to program
func Infof ¶
func Infof(format string, a ...interface{})
Infof logs a message at Info level using the same syntax and options as fmt.Printf
func IsValidLevel ¶
func Log ¶
Log The log commnand is the function available to user to log message, lvl specifies the degree of the message the user wants to log, message is the info user wants to log
func Noticef ¶
func Noticef(format string, a ...interface{})
Noticef logs a message at Notice level using the same syntax and options as fmt.Printf
func Panic ¶
func Panic(message string)
Panic is just like func l.Critical except that it is followed by a call to panic
func Panicf ¶
func Panicf(format string, a ...interface{})
Panicf is just like func l.CriticalF except that it is followed by a call to panic
func StackAsCritical ¶
func StackAsCritical(message string)
StackAsCritical Prints a goroutine's execution stack as critical with an optional message at the begining
func StackAsError ¶
func StackAsError(message string)
StackAsError Prints a goroutine's execution stack as an error with an optional message at the begining
Types ¶
type Format ¶
type Format struct { Name string // contains filtered or unexported fields }
Format is a format :D
type Level ¶
type Level struct { ID int // export this for comamndlines etc Str string // and this // contains filtered or unexported fields }
Level struct
type Logger ¶
type Logger struct { Module string // contains filtered or unexported fields }
Logger class that is an interface to user to log messages, Module is the module for which we are testing worker is variable of Worker class that is used in bottom layers to log the message
func New ¶
New Returns a new instance of logger class, module is the specific module for which we are logging , color defines whether the output is to be colored or not, out is instance of type io.Writer defaults to os.Stderr
func (*Logger) Criticalf ¶
Criticalf logs a message at Critical level using the same syntax and options as fmt.Printf
func (*Logger) Debugf ¶
Debugf logs a message at Debug level using the same syntax and options as fmt.Printf
func (*Logger) Errorf ¶
Errorf logs a message at Error level using the same syntax and options as fmt.Printf
func (*Logger) Fatal ¶
Fatal is just like func l.Critical logger except that it is followed by exit to program
func (*Logger) Fatalf ¶
Fatalf is just like func l.CriticalF logger except that it is followed by exit to program
func (*Logger) Infof ¶
Infof logs a message at Info level using the same syntax and options as fmt.Printf
func (*Logger) Log ¶
Log The log commnand is the function available to user to log message, lvl specifies the degree of the message the user wants to log, message is the info user wants to log
func (*Logger) Noticef ¶
Noticef logs a message at Notice level using the same syntax and options as fmt.Printf
func (*Logger) Panic ¶
Panic is just like func l.Critical except that it is followed by a call to panic
func (*Logger) Panicf ¶
Panicf is just like func l.CriticalF except that it is followed by a call to panic
func (*Logger) SetLogLevel ¶
SetLogLevel to change verbosity
func (*Logger) StackAsCritical ¶
StackAsCritical Prints a goroutine's execution stack as critical with an optional message at the begining
func (*Logger) StackAsError ¶
StackAsError Prints a goroutine's execution stack as an error with an optional message at the begining