log

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: GPL-3.0, LGPL-3.0, LGPL-3.0-or-later Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LvlCrit  = log15.LvlCrit
	LvlError = log15.LvlError
	LvlWarn  = log15.LvlWarn
	LvlInfo  = log15.LvlInfo
	LvlDebug = log15.LvlDebug
)

Functions

func Crit

func Crit(msg string, ctx ...interface{})

func Debug

func Debug(msg string, ctx ...interface{})

func Error

func Error(msg string, ctx ...interface{})

func Info

func Info(msg string, ctx ...interface{})

func SetLogger

func SetLogger(verbosity int, json bool)

func TerminalFormatEx

func TerminalFormatEx() log15.Format

func Trace

func Trace(msg string, ctx ...interface{})

func Warn

func Warn(msg string, ctx ...interface{})

Types

type GlogHandler

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

GlogHandler is a log handler that mimics the filtering features of Google's glog logger: setting global log levels; overriding with callsite pattern matches; and requesting backtraces at certain positions.

func NewGlogHandler

func NewGlogHandler(h Handler) *GlogHandler

NewGlogHandler creates a new log handler with filtering functionality similar to Google's glog logger. The returned handler implements Handler.

func (*GlogHandler) BacktraceAt

func (h *GlogHandler) BacktraceAt(location string) error

BacktraceAt sets the glog backtrace location. When set to a file and line number holding a logging statement, a stack trace will be written to the Info log whenever execution hits that statement.

Unlike with Vmodule, the ".go" must be present.

func (*GlogHandler) Log

func (h *GlogHandler) Log(r *Record) error

Log implements Handler.Log, filtering a log record through the global, local and backtrace filters, finally emitting it if either allow it through.

func (*GlogHandler) SetHandler

func (h *GlogHandler) SetHandler(nh Handler)

SetHandler updates the handler to write records to the specified sub-handler.

func (*GlogHandler) Verbosity

func (h *GlogHandler) Verbosity(level Lvl)

Verbosity sets the glog verbosity ceiling. The verbosity of individual packages and source files can be raised using Vmodule.

func (*GlogHandler) Vmodule

func (h *GlogHandler) Vmodule(ruleset string) error

Vmodule sets the glog verbosity pattern.

The syntax of the argument is a comma-separated list of pattern=N, where the pattern is a literal file name or "glob" pattern matching and N is a V level.

For instance:

pattern="gopher.go=3"
 sets the V level to 3 in all Go files named "gopher.go"

pattern="foo=3"
 sets V to 3 in all files of any packages whose import path ends in "foo"

pattern="foo/*=3"
 sets V to 3 in all files of any packages whose import path contains "foo"

type Handler

type Handler = log15.Handler

type Lazy

type Lazy = log15.Lazy

type Logger

type Logger struct {
	log15.Logger
}

func New

func New(ctx ...interface{}) *Logger

func (*Logger) Trace

func (l *Logger) Trace(msg string, ctx ...interface{})

type Lvl

type Lvl = log15.Lvl

type Record

type Record = log15.Record

Jump to

Keyboard shortcuts

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