logging

package
v0.0.0-...-a821fee Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyAppName represents the key for the application name.
	KeyAppName = `app`

	// KeyError represents the key for the error.
	KeyError = `err`

	// KeyStack represents the key for the stack.
	KeyStack = `stack`
)

Variables

This section is empty.

Functions

func CommonLogger

func CommonLogger(cfg *Config) (*slog.Logger, error)

CommonLogger constructs a logging with default options.

func CommonLoggerWithOptions

func CommonLoggerWithOptions(cfg *Config, w io.Writer, minLevel slog.Level, logToJson bool) (*slog.Logger, error)

CommonLoggerWithOptions constructs a logging with custom options.

func Init

func Init(appName string) error

Init is a wrapper for the CommonLogger function but only returns the error.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the configuration for the logging.

func NewConfig

func NewConfig(appName Name) *Config

NewConfig creates a new Config.

type Name

type Name string

Name represents the name of the application for the logging.

func (Name) String

func (n Name) String() string

String returns the string representation of the Name.

Jump to

Keyboard shortcuts

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