Documentation
¶
Index ¶
- func GetStackTrace(calldepth int) [][]byte
- func GetTypeMsg(prod bool, p Priority) string
- type Formatter
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(template string, args ...interface{})
- func (l *Logger) DevelopmentMode()
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(template string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(template string, args ...interface{})
- func (l *Logger) GetMode() string
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(template string, args ...interface{})
- func (l *Logger) Output(calldepth int, p Priority, template string, args []interface{}, stack [][]byte) error
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(template string, args ...interface{})
- func (l *Logger) Printf(template string, args ...interface{})
- func (l *Logger) Println(args ...interface{})
- func (l *Logger) ProductionMode()
- func (l *Logger) RegisterNewFormatter(f Formatter)
- func (l *Logger) RegisterNewOutput(o Output)
- func (l *Logger) SetCalldepth(calldepth int)
- func (l *Logger) StackTrace(v interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(template string, args ...interface{})
- type Output
- type Priority
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Formatter ¶
type Formatter interface { Development(buf *[]byte, t time.Time, file string, line int, function string, p Priority, s string, stack [][]byte) Production(buf *[]byte, t time.Time, file string, line int, function string, p Priority, s string, stack [][]byte) }
Formatter define custom format output to implement in a new logger
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger struct doc
func New ¶
New creates a new Logger. The out variable sets the destination to which log data will be written. The prefix appears at the beginning of each generated log line. The flag argument defines the logging properties.
func (*Logger) Debug ¶
func (l *Logger) Debug(args ...interface{})
Debug uses fmt.Sprint to construct and log a message.
func (*Logger) DevelopmentMode ¶
func (l *Logger) DevelopmentMode()
DevelopmentMode set development mode logger
func (*Logger) Error ¶
func (l *Logger) Error(args ...interface{})
Error uses fmt.Sprint to construct and log a message. Error logs a message at ErrorLevel.
func (*Logger) Errorf ¶
Errorf uses fmt.Sprintf to log a templated message Errorf logs a message at ErrorLevel with format.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit. Fatal logs a message at FatalLevel.
func (*Logger) Fatalf ¶
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit. Fatalf logs a message at FatalLevel with format.
func (*Logger) Info ¶
func (l *Logger) Info(args ...interface{})
Info uses fmt.Sprint to construct and log a message. Info logs a message at InfoLevel.
func (*Logger) Infof ¶
Infof uses fmt.Sprintf to log a templated message. Infof logs a message at InfoLevel whit format.
func (*Logger) Output ¶
func (l *Logger) Output(calldepth int, p Priority, template string, args []interface{}, stack [][]byte) error
Output writes the output for a logging event. The string s contains the text to print after the prefix specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Calldepth is used to recover the PC and is provided for generality, although at the moment on all pre-defined paths it will be 2.z
func (*Logger) Panic ¶
func (l *Logger) Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics. Panic logs a message at PanicLevel. The logger then panics, even if logging at PanicLevel is disabled.
func (*Logger) Panicf ¶
Panicf uses fmt.Sprintf to log a templated message, then panics. Panicf logs a message at PanicLevel whit format. The logger then panics, even if logging at PanicLevel is disabled.
func (*Logger) Printf ¶
Printf uses fmt.Sprintf to log a templated message. Printf logs a message at InfoLevel whit format.
func (*Logger) Println ¶
func (l *Logger) Println(args ...interface{})
Println uses fmt.Sprint to construct and log a message. Println logs a message at InfoLevel.
func (*Logger) ProductionMode ¶
func (l *Logger) ProductionMode()
ProductionMode set production mode logger
func (*Logger) RegisterNewFormatter ¶
RegisterNewFormatter configure your custom outputs development and production format
func (*Logger) RegisterNewOutput ¶
RegisterNewOutput Set custom log output destination
func (*Logger) SetCalldepth ¶
SetCalldepth configure the number of stack frames to ascend, with 0 identifying the caller of Caller.
func (*Logger) StackTrace ¶
func (l *Logger) StackTrace(v interface{})
StackTrace allows you to view the exact place where the error or incident originated within the code. Shows a trace of up to 10 layers from where the error or incident was generated.