core

package module
v0.0.0-...-2dfd141 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStackTrace

func GetStackTrace(calldepth int) [][]byte

GetStackTrace doc ...

func GetTypeMsg

func GetTypeMsg(prod bool, p Priority) string

GetTypeMsg get message type

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

func New(f Formatter, o Output, calldepth int) Logger

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) Debugf

func (l *Logger) Debugf(template string, args ...interface{})

Debugf uses fmt.Sprintf to log a templated 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

func (l *Logger) Errorf(template string, args ...interface{})

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

func (l *Logger) Fatalf(template string, args ...interface{})

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit. Fatalf logs a message at FatalLevel with format.

func (*Logger) GetMode

func (l *Logger) GetMode() string

GetMode doc ...

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

func (l *Logger) Infof(template string, args ...interface{})

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

func (l *Logger) Panicf(template string, args ...interface{})

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

func (l *Logger) Printf(template string, args ...interface{})

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

func (l *Logger) RegisterNewFormatter(f Formatter)

RegisterNewFormatter configure your custom outputs development and production format

func (*Logger) RegisterNewOutput

func (l *Logger) RegisterNewOutput(o Output)

RegisterNewOutput Set custom log output destination

func (*Logger) SetCalldepth

func (l *Logger) SetCalldepth(calldepth int)

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.

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn uses fmt.Sprint to construct and log a message.

func (*Logger) Warnf

func (l *Logger) Warnf(template string, args ...interface{})

Warnf uses fmt.Sprintf to log a templated message

type Output

type Output interface {
	Write(p []byte) error
}

Output define custom destination out to implement in a new logger

type Priority

type Priority int8

Priority is a logging priority. Higher levels are more important.

func GetPriority

func GetPriority(v interface{}) Priority

GetPriority message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL