Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Debugf = log.Printf
Debugf is called to write debug logs, such as logging request parameter to see what is coming inside.
var ErrNotInitialized = errors.New("flog: structure logging should be initialized first")
ErrNotInitialized is returned when structured logging is not enabled
var Errorf = log.Printf
Errorf is called to write an error log, such as when a new connection fails.
var Fatalf = log.Fatalf
Fatalf is called to write an error log and then exit with non-zero status code. It cannot be disabled.
var Infof = log.Printf
Infof is called to write informational logs, such as when startup has
var Infow = log.Printf
Infow is called to write informational logs, but as key value pairs.
var Verbosef = log.Printf
Verbosef is called to write verbose logs, such as when a new connection is established correctly.
Functions ¶
func InitializeSructuredLogs ¶
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 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.