levels

package
v0.6.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var COLORS = []string{
	PANIC:   "9",
	FATAL:   "160",
	ERROR:   "1",
	WARN:    "3",
	SUCCESS: "2",
	INFO:    "4",
	MESSAGE: "7",
	DEBUG:   "6",
	TRACE:   "7",
}

COLORS maps log level constants to their corresponding color codes.

View Source
var LABELS = []string{
	OFF:     "OFF",
	PANIC:   "PANIC",
	FATAL:   "FATAL",
	ERROR:   "ERROR",
	WARN:    "WARN",
	SUCCESS: "SUCCESS",
	INFO:    "INFO",
	MESSAGE: "MESSAGE",
	DEBUG:   "DEBUG",
	TRACE:   "TRACE",
}

LABELS maps log level constants to their corresponding string labels.

Functions

This section is empty.

Types

type TYPE

type TYPE uint8

TYPE represents the log level type.

const (
	OFF     TYPE = iota // OFF disables logging.
	PANIC               // PANIC for critical errors leading to termination.
	FATAL               // FATAL for severe errors that may cause termination.
	ERROR               // ERROR for non-fatal errors.
	WARN                // WARN for warning messages.
	SUCCESS             // SUCCESS for successful operations.
	INFO                // INFO for informational messages.
	MESSAGE             // MESSAGE for general messages.
	DEBUG               // DEBUG for debugging messages.
	TRACE               // TRACE for detailed tracing.

	DEFAULT = INFO // DEFAULT is the default log level, set to INFO.
)

Log level constants.

func (TYPE) Color

func (t TYPE) Color() string

Color returns the color code associated with the log level. This method is useful for color-coding log messages.

Returns: - string: The color code for the log level, or "UNKNOWN" if the level is not defined.

func (TYPE) Int

func (t TYPE) Int() uint8

Int returns the integer representation of the log level. This method is useful for comparing log levels.

Returns: - uint8: The integer value of the log level.

func (TYPE) String

func (t TYPE) String() string

String returns the string representation of the log level. It provides a human-readable name for the log level.

Returns: - string: The name of the log level, or "UNKNOWN" if the level is not defined.

Jump to

Keyboard shortcuts

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