AminLogger

package
v0.0.0-...-4995f92 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Setup logger with zerolog and ansi colors for terminal output.

Index

Constants

View Source
const (
	Reset = "\033[0m"
	Bold  = "\033[1m"
	// Text Colors
	FgBlack   = "\033[30m"
	FgRed     = "\033[31m"
	FgGreen   = "\033[32m"
	FgYellow  = "\033[33m"
	FgBlue    = "\033[34m"
	FgMagenta = "\033[35m"
	FgCyan    = "\033[36m"
	FgWhite   = "\033[37m"
	// Background Colors
	BgBlack   = "\033[40m"
	BgRed     = "\033[41m"
	BgGreen   = "\033[42m"
	BgYellow  = "\033[43m"
	BgBlue    = "\033[44m"
	BgMagenta = "\033[45m"
	BgCyan    = "\033[46m"
	BgWhite   = "\033[47m"
)

ANSI color codes for terminal output

Variables

View Source
var Ansi = AnsiColors{
	Reset: "\033[0m",
	Bold:  "\033[1m",

	FgBlack:   "\033[30m",
	FgRed:     "\033[31m",
	FgGreen:   "\033[32m",
	FgYellow:  "\033[33m",
	FgBlue:    "\033[34m",
	FgMagenta: "\033[35m",
	FgCyan:    "\033[36m",
	FgWhite:   "\033[37m",

	BgBlack:   "\033[40m",
	BgRed:     "\033[41m",
	BgGreen:   "\033[42m",
	BgYellow:  "\033[43m",
	BgBlue:    "\033[44m",
	BgMagenta: "\033[45m",
	BgCyan:    "\033[46m",
	BgWhite:   "\033[47m",
}

Create a variable of the struct type

Functions

func SetupLogger

func SetupLogger(logFilePath string, logLevel zerolog.Level) (zerolog.Logger, error)

SetupLogger initializes zerolog to write to both console and a file.

Types

type AnsiColors

type AnsiColors struct {
	Reset string
	Bold  string
	// Forground Colors
	FgBlack   string
	FgRed     string
	FgGreen   string
	FgYellow  string
	FgBlue    string
	FgMagenta string
	FgCyan    string
	FgWhite   string
	// Background Colors
	BgBlack   string
	BgRed     string
	BgGreen   string
	BgYellow  string
	BgBlue    string
	BgMagenta string
	BgCyan    string
	BgWhite   string
}

tip structs are a collection of variables that can be used to group related data together tip structs can't be constants

Jump to

Keyboard shortcuts

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