gclog

package
v0.0.0-...-54f7cab Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFields

type LogFields map[string]interface{}

type LogLevel

type LogLevel int
const (
	NoLevel LogLevel = iota
	TraceLevel
	DebugLevel
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
	PanicLevel
)

type LogOption

type LogOption func(*logCfg) error

func WithDefaultLogLevel

func WithDefaultLogLevel(level LogLevel) LogOption

func WithFileLogger

func WithFileLogger(filename string) LogOption

func WithJsonStdOut

func WithJsonStdOut() LogOption

func WithMultiLogger

func WithMultiLogger(ws ...io.Writer) LogOption

func WithTimestampFormat

func WithTimestampFormat(format string) LogOption

type Logger

type Logger interface {
	// log methods
	Event(msg string, level LogLevel, err error, csfCount int, fields ...LogFields)
	Trace(msg string, fields ...LogFields)
	Debug(msg string, fields ...LogFields)
	Info(msg string, fields ...LogFields)
	Warn(msg string, fields ...LogFields)
	Error(msg string, err error, fields ...LogFields)
	Fatal(msg string, err error, fields ...LogFields)
	Panic(msg string, err error, fields ...LogFields)
	Println(msg ...any)
	Printf(format string, v ...interface{})
	// settings methods
	SetMinGlobalLogLevel(minLevel LogLevel) Logger
	SetMinCallerAttachLevel(minLevel LogLevel) Logger
	SetContext(keyword string) Logger
	DisableStackTraceOnError() Logger
	DisableTimestamp() Logger
	DisableAllLoggers() Logger
	// contains filtered or unexported methods
}

func New

func New(options ...LogOption) (Logger, error)

Directories

Path Synopsis
csv

Jump to

Keyboard shortcuts

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