log

package
v0.0.0-...-70feec6 Latest Latest
Warning

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

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

Documentation

Overview

nolint

Index

Constants

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

Variables

View Source
var AvailableLogFormats = []string{
	FormatLogFmt,
	FormatJSON,
}

AvailableLogFormats is a list of supported log formats

AvailableLogLevels is a list of supported logging levels

Functions

func NewLogger

func NewLogger(c Config) (log.Logger, error)

NewLogger returns a log.Logger that prints in the provided format at the provided level with a UTC timestamp and the caller of the log entry.

func NewLoggerSlog

func NewLoggerSlog(c Config) (*slog.Logger, error)

NewLoggerSlog returns a *slog.Logger that prints in the provided format at the provided level with a UTC timestamp and the caller of the log entry.

func RegisterFlags

func RegisterFlags(fs *flag.FlagSet, c *Config)

Types

type Config

type Config struct {
	Level  string
	Format string
}

Jump to

Keyboard shortcuts

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