logger

package
v0.0.0-...-0a4f32b Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package logger provides the logger API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	GetEnvironment() Environment
	GetLevel() Level
}

Config provides options for creating a new Logger instance

type Environment

type Environment int

Environment is used to provide reasonable configuration defaults

const (
	Development Environment = iota
	Production
)

type Level

type Level int

Level is the verbosity for logging

const (
	Debug Level = iota
	Info
	Warn
	Error
	Panic
	Fatal
)

type Logger

type Logger interface {
	// Debug logs a message at the most verbose level
	Debug(msg string)
	// Debugf is similar to combining Debug and Printf
	Debugf(format string, a any)
	// Info logs a message one verbose level higher than Debug
	Info(msg string)
	// Infof is similar to combining Info and Printf
	Infof(format string, a any)
	// Warn logs a message one verbose level higher than Info
	Warn(msg string)
	// Warnf is similar to combining Warn and Printf
	Warnf(format string, a any)
	// Error logs a message one verbose level higher than Warn
	Error(msg string)
	// Errorf is similar to combining Error and Printf
	Errorf(format string, a any)
	// Panic logs a message one verbose level higher than Error and panics
	Panic(msg string)
	// Panicf is similar to combining Panic and Printf
	Panicf(format string, a any)
	// Fatal logs a message one verbose level higher than Panic and
	// calls os.Exit(1) after logging the message
	Fatal(msg string)
	// Fatalf is similar to combining Panic and Printf
	Fatalf(format string, a any)
	// WithField adds key value pairs to the log entry
	WithField(key string, val any) Logger
	// Sync flushes the buffer
	Sync()
	// GetLevel gets the current [Level]
	GetLevel() Level
}

Logger is the API for logging

Jump to

Keyboard shortcuts

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