logger

package
v0.0.0-...-e6f5c9c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 0 Imported by: 2

README

logger

a standard logger interface

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = new(noop)

Functions

This section is empty.

Types

type Level

type Level = uint32
const (
	Debug Level
	Info
	Warn
	Error
)

type Logger

type Logger interface {
	// SetLevel modify logger level.
	SetLevel(l Level)

	// IsDebugEnabled return True if this Logger is enabled for the Debug level, false otherwise.
	IsDebugEnabled() bool
	// Debug formats using the default formats for its operands and logs a message at Debug level.
	Debug(args ...interface{})
	// Debugf formats according to a format specifier and log a templated message at Debug level.
	Debugf(template string, args ...interface{})

	// IsInfoEnabled return True if this Logger is enabled for the Info level, false otherwise.
	IsInfoEnabled() bool
	// Info formats using the default formats for its operands and logs a message at Info level.
	Info(args ...interface{})
	// Infof formats according to a format specifier and log a templated message at Info level.
	Infof(template string, args ...interface{})

	// IsWarnEnabled return True if this Logger is enabled for the Warn level, false otherwise.
	IsWarnEnabled() bool
	// Warn formats using the default formats for its operands and logs a message at Warn level.
	Warn(args ...interface{})
	// Warnf formats according to a format specifier and log a templated message at Warn level.
	Warnf(template string, args ...interface{})

	// IsErrorEnabled return True if this Logger is enabled for the Error level, false otherwise.
	IsErrorEnabled() bool
	// Error formats using the default formats for its operands and logs a message at Error level.
	Error(args ...interface{})
	// Errorf formats according to a format specifier and log a templated message at Error level.
	Errorf(template string, args ...interface{})

	// WithTrace add trace id to the logging context.
	WithTrace(traceID string)

	// With adds a variadic number of fields to the logging context. It accepts
	// loosely-typed key-value pairs. When processing pairs, the first element
	// of the pair is used as the field key and the second as the field value.
	With(args ...interface{})

	// Sync flushes any buffered log entries.
	Sync() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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