logger

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: MIT Imports: 7 Imported by: 0

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

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

func (l *Logger) GetLastSecondaryPrefix() string

GetLastSecondaryPrefix returns the last secondary prefix

func (*Logger) GetSecondaryPrefixes

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

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

func (*Logger) Plainln

func (l *Logger) Plainln(msg string)

func (*Logger) PopSecondaryPrefix

func (l *Logger) PopSecondaryPrefix() string

PopSecondaryPrefix removes the secondary prefix from the top of secondaryPrefixes

func (*Logger) PushSecondaryPrefix

func (l *Logger) PushSecondaryPrefix(prefix string)

PushSecondaryPrefix pushes a new secondary prefix to secondaryPrefixes

func (*Logger) ResetSecondaryPrefixes

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

func (l *Logger) UpdateLastSecondaryPrefix(newPrefix string)

UpdateLastSecondaryPrefix updates the secondary prefix at the top of SecondaryPrefixes stack

func (*Logger) UpdateSecondaryPrefixes

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

UpdateSecondaryPrefixes replaces all secondary prefixes with the new one

func (*Logger) WithAdditionalSecondaryPrefix

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