logger

package
v0.0.0-...-f20cb1b Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TraceHandler

func TraceHandler() fiber.Handler

TraceHandler would return a fiber handler for appending the trace id into fiber context.

func XormLogger

func XormLogger() log.ContextLogger

Types

type Logger

type Logger interface {
	// Debug logs are typically voluminous, and are usually disabled in production.
	Debug()
	// Info is the default logging priority.
	Info()
	// Warn logs are more important than Info, but don't need individual human review.
	Warn()
	// Error logs are high-priority. If an application is running smoothly, it shouldn't generate any error-level logs.
	Error()
	// Panic logs a message, then panics.
	Panic()
}

type StructLogger

type StructLogger interface {
	Logger

	// Binary data is serialized in an encoding-appropriate format.
	Binary(key string, val []byte) StructLogger
	// Bool constructs a field that carries a bool.
	Bool(key string, val bool) StructLogger
	// Float64 constructs a field that carries a float64.
	Float64(key string, val float64) StructLogger
	// Int constructs a field with the given key and value.
	Int(key string, val int) StructLogger
	// Int64 constructs a field with the given key and value.
	Int64(key string, val int64) StructLogger
	// Int32 constructs a field with the given key and value.
	Int32(key string, val int32) StructLogger
	// Int16 constructs a field with the given key and value.
	Int16(key string, val int16) StructLogger
	// Int8 constructs a field with the given key and value.
	Int8(key string, val int8) StructLogger
	// String constructs a field with the given key and value.
	String(key string, val string) StructLogger
	// Uint constructs a field with the given key and value.
	Uint(key string, val uint) StructLogger
	// Uint64 constructs a field with the given key and value.
	Uint64(key string, val uint64) StructLogger
	// Uint32 constructs a field with the given key and value.
	Uint32(key string, val uint32) StructLogger
	// Uint16 constructs a field with the given key and value.
	Uint16(key string, val uint16) StructLogger
	// Uint8 constructs a field with the given key and value.
	Uint8(key string, val uint8) StructLogger
	// Time constructs a Field with the given key and value.
	Time(key string, val time.Time) StructLogger
	// Stack constructs a field that stores a stacktrace of the current goroutine under provided key.
	Stack(key string) StructLogger
	// Duration constructs a field with the given key and value.
	Duration(key string, val time.Duration) StructLogger
	// Any takes a key and an arbitrary value and chooses the best way to represent them as a field, falling back to a
	// reflection-based approach only if necessary.
	Any(key string, value interface{}) StructLogger
}

func Log

func Log(message string) StructLogger

Log would just log the message.

func Trace

func Trace(ctx context.Context, message string) StructLogger

Trace would log with a trace id from context.

Jump to

Keyboard shortcuts

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