logp

package
v0.0.0-...-bc1b659 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultKeepFiles = 7
View Source
const DefaultRotateEveryBytes = 10 * 1024 * 1024
View Source
const RotatorMaxFiles = 1024

Variables

This section is empty.

Functions

func Critical

func Critical(format string, v ...interface{})

func Debug

func Debug(selector string, format string, v ...interface{})

func Err

func Err(format string, v ...interface{})

func Info

func Info(format string, v ...interface{})

func Init

func Init(name string, config *Logging) error

Init combines the configuration from config with the command line flags to initialize the Logging systems. After calling this function, standard output is always enabled. You can make it respect the command line flag with a later SetStderr call.

func IsDebug

func IsDebug(selector string) bool

func LogInit

func LogInit(level Priority, prefix string, toSyslog bool, toStderr bool, debugSelectors []string)

TODO: remove toSyslog and toStderr from the init function

func LogTotalExpvars

func LogTotalExpvars(cfg *Logging)

func MakeDebug

func MakeDebug(selector string) func(string, ...interface{})

func Recover

func Recover(msg string)

func SetStderr

func SetStderr()

func SetToFile

func SetToFile(toFile bool, rotator *FileRotator) error

func SetToStderr

func SetToStderr(toStderr bool, prefix string)

func SetToSyslog

func SetToSyslog(toSyslog bool, prefix string)

func WTF

func WTF(format string, v ...interface{})

WTF prints the message at CRIT level and panics immediately with the same message

func Warn

func Warn(format string, v ...interface{})

Types

type FileRotator

type FileRotator struct {
	Path             string
	Name             string
	RotateEveryBytes *uint64
	KeepFiles        *int
	// contains filtered or unexported fields
}

func (*FileRotator) CheckIfConfigSane

func (rotator *FileRotator) CheckIfConfigSane() error

func (*FileRotator) CreateDirectory

func (rotator *FileRotator) CreateDirectory() error

func (*FileRotator) FileExists

func (rotator *FileRotator) FileExists(fileNo int) bool

func (*FileRotator) FilePath

func (rotator *FileRotator) FilePath(fileNo int) string

func (*FileRotator) Rotate

func (rotator *FileRotator) Rotate() error

func (*FileRotator) WriteLine

func (rotator *FileRotator) WriteLine(line []byte) error

type Logger

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

type Logging

type Logging struct {
	Selectors []string
	Files     *FileRotator
	ToSyslog  *bool `config:"to_syslog"`
	ToFiles   *bool `config:"to_files"`
	Level     string
	Metrics   LoggingMetricsConfig `config:"metrics"`
}

type LoggingMetricsConfig

type LoggingMetricsConfig struct {
	Enabled *bool          `config:"enabled"`
	Period  *time.Duration `config:"period" validate:"nonzero,min=0s"`
}

type Priority

type Priority int
const (
	// From /usr/include/sys/syslog.h.
	// These are the same on Linux, BSD, and OS X.
	LOG_EMERG Priority = iota
	LOG_ALERT
	LOG_CRIT
	LOG_ERR
	LOG_WARNING
	LOG_NOTICE
	LOG_INFO
	LOG_DEBUG
)

Jump to

Keyboard shortcuts

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