flog

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = log.Print

Debug is called to write debug logs, such as logging request parameter to see what is coming inside.

View Source
var Debugf = log.Printf

Debugf is called to write debug logs, such as logging request parameter to see what is coming inside.

View Source
var ErrNotInitialized = errors.New("flog: structure logging should be initialized first")

ErrNotInitialized is returned when structured logging is not enabled

View Source
var Error = log.Print

Error is called to write an error log, such as when a new connection fails.

View Source
var Errorf = log.Printf

Errorf is called to write an error log, such as when a new connection fails.

View Source
var Fatal = log.Fatal

Fatal is called to write an error log and then exit with non-zero status code. It cannot be disabled.

View Source
var Fatalf = log.Fatalf

Fatalf is called to write an error log and then exit with non-zero status code. It cannot be disabled.

View Source
var Info = log.Print

Info is called to write informational logs, such as when startup has

View Source
var Infof = log.Printf

Infof is called to write informational logs, such as when startup has

View Source
var Infow = log.Printf

Infow is called to write informational logs, but as key value pairs.

View Source
var Verbose = log.Print

Verbose is called to write verbose logs, such as when a new connection is established correctly.

View Source
var Verbosef = log.Printf

Verbosef is called to write verbose logs, such as when a new connection is established correctly.

View Source
var Warn = log.Print

Warn is called to write an error log that can be ignored.

View Source
var Warnf = log.Printf

Warnf is called to write an error log that can be ignored.

Functions

func DisableLogging

func DisableLogging()

DisableLogging sets all logging levels to no-op's.

func InitializeSructuredLogs

func InitializeSructuredLogs(c *Config) (func(), error)

InitializeSructuredLogs replaces all logging functions with structured logging variants.

func LogDebugToStdout

func LogDebugToStdout()

LogDebugToStdout updates Verbosef and Info logging to use stdout instead of stderr.

func LogVerboseToNowhere

func LogVerboseToNowhere()

LogVerboseToNowhere updates Verbosef so verbose log messages are discarded

func Logger

func Logger() (*zap.Logger, error)

Logger returns the initialized logger

func SugaredLogger

func SugaredLogger() (*zap.SugaredLogger, error)

SugaredLogger returns the initialized sugared logger

Types

type Config

type Config struct {
	// LogDebugStdout logs to stdout instead of stderr
	LogDebugStdout bool

	// Verbose enables verbose logging.
	Verbose bool

	// Debug enables debug logging.
	Debug bool

	// Human enable human readable logging.
	// Good for development.
	Human bool
}

Config configures flog structured logging.

Jump to

Keyboard shortcuts

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