logger

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

README

Telemetry Go kit Log

This package contains a Telemetry Logger interface compatible implementation based on Go kit log.

For information on the Telemetry Logger interface, see: https://github.com/tetratelabs/telemetry

For more information on how to use this specific package, see: https://pkg.go.dev/github.com/tetratelabs/telemetry-gokit-log

Documentation

Overview

Package logger provides a tetratelabs/telemetry Logger implementation based on Go kit log.

Index

Constants

View Source
const (
	None  = level.None
	Error = level.Error
	Info  = level.Info
	Debug = level.Debug
)

Available log levels.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger implements the telemetry.Logger interface using Go kit Log.

func New

func New(logger log.Logger) *Logger

New returns a new telemetry.Logger implementation based on Go kit log.

func NewSyncLogfmt added in v0.2.0

func NewSyncLogfmt(w io.Writer) *Logger

NewSyncLogfmt returns a new telemetry.Logger implementation using Go kit's sync writer and logfmt output format.

func (*Logger) Context

func (l *Logger) Context(ctx context.Context) telemetry.Logger

Context attaches provided Context to the Logger allowing metadata found in this context to be used for log lines and metrics labels.

func (*Logger) Debug

func (l *Logger) Debug(msg string, keyValues ...interface{})

Debug logging with key-value pairs. Don't be shy, use it.

func (*Logger) Error

func (l *Logger) Error(msg string, err error, keyValues ...interface{})

Error logging with key-value pairs. Use this when application state and stability are at risk. These types of conditions are actionable and often alerted on. It is very strongly encouraged to add a Metric to each of these types of messages. Metrics provide the easiest way to coordinate processing of these concerns and triggering alerting systems through your metrics backend.

func (*Logger) Info

func (l *Logger) Info(msg string, keyValues ...interface{})

Info logging with key-value pairs. This is for informational, but not directly actionable conditions. It is highly recommended you attach a Metric to these types of messages. Where a single informational or warning style message might not be reason for action, a change in occurrence does warrant action. By attaching a Metric for these logging situations, you make this easy through histograms, thresholds, etc.

func (*Logger) Level added in v0.3.0

func (l *Logger) Level() level.Value

Level returns the currently configured logging level.

func (*Logger) Metric

func (l *Logger) Metric(m telemetry.Metric) telemetry.Logger

Metric attaches provided Metric to the Logger allowing this metric to record each invocation of Info and Error log lines. If context is available in the logger, it can be used for Metrics labels.

func (*Logger) New added in v0.4.0

func (l *Logger) New() telemetry.Logger

New returns a new Logger based on the original implementation but with the log level decoupled.

func (*Logger) SetLevel

func (l *Logger) SetLevel(lvl level.Value)

SetLevel provides the ability to set the desired logging level. This function can be used at runtime and is safe for concurrent use.

func (*Logger) UnwrapLogger added in v0.3.0

func (l *Logger) UnwrapLogger() log.Logger

UnwrapLogger returns the wrapped original logger implementation used by this Logging bridge.

func (*Logger) With

func (l *Logger) With(keyValues ...interface{}) telemetry.Logger

With returns Logger with provided key value pairs attached.

Directories

Path Synopsis
group module

Jump to

Keyboard shortcuts

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