log

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 7 Imported by: 18

Documentation

Index

Constants

View Source
const (
	Ldate         int = log.Ldate         // Print the date in the local time zone
	Ltime         int = log.Ltime         // Print the time in the local time zone
	Lmicroseconds int = log.Lmicroseconds // Print the time with microsecond precision
	Llongfile     int = log.Llongfile     // Print full file name and line number
	Lshortfile    int = log.Lshortfile    // Print final file name element and line number
	LUTC          int = log.LUTC          // Print date and time in UTC
	Lmsgprefix    int = log.Lmsgprefix    // Move the prefix from the beginning of the line to before the message
	LstdFlags     int = log.LstdFlags     // Standard flags: Ldate | Ltime
)

Log flags that control the output format

Variables

View Source
var (
	DEBUG  bool      = false     // Global debug flag
	Output io.Writer = os.Stderr // Default output writer
	Prefix string    = ""        // Default prefix for all loggers
	Flags  int       = 0         // Default flags for all loggers
)

Global configuration variables

Functions

This section is empty.

Types

type Log

type Log struct {
	*log.Logger
	// contains filtered or unexported fields
}

Log represents a logger instance with enhanced functionality

func NewLog

func NewLog(prefix string) *Log

NewLog creates a new logger instance with the specified prefix

func (*Log) Debug

func (d *Log) Debug(message string, args ...any)

Debug is an alias for Debugf that takes a simple message

func (*Log) Debugf added in v2.4.5

func (d *Log) Debugf(message string, args ...any)

Debugf prints a formatted message with debug color if debug mode is enabled

func (*Log) Default

func (d *Log) Default(message string, args ...any)

Default is an alias for Defaultf

func (*Log) Defaultf added in v2.4.5

func (d *Log) Defaultf(message string, args ...any)

Defaultf prints a formatted message with default color

func (*Log) Error

func (d *Log) Error(message string, args ...any)

Error is an alias for Errorf

func (*Log) Errorf added in v2.4.5

func (d *Log) Errorf(message string, args ...any)

Errorf prints a formatted message with error color

func (*Log) Fatal

func (d *Log) Fatal(message string, args ...any)

Fatal is an alias for Fatalf

func (*Log) Fatalf added in v2.4.5

func (d *Log) Fatalf(message string, args ...any)

Fatalf prints a formatted message with error color and exits the program

func (*Log) Info

func (d *Log) Info(message string, args ...any)

Info is an alias for Infof

func (*Log) Infof added in v2.4.5

func (d *Log) Infof(message string, args ...any)

Infof prints a formatted message with info color

func (*Log) Prefix

func (d *Log) Prefix() string

Prefix returns the current logger prefix

func (*Log) Println

func (d *Log) Println(message string, args ...any)

Println is an alias for Printlnf

func (*Log) Printlnf added in v2.4.5

func (d *Log) Printlnf(message string, args ...any)

Printlnf prints a formatted message with color support

func (*Log) Question

func (d *Log) Question(message string, args ...any)

Question is an alias for Questionf

func (*Log) Questionf added in v2.4.5

func (d *Log) Questionf(message string, args ...any)

Questionf prints a formatted message with question color

func (*Log) Secondary

func (d *Log) Secondary(message string, args ...any)

Secondary is an alias for Secondaryf

func (*Log) Secondaryf added in v2.4.5

func (d *Log) Secondaryf(message string, args ...any)

Secondaryf prints a formatted message with secondary color

func (*Log) SetPrefix

func (d *Log) SetPrefix(prefix string)

SetPrefix sets a new prefix for the logger

func (*Log) Success

func (d *Log) Success(message string, args ...any)

Success is an alias for Successf

func (*Log) Successf added in v2.4.5

func (d *Log) Successf(message string, args ...any)

Successf prints a formatted message with success color

func (*Log) Warning

func (d *Log) Warning(message string, args ...any)

Warning is an alias for Warningf

func (*Log) Warningf added in v2.4.5

func (d *Log) Warningf(message string, args ...any)

Warningf prints a formatted message with warning color

Jump to

Keyboard shortcuts

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