svclog

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package svclog provides logging facilities for standard services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerOrNull added in v0.0.26

func LoggerOrNull(l logrus.FieldLogger) logrus.FieldLogger

LoggerOrNull ensures non-nil logger is passed in or creates a Null Logger

func NewLogger

func NewLogger(cfg Config) logrus.FieldLogger

NewLogger returns a new logger that includes app and deploy key/value pairs in each log line.

func NewNullLogger added in v0.0.26

func NewNullLogger() logrus.FieldLogger

NewNullLogger returns a logger that discards the output useful for testing

func NewSampleLogger added in v0.0.19

func NewSampleLogger(parentLogger logrus.FieldLogger, logsBurstLimit int, logBurstWindow time.Duration) logrus.FieldLogger

NewSampleLogger creates a rate limited logger that samples logs. The parameter logsBurstLimit defines how many logs are allowed per logBurstWindow duration. The returned logger derives from the parentLogger, but without inheriting any Hooks. All log entries derived from SampleLogger will contain 'sampled=true' field.

func ReportPanic added in v0.0.59

func ReportPanic(logger logrus.FieldLogger)

ReportPanic attempts to report the panic to rollbar via the logrus.

func SaramaLogger

func SaramaLogger(logger logrus.FieldLogger) logrus.FieldLogger

SaramaLogger takes FieldLogger and returns a saramaLogger.

Types

type Config

type Config struct {
	AppName  string `env:"APP_NAME,required"`
	Deploy   string `env:"DEPLOY,required"`
	SpaceID  string `env:"SPACE_ID"`
	Dyno     string `env:"DYNO"`
	LogLevel string `env:"LOG_LEVEL,default=info"`
}

Config for logger.

Jump to

Keyboard shortcuts

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