log

package
v0.0.0-...-086ef7a Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const RootName = "sweetbridge"

RootName is the default logger name

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Color   bool   `yaml:"color"`
	TimeFmt string `yaml:"timeFmt"` // one of timeFMT values
	Level   string `yaml:"level"`
	// contains filtered or unexported fields
}

Config represents log config

func (*Config) Check

func (c *Config) Check() error

Check validates the config content

type Logger

type Logger interface {
	// New returns a new Logger that has this logger's context plus the given context
	New(ctx ...interface{}) log15.Logger

	// Log a message at the given level with context key/value pairs
	Trace(msg string, ctx ...interface{})
	Debug(msg string, ctx ...interface{})
	Info(msg string, ctx ...interface{})
	Warn(msg string, ctx ...interface{})
	Error(msg string, ctx ...interface{})
	Crit(msg string, ctx ...interface{})

	// Fatal is a Crit log followed by panic
	Fatal(msg string, ctx ...interface{})
}

A Logger writes key/value pairs to a Handler

func New

func New(name string, c Config, rc rollbar.Config) (Logger, error)

New constructs logger and registers it in the log15 repository. If the logger `name` is already registered then it's upgraded according to given config.

func Root

func Root() Logger

Root returns the default logger

Jump to

Keyboard shortcuts

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