logging

package
v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 13 Imported by: 22

Documentation

Index

Constants

View Source
const (
	// LevelOverwrite is the default endpoint for overwrite level handler.
	LevelOverwrite = "/logging-level"
)

Variables

This section is empty.

Functions

func ConfigureSentry

func ConfigureSentry(cfg *SentryConfig)

ConfigureSentry add sentry hook into logger.

func LevelOverwriteHandler

func LevelOverwriteHandler(initialLevel log.Level) func(http.ResponseWriter, *http.Request)

LevelOverwriteHandler returns a handler for overwrite logging level for a duration. If this hanlder is invoked multiple times, the earliest finish time based on duration will reset the logging level.

Types

type LogFieldFormatter

type LogFieldFormatter struct {
	log.Fields
	log.Formatter
}

LogFieldFormatter add fields provided in each log message. It provides a way to send log with default fields

func (*LogFieldFormatter) Format

func (f *LogFieldFormatter) Format(entry *log.Entry) ([]byte, error)

Format is called by logrus and returns the formatted string. It adds the log fields provided to the log entry.

type SecretsFormatter

type SecretsFormatter struct {
	log.Formatter
}

SecretsFormatter scrubs sensitive information from logs and formats logs into parsable json.

func (*SecretsFormatter) Format

func (f *SecretsFormatter) Format(entry *log.Entry) ([]byte, error)

Format is called by logrus and returns the formatted string. It looks for secrets data in each entry and redacts it.

type SentryConfig

type SentryConfig struct {
	Enabled bool `yaml:"enabled"`
	// DSN is the sentry DSN name.
	DSN string `yaml:"dsn"`
	// Tags are forwarded to the raven client, and enables sentry logs to be
	// filtered by the given tags.
	Tags map[string]string
}

SentryConfig is sentry logging specific configuration.

Jump to

Keyboard shortcuts

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