log

package
v0.0.0-...-6ee8545 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Overview

Package log creates logs in the same way as Prometheus, while ignoring errors

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(keyvals ...interface{})

Debug logs a DEBUG level message, ignoring logging errors

func DebugRateLimited

func DebugRateLimited(keyvals ...interface{})

DebugRateLimited logs Debug level logs once in every logOnceTimedDuration.

func Error

func Error(keyvals ...interface{})

Error logs an ERROR level message, ignoring logging errors

func Fatal

func Fatal(keyvals ...interface{})

Fatal logs an ERROR level message and exits

func GetLogger

func GetLogger() log.Logger

func Info

func Info(keyvals ...interface{})

Info logs an INFO level message, ignoring logging errors

func Init

func Init(cfg Config) error

Init starts logging given the configuration. By default, it uses logfmt format and minimum logging level.

func InitDefault

func InitDefault()

InitDefault is used to start the logger with sane defaults before we can configure it. It's useful in instances where we want to log stuff before the configuration has been successfully parsed. Calling Init function later on overrides this.

func Warn

func Warn(keyvals ...interface{})

Warn logs a WARN level message, ignoring logging errors

func WarnRateLimited

func WarnRateLimited(keyvals ...interface{})

WarnRateLimited warns once in every logOnceTimedDuration.

Types

type Config

type Config struct {
	Level  string
	Format string
}

Config represents a logger configuration used upon initialization.

func ParseFlags

func ParseFlags(fs *flag.FlagSet, cfg *Config) *Config

ParseFlags parses the configuration flags for logging.

Jump to

Keyboard shortcuts

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