logging

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package logging sets up structured logging in a uniform way, and redirects glog statements into the structured log.

Index

Constants

View Source
const (
	LevelAll   = "all"
	LevelDebug = "debug"
	LevelInfo  = "info"
	LevelWarn  = "warn"
	LevelError = "error"
	LevelNone  = "none"
)

Variables

View Source
var (
	// Levels returns an array of valid log levels.
	Levels = levelSlice{LevelAll, LevelDebug, LevelInfo, LevelWarn, LevelError, LevelNone}
)

Functions

func Init

func Init(lvl string) (log.Logger, error)

Init returns a logger configured with common settings like timestamping and source code locations. Both the stdlib logger and glog are reconfigured to push logs into this logger.

Init must be called as early as possible in main(), before any application-specific flag parsing or logging occurs, because it mutates the contents of the flag package as well as os.Stderr.

Types

type Level

type Level string

Jump to

Keyboard shortcuts

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