logger

package
v0.4.18 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 7 Imported by: 11 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// IsDebug is used to determine whether to emit debug logs.
	IsDebug bool

	// IsQuiet is used to determine whether to emit non-critical logs.
	IsQuiet bool
	// contains filtered or unexported fields
}

Logger is a wrapper around log.Logger with the following features:

  • Supports a prefix
  • Adds colors to the output
  • Debug mode (all logs, debug and above)
  • Quiet mode (only critical logs)
  • Serialized writes for all loggers in this package

func GetLogger

func GetLogger(isDebug bool, prefix string) *Logger

GetLogger Returns a logger.

func GetQuietLogger

func GetQuietLogger(prefix string) *Logger

GetQuietLogger Returns a logger that only emits critical logs. Useful for anti-cheat stages.

func (*Logger) Clone added in v0.4.6

func (l *Logger) Clone() *Logger

Clone clones a given logger

func (*Logger) Criticalf

func (l *Logger) Criticalf(fstring string, args ...any)

Criticalf is to be used only in anti-cheat stages

func (*Logger) Criticalln

func (l *Logger) Criticalln(msg string)

Criticalln is to be used only in anti-cheat stages

func (*Logger) Debugf

func (l *Logger) Debugf(fstring string, args ...any)

func (*Logger) Debugln

func (l *Logger) Debugln(msg string)

func (*Logger) Errorf

func (l *Logger) Errorf(fstring string, args ...any)

func (*Logger) Errorln

func (l *Logger) Errorln(msg string)

func (*Logger) GetLastSecondaryPrefix added in v0.4.4

func (l *Logger) GetLastSecondaryPrefix() string

GetLastSecondaryPrefix returns the last secondary prefix

func (*Logger) GetSecondaryPrefixes added in v0.4.4

func (l *Logger) GetSecondaryPrefixes() []string

GetSecondaryPrefix returns all the secondary prefixes

func (*Logger) Infof

func (l *Logger) Infof(fstring string, args ...any)

func (*Logger) Infoln

func (l *Logger) Infoln(msg string)

func (*Logger) Plainf added in v0.2.22

func (l *Logger) Plainf(fstring string, args ...any)

func (*Logger) Plainln

func (l *Logger) Plainln(msg string)

func (*Logger) PopSecondaryPrefix added in v0.4.4

func (l *Logger) PopSecondaryPrefix() string

PopSecondaryPrefix removes the secondary prefix from the top of secondaryPrefixes

func (*Logger) PushSecondaryPrefix added in v0.4.4

func (l *Logger) PushSecondaryPrefix(prefix string)

PushSecondaryPrefix pushes a new secondary prefix to secondaryPrefixes

func (*Logger) ResetSecondaryPrefixes added in v0.4.4

func (l *Logger) ResetSecondaryPrefixes()

ResetSecondaryPrefixes clears all secondary prefixes

func (*Logger) Successf

func (l *Logger) Successf(fstring string, args ...any)

func (*Logger) Successln

func (l *Logger) Successln(msg string)

func (*Logger) UpdateLastSecondaryPrefix added in v0.4.4

func (l *Logger) UpdateLastSecondaryPrefix(newPrefix string)

UpdateLastSecondaryPrefix updates the secondary prefix at the top of SecondaryPrefixes stack

func (*Logger) UpdateSecondaryPrefixes added in v0.4.4

func (l *Logger) UpdateSecondaryPrefixes(prefixes []string)

UpdateSecondaryPrefixes replaces all secondary prefixes with the new one

func (*Logger) WithAdditionalSecondaryPrefix added in v0.4.4

func (l *Logger) WithAdditionalSecondaryPrefix(prefix string, fn func())

WithAddtionalSecondaryPrefix is helpful you want to run one or more logging statements using an additional secondary prefix

Jump to

Keyboard shortcuts

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