log

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogLevel = len(logrus.AllLevels) - 2

DefaultLogLevel is the default log level value.

View Source
var DevDefaults = Options{
	Level:     mustFirst(strconv.Atoi(local.Getenv("INFRAKIT_LOG_DEV_LEVEL", "4"))),
	Stdout:    false,
	Format:    local.Getenv("INFRAKIT_LOG_DEV_FORMAT", "term"),
	CallStack: true,
}

DevDefaults is the default options for development

View Source
var ProdDefaults = Options{
	Level:    4,
	Stdout:   false,
	Format:   "term",
	CallFunc: true,
}

ProdDefaults is the default options for production

Functions

func Configure

func Configure(options *Options)

Configure configures the logging

func New

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

New returns a logger of given context

func Root

func Root() log15.Logger

Root returns the process's root logger

func SetLogLevel

func SetLogLevel(level int)

SetLogLevel adjusts the logrus level.

Types

type Options

type Options struct {
	Level     int
	Stdout    bool
	Format    string
	CallFunc  bool
	CallStack bool

	// DebugMatchKeyValuePairs is the '=' delimited kv pair for filtering contexts in records for DEBUG
	DebugMatchKeyValuePairs []string

	// DebugMatchExclude excludes the record if any of the context params matches those in the MatchKeyValuePairs
	DebugMatchExclude bool

	// DebugV is a value of verbosity for checking debug records where there's a context param of type DebugV
	DebugV int
}

Options capture the logging configuration

type V

type V int

V is the Verbosity level. To set a verbosity level, just put a log.V(100) in the context (e.g. .Debug(msg, "key", log.V(100))

Jump to

Keyboard shortcuts

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