Documentation ¶
Index ¶
- Constants
- func Closer(c io.Closer)
- func Debug(v ...any)
- func Debugf(format string, v ...any)
- func DumpHttpRequest(r *http.Request, logFunc func(v ...any))
- func DumpHttpResponse(r *http.Response, logFunc func(v ...any))
- func Error(v ...any)
- func Errorf(format string, v ...any)
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func FunctionInfo(skip int) (string, string, int)
- func InLevel(level Level) bool
- func Info(v ...any)
- func Infof(format string, v ...any)
- func SetLogger(logger Logger)
- func Trace(v ...any)
- func Tracef(format string, v ...any)
- func Warn(v ...any)
- func Warnf(format string, v ...any)
- type Config
- type GoroutineID
- type Level
- type Logger
- type StdLogger
- func (l *StdLogger) Debug(v ...any)
- func (l *StdLogger) Debugf(format string, v ...any)
- func (l *StdLogger) Error(v ...any)
- func (l *StdLogger) Errorf(format string, v ...any)
- func (l *StdLogger) Fatal(v ...any)
- func (l *StdLogger) Fatalf(format string, v ...any)
- func (l *StdLogger) InLevel(lvl Level) bool
- func (l *StdLogger) Info(v ...any)
- func (l *StdLogger) Infof(format string, v ...any)
- func (l *StdLogger) SetAdditionalOut(out io.Writer)
- func (l *StdLogger) SetFormatter(f format)
- func (l *StdLogger) SetFuncNamePrinting(on bool)
- func (l *StdLogger) SetLevel(level Level)
- func (l *StdLogger) SetTimeFormat(format string)
- func (l *StdLogger) Trace(v ...any)
- func (l *StdLogger) Tracef(format string, v ...any)
- func (l *StdLogger) Warn(v ...any)
- func (l *StdLogger) Warnf(format string, v ...any)
Constants ¶
const ( FormatText format = iota FormatJSON )
Variables ¶
This section is empty.
Functions ¶
func Closer ¶ added in v0.2.1
Closer calls the Close method, if the closure occurred with an error, it prints it to the log.
func DumpHttpRequest ¶ added in v0.0.2
DumpHttpRequest dumps the HTTP request and prints out with logFunc.
func DumpHttpResponse ¶ added in v0.0.2
DumpHttpResponse dumps the HTTP response and prints out with logFunc.
func FunctionInfo ¶
FunctionInfo returns the name of the function and file, the line number on the calling goroutine's stack. The argument skip is the number of stack frames to ascend.
Types ¶
type GoroutineID ¶ added in v0.2.0
type GoroutineID []byte
GoroutineID is an array of bytes representing the number of the current goroutine on the stack.
func GetGoroutineID ¶ added in v0.2.0
func GetGoroutineID() GoroutineID
GetGoroutineID gets the number of the current goroutine on the stack.
func (GoroutineID) String ¶ added in v0.2.1
func (i GoroutineID) String() string
func (GoroutineID) Uint64 ¶ added in v0.2.0
func (i GoroutineID) Uint64() uint64
Uint64 converts the GoroutineID value to uint64.
type Level ¶
type Level uint32
func ParseLevel ¶ added in v0.0.4
ParseLevel takes a string level and returns the logger Level constant.
func (Level) Print ¶ added in v0.0.5
Print returns a logger print function for current logger level.
type Logger ¶
type Logger interface { InLevel(lvl Level) bool Fatalf(format string, v ...any) Fatal(v ...any) Errorf(format string, v ...any) Error(v ...any) Warnf(format string, v ...any) Warn(v ...any) Infof(format string, v ...any) Info(v ...any) Debugf(format string, v ...any) Debug(v ...any) Tracef(format string, v ...any) Trace(v ...any) }
type StdLogger ¶
type StdLogger struct {
// contains filtered or unexported fields
}
func (*StdLogger) SetAdditionalOut ¶
SetAdditionalOut sets an additional logger output.
func (*StdLogger) SetFormatter ¶
func (l *StdLogger) SetFormatter(f format)
SetFormatter sets the logger formatter.
func (*StdLogger) SetFuncNamePrinting ¶
SetFuncNamePrinting sets whether the logger should print the caller function name.
func (*StdLogger) SetTimeFormat ¶
SetTimeFormat sets the logger time format.