timber

package module
v0.0.0-...-85b1f62 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2019 License: Apache-2.0 Imports: 7 Imported by: 23

README

timber

Build Status codecov

Timber is a logging library written in golang.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallerInfo

func CallerInfo(stackIndex int) string

func Critical

func Critical(msg interface{})

Critical writes the provided string to the log.

func CriticalEx

func CriticalEx(keys Keys, msg string, args ...interface{})

CriticalEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Criticalf

func Criticalf(msg string, args ...interface{})

Criticalf writes a formatted string using the arguments provided to the log.

func Debug

func Debug(msg interface{})

Debug writes the provided string to the log.

func DebugEx

func DebugEx(keys Keys, msg string, args ...interface{})

DebugEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Debugf

func Debugf(msg string, args ...interface{})

Debugf writes a formatted string using the arguments provided to the log.

func Error

func Error(msg interface{})

Error writes the provided string to the log.

func ErrorEx

func ErrorEx(keys Keys, msg string, args ...interface{})

ErrorEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Errorf

func Errorf(msg string, args ...interface{})

Errorf writes a formatted string using the arguments provided to the log.

func Fatal

func Fatal(msg interface{})

Fatal writes the provided string to the log.

func FatalEx

func FatalEx(keys Keys, msg string, args ...interface{})

FatalEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Fatalf

func Fatalf(msg string, args ...interface{})

Fatalf writes a formatted string using the arguments provided to the log.

func Info

func Info(msg interface{})

Info writes the provided string to the log.

func InfoEx

func InfoEx(keys Keys, msg string, args ...interface{})

InfoEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Infof

func Infof(msg string, args ...interface{})

Infof writes a formatted string using the arguments provided to the log.

func Log

func Log(lvl Level, v ...interface{})

Log will write a raw entry to the log, it accepts an array of interfaces which will be converted to strings if they are not already.

func SetLevel

func SetLevel(lvl Level)

SetLevel will set the minimum message level that will be output to stdout. This level is inherited by new logging instances created via With. But does not affect completely new logging instances.

func Trace

func Trace(msg interface{})

Trace writes the provided string to the log.

func TraceEx

func TraceEx(keys Keys, msg string, args ...interface{})

TraceEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Tracef

func Tracef(msg string, args ...interface{})

Tracef writes a formatted string using the arguments provided to the log.

func Verbose

func Verbose(msg interface{})

Verbose writes the provided string to the log.

func VerboseEx

func VerboseEx(keys Keys, msg string, args ...interface{})

VerboseEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Verbosef

func Verbosef(msg string, args ...interface{})

Verbosef writes a formatted string using the arguments provided to the log.

func Warning

func Warning(msg interface{})

Warning writes the provided string to the log.

func WarningEx

func WarningEx(keys Keys, msg string, args ...interface{})

WarningEx writes a formatted string using the arguments provided to the log but also will prefix the log message with they keys provided to help print runtime variables.

func Warningf

func Warningf(msg string, args ...interface{})

Warningf writes a formatted string using the arguments provided to the log.

Types

type Keys

type Keys map[string]interface{}

type Level

type Level int
const (
	Level_Trace    Level = 1
	Level_Verbose  Level = 2
	Level_Debug    Level = 3
	Level_Info     Level = 4
	Level_Warning  Level = 5
	Level_Error    Level = 6
	Level_Critical Level = 7
	Level_Fatal    Level = 8
)

func GetLevel

func GetLevel() Level

GetLevel will return the current minimum logging level for the global logger.

type Logger

type Logger interface {
	// Trace writes the provided string to the log.
	Trace(msg interface{})

	// Tracef writes a formatted string using the arguments provided to the log.
	Tracef(msg string, args ...interface{})

	// TraceEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	TraceEx(keys Keys, msg string, args ...interface{})

	// Verbose writes the provided string to the log.
	Verbose(msg interface{})

	// Verbosef writes a formatted string using the arguments provided to the log.
	Verbosef(msg string, args ...interface{})

	// VerboseEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	VerboseEx(keys Keys, msg string, args ...interface{})

	// Debug writes the provided string to the log.
	Debug(msg interface{})

	// Debugf writes a formatted string using the arguments provided to the log.
	Debugf(msg string, args ...interface{})

	// DebugEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	DebugEx(keys Keys, msg string, args ...interface{})

	// Info writes the provided string to the log.
	Info(msg interface{})

	// Infof writes a formatted string using the arguments provided to the log.
	Infof(msg string, args ...interface{})

	// InfoEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	InfoEx(keys Keys, msg string, args ...interface{})

	// Warning writes the provided string to the log.
	Warning(msg interface{})

	// Warningf writes a formatted string using the arguments provided to the log.
	Warningf(msg string, args ...interface{})

	// WarningEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	WarningEx(keys Keys, msg string, args ...interface{})

	// Error writes the provided string to the log.
	Error(msg interface{})

	// Errorf writes a formatted string using the arguments provided to the log.
	Errorf(msg string, args ...interface{})

	// ErrorEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	ErrorEx(keys Keys, msg string, args ...interface{})

	// Critical writes the provided string to the log.
	Critical(msg interface{})

	// Criticalf writes a formatted string using the arguments provided to the log.
	Criticalf(msg string, args ...interface{})

	// CriticalEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	CriticalEx(keys Keys, msg string, args ...interface{})

	// Fatal writes the provided string to the log.
	Fatal(msg interface{})

	// Fatalf writes a formatted string using the arguments provided to the log.
	Fatalf(msg string, args ...interface{})

	// FatalEx writes a formatted string using the arguments provided to the log
	// but also will prefix the log message with they keys provided to help print
	// runtime variables.
	FatalEx(keys Keys, msg string, args ...interface{})

	// SetDepth will change the number of stacks that will be skipped to find
	// the filepath and line number of the executed code.
	SetDepth(depth int) Logger

	// Log will write a raw entry to the log, it accepts an array of interfaces which will
	// be converted to strings if they are not already.
	Log(lvl Level, v ...interface{})

	// With will create a new Logger interface that will prefix all log entries written
	// from the new interface with the keys specified here. It will also include any
	// keys that are specified in the current Logger instance.
	// This means that you can chain multiple of these together to add/remove keys that
	// are written with every message.
	With(keys Keys) Logger

	// Prefix will add a small string before the file path.
	Prefix(prefix string) Logger
}

func New

func New() Logger

func With

func With(keys Keys) Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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