log

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package log provides logging functionality to Trickster

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger is a container for the underlying log provider

func ConsoleLogger

func ConsoleLogger(logLevel string) *Logger

ConsoleLogger returns a Logger object that prints log events to the Console

func DefaultLogger

func DefaultLogger() *Logger

DefaultLogger returns the default logger, which is the console logger at level "info"

func New

func New(conf *config.Config) *Logger

New returns a Logger for the provided logging configuration. The returned Logger will write to files distinguished from other Loggers by the instance string.

func (*Logger) Close

func (tl *Logger) Close()

Close closes any opened file handles that were used for logging.

func (*Logger) Debug

func (tl *Logger) Debug(event string, detail Pairs)

Debug sends an "DEBUG" event to the Logger

func (*Logger) Error

func (tl *Logger) Error(event string, detail Pairs)

Error sends an "ERROR" event to the Logger

func (*Logger) ErrorOnce

func (tl *Logger) ErrorOnce(key string, event string, detail Pairs) bool

ErrorOnce sends an "ERROR" event to the Logger only once per key Returns true if this invocation was the first, and thus sent to the Logger

func (*Logger) Fatal

func (tl *Logger) Fatal(code int, event string, detail Pairs)

Fatal sends a "FATAL" event to the Logger and exits the program with the provided exit code

func (*Logger) HasWarnedOnce

func (tl *Logger) HasWarnedOnce(key string) bool

HasWarnedOnce returns true if a warning for the key has already been sent to the Logger

func (*Logger) Info

func (tl *Logger) Info(event string, detail Pairs)

Info sends an "INFO" event to the Logger

func (*Logger) InfoOnce

func (tl *Logger) InfoOnce(key string, event string, detail Pairs) bool

InfoOnce sends a "INFO" event to the Logger only once per key. Returns true if this invocation was the first, and thus sent to the Logger

func (*Logger) Level

func (tl *Logger) Level() string

Level returns the configured Log Level

func (*Logger) SetLogLevel

func (tl *Logger) SetLogLevel(logLevel string)

SetLogLevel sets the log level, defaulting to "Info" if the provided level is unknown

func (*Logger) Trace

func (tl *Logger) Trace(event string, detail Pairs)

Trace sends a "TRACE" event to the Logger

func (*Logger) Warn

func (tl *Logger) Warn(event string, detail Pairs)

Warn sends an "WARN" event to the Logger

func (*Logger) WarnOnce

func (tl *Logger) WarnOnce(key string, event string, detail Pairs) bool

WarnOnce sends a "WARN" event to the Logger only once per key. Returns true if this invocation was the first, and thus sent to the Logger

type Pairs

type Pairs map[string]interface{}

Pairs represents a key=value pair that helps to describe a log event

Jump to

Keyboard shortcuts

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