logging

package
v0.14.9 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 14 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 added in v0.12.0

type Level string

Jump to

Keyboard shortcuts

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