logs

package
v0.0.0-...-2b48b92 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Reset   = "\x1b[0m"
	Black   = "\x1b[30m"
	Red     = "\x1b[31m"
	Green   = "\x1b[32m"
	Yellow  = "\x1b[33m"
	Blue    = "\x1b[34m"
	Magenta = "\x1b[35m"
	Cyan    = "\x1b[36m"
	White   = "\x1b[37m"
	Gray    = "\x1b[90m"
)

Color codes for different log levels

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(domain string) (logsTypes.Logger, error)

NewLogger creates a new logger for the application, each logger has a file logger and a console logger. The file logger is used to log to the vlogs directory, while the console logger is used to log to the console.

Example:

logger, err := logs.NewLogger(app)
if err != nil {
	fmt.Printf("Error: %v\n", err)
	return
}
logger.File.Info().Msg("Batman reached the file logger")
logger.Console.Info().Msg("Batman reached the console logger")

since we use structured logging, we can also log with fields:

logger.File.Info().Str("where", "file").Msg("Batman is saving Gotham")
logger.Console.Info().Str("where", "console").Msg("Batman is saving Gotham")

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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