log

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package log provides module-level logging capabilities for interacting with go standard-library's log/slog package.

Package log provides a logging framework with level support and pluggable export destinations.

Index

Constants

View Source
const (
	Trace     = slog.Level(-8)
	Debug     = slog.LevelDebug
	Info      = slog.LevelInfo
	Notice    = slog.Level(2)
	Warning   = slog.LevelWarn
	Error     = slog.LevelError
	Emergency = slog.Level(12)
)

Exported constants representing slog.Level.

- Trace for tracing program's execution.

- Debug for providing contextual information in debugging phase.

- Info for informing about general system operations.

- Notice for conditions that are not errors but might need handling.

- Warning for warning conditions.

- Error for error conditions.

- Emergency for system-unusable conditions.

Variables

This section is empty.

Functions

func Default

func Default(level string)

Default sets the default log level to the specified level, and will instantiate a global default logger.

  • See Global for additional details.

func Global

func Global()

Global sets up the global slog configuration according to LOG_LEVEL environment variable. It manages log levels and creates a handler with options for log level, customization of attributes and output to stdout as JSON. Here is the list of log levels with their priorities:

TRACE < DEBUG < INFO < NOTICE < WARNING < ERROR < EMERGENCY

The default log level is INFO.

func Level

func Level() (v string)

Level gets the value of the default log level

This function will panic if it fails to convert the log level to string.

Types

This section is empty.

Directories

Path Synopsis
Package color provides ANSI color codes for output formatting.
Package color provides ANSI color codes for output formatting.

Jump to

Keyboard shortcuts

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