log

package module
v0.0.0-...-240def6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 15 Imported by: 0

README

log

Documentation

Index

Constants

View Source
const (
	None    = 0
	Black   = 30
	Red     = 31
	Green   = 32
	Yellow  = 33
	Blue    = 34
	Magenta = 35
	Cyan    = 36
	White   = 37
	Gray    = 90

	ColorCaller     = Gray
	ColorMessage    = None
	ColorFieldName  = Cyan
	ColorFieldValue = None
)
View Source
const (
	EnvLevel   = "FS_LOG_LEVEL"
	EnvOutput  = "FS_LOG_OUTPUT"
	EnvNoColor = "FS_LOG_NOCOLOR"
	EnvJson    = "FS_LOG_JSON"
	EnvNoTime  = "FS_LOG_NOTIME"
)

Variables

Functions

func HttpHandler

func HttpHandler() func(http.Handler) http.Handler

func Output

func Output() io.Writer

Return the output used by the logger

func Print

func Print(v ...interface{})

func Printf

func Printf(format string, v ...interface{})

func SetLevel

func SetLevel(level string) error

SetLevel set global level of the logger: debug, info, warn, error, fatal, panic.

func SetOutput

func SetOutput(out io.Writer)

SetOutput writer

func Write

func Write(p []byte) (n int, err error)

Types

type CompatibilityWrapper

type CompatibilityWrapper struct {
	// contains filtered or unexported fields
}

func Compatibility

func Compatibility() CompatibilityWrapper

func (CompatibilityWrapper) Debug

func (c CompatibilityWrapper) Debug(args ...interface{})

debug

func (CompatibilityWrapper) Debugf

func (c CompatibilityWrapper) Debugf(format string, args ...interface{})

func (CompatibilityWrapper) Debugln

func (c CompatibilityWrapper) Debugln(args ...interface{})

func (CompatibilityWrapper) Error

func (c CompatibilityWrapper) Error(args ...interface{})

error

func (CompatibilityWrapper) Errorf

func (c CompatibilityWrapper) Errorf(format string, args ...interface{})

func (CompatibilityWrapper) Errorln

func (c CompatibilityWrapper) Errorln(args ...interface{})

func (CompatibilityWrapper) Fatal

func (c CompatibilityWrapper) Fatal(args ...interface{})

fatal

func (CompatibilityWrapper) Fatalf

func (c CompatibilityWrapper) Fatalf(format string, args ...interface{})

func (CompatibilityWrapper) Fatalln

func (c CompatibilityWrapper) Fatalln(args ...interface{})

func (CompatibilityWrapper) Info

func (c CompatibilityWrapper) Info(args ...interface{})

info

func (CompatibilityWrapper) Infof

func (c CompatibilityWrapper) Infof(format string, args ...interface{})

func (CompatibilityWrapper) Infoln

func (c CompatibilityWrapper) Infoln(args ...interface{})

func (CompatibilityWrapper) Print

func (c CompatibilityWrapper) Print(v ...interface{})

print

func (CompatibilityWrapper) Printf

func (c CompatibilityWrapper) Printf(format string, v ...interface{})

func (CompatibilityWrapper) Println

func (c CompatibilityWrapper) Println(v ...interface{})

func (CompatibilityWrapper) V

func (c CompatibilityWrapper) V(level int) bool

level (used by gRPC)

func (CompatibilityWrapper) Warning

func (c CompatibilityWrapper) Warning(args ...interface{})

warning

func (CompatibilityWrapper) Warningf

func (c CompatibilityWrapper) Warningf(format string, args ...interface{})

func (CompatibilityWrapper) Warningln

func (c CompatibilityWrapper) Warningln(args ...interface{})

type Console

type Console struct {
	Parts   []string
	Out     io.Writer
	NoColor bool
	NoTime  bool
}

func (*Console) Colorize

func (c *Console) Colorize(s interface{}, color int) string

func (*Console) Write

func (c *Console) Write(p []byte) (n int, err error)

func (*Console) WritePart

func (c *Console) WritePart(buf *bytes.Buffer, data map[string]interface{}, part string)

type Event

type Event struct {
	// contains filtered or unexported fields
}

func Debug

func Debug() *Event

func Error

func Error() *Event

func Fatal

func Fatal() *Event

func Info

func Info() *Event

func Panic

func Panic() *Event

func Trace

func Trace() *Event

func Warn

func Warn() *Event

func (*Event) AnErr

func (e *Event) AnErr(key string, err error) *Event

func (*Event) Array

func (e *Event) Array(key string, arr zerolog.LogArrayMarshaler) *Event

func (*Event) Bool

func (e *Event) Bool(key string, b bool) *Event

func (*Event) Bools

func (e *Event) Bools(key string, b []bool) *Event

func (*Event) Bytes

func (e *Event) Bytes(key string, val []byte) *Event

func (*Event) Caller

func (e *Event) Caller(skip ...int) *Event

func (*Event) Callers

func (e *Event) Callers() *Event

Callers dump the current stack of callers

func (*Event) Dict

func (e *Event) Dict(key string, dict *Event) *Event

func (*Event) Dur

func (e *Event) Dur(key string, d time.Duration) *Event

func (*Event) Durs

func (e *Event) Durs(key string, d []time.Duration) *Event

func (*Event) EmbedObject

func (e *Event) EmbedObject(obj zerolog.LogObjectMarshaler) *Event

func (*Event) Err

func (e *Event) Err(err error) *Event

func (*Event) Errs

func (e *Event) Errs(key string, errs []error) *Event

func (*Event) Float32

func (e *Event) Float32(key string, f float32) *Event

func (*Event) Float64

func (e *Event) Float64(key string, f float64) *Event

func (*Event) Floats32

func (e *Event) Floats32(key string, f []float32) *Event

func (*Event) Floats64

func (e *Event) Floats64(key string, f []float64) *Event

func (*Event) Heap

func (e *Event) Heap() *Event

func (*Event) Hex

func (e *Event) Hex(key string, val []byte) *Event

func (*Event) IPAddr

func (e *Event) IPAddr(key string, ip net.IP) *Event

func (*Event) IPPrefix

func (e *Event) IPPrefix(key string, pfx net.IPNet) *Event

func (*Event) Int

func (e *Event) Int(key string, i int) *Event

func (*Event) Int16

func (e *Event) Int16(key string, i int16) *Event

func (*Event) Int32

func (e *Event) Int32(key string, i int32) *Event

func (*Event) Int64

func (e *Event) Int64(key string, i int64) *Event

func (*Event) Int8

func (e *Event) Int8(key string, i int8) *Event

func (*Event) Interface

func (e *Event) Interface(key string, i interface{}) *Event

func (*Event) Ints

func (e *Event) Ints(key string, i []int) *Event

func (*Event) Ints16

func (e *Event) Ints16(key string, i []int16) *Event

func (*Event) Ints32

func (e *Event) Ints32(key string, i []int32) *Event

func (*Event) Ints64

func (e *Event) Ints64(key string, i []int64) *Event

func (*Event) Ints8

func (e *Event) Ints8(key string, i []int8) *Event

func (*Event) MACAddr

func (e *Event) MACAddr(key string, ha net.HardwareAddr) *Event

func (*Event) Msg

func (e *Event) Msg(msg string)

func (*Event) Msgf

func (e *Event) Msgf(format string, v ...interface{})

func (*Event) Object

func (e *Event) Object(key string, obj zerolog.LogObjectMarshaler) *Event

func (*Event) RawJSON

func (e *Event) RawJSON(key string, b []byte) *Event

func (*Event) Send

func (e *Event) Send()

func (*Event) Str

func (e *Event) Str(key, val string) *Event

func (*Event) Stringer

func (e *Event) Stringer(key string, val fmt.Stringer) *Event

func (*Event) Strs

func (e *Event) Strs(key string, vals []string) *Event

func (*Event) Tag

func (e *Event) Tag(names ...string) *Event

func (*Event) Time

func (e *Event) Time(key string, t time.Time) *Event

func (*Event) TimeDiff

func (e *Event) TimeDiff(key string, t time.Time, start time.Time) *Event

func (*Event) Times

func (e *Event) Times(key string, t []time.Time) *Event

func (*Event) Timestamp

func (e *Event) Timestamp() *Event

func (*Event) Uint

func (e *Event) Uint(key string, i uint) *Event

func (*Event) Uint16

func (e *Event) Uint16(key string, i uint16) *Event

func (*Event) Uint32

func (e *Event) Uint32(key string, i uint32) *Event

func (*Event) Uint64

func (e *Event) Uint64(key string, i uint64) *Event

func (*Event) Uint8

func (e *Event) Uint8(key string, i uint8) *Event

func (*Event) Uints

func (e *Event) Uints(key string, i []uint) *Event

func (*Event) Uints16

func (e *Event) Uints16(key string, i []uint16) *Event

func (*Event) Uints32

func (e *Event) Uints32(key string, i []uint32) *Event

func (*Event) Uints64

func (e *Event) Uints64(key string, i []uint64) *Event

func (*Event) Uints8

func (e *Event) Uints8(key string, i []uint8) *Event

type LogLevel

type LogLevel int8
const (
	DebugLevel LogLevel = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
	PanicLevel
	NoLevel
	Disabled
	TraceLevel LogLevel = -1
)

type Wrapper

type Wrapper struct {
	// contains filtered or unexported fields
}

func Level

func Level(lvl LogLevel) Wrapper

func Tag

func Tag(names ...string) Wrapper

func (Wrapper) Compatibility

func (w Wrapper) Compatibility() CompatibilityWrapper

func (Wrapper) Debug

func (w Wrapper) Debug() *Event

func (Wrapper) Error

func (w Wrapper) Error() *Event

func (Wrapper) Fatal

func (w Wrapper) Fatal() *Event

func (Wrapper) Info

func (w Wrapper) Info() *Event

func (Wrapper) Level

func (w Wrapper) Level(lvl LogLevel) Wrapper

func (Wrapper) Panic

func (w Wrapper) Panic() *Event

func (Wrapper) Print

func (w Wrapper) Print(v ...interface{})

Print sends a log event using debug level and no extra field.

func (Wrapper) Printf

func (w Wrapper) Printf(format string, v ...interface{})

Printf sends a log event using debug level and no extra field.

func (Wrapper) Trace

func (w Wrapper) Trace() *Event

func (Wrapper) Warn

func (w Wrapper) Warn() *Event

func (Wrapper) Write

func (w Wrapper) Write(p []byte) (n int, err error)

Write implements the io.Writer interface

Jump to

Keyboard shortcuts

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