clog

package module
v0.0.0-...-03e0050 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Unlicense Imports: 8 Imported by: 3

Documentation

Overview

Package clog provides coloured logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...any)

Debug outputs the given debug message to standard error.

func Debugf

func Debugf(format string, args ...any)

Debugf outputs the given debug message to standard error.

func Debugln

func Debugln(args ...any)

Debugln outputs the given debug message to standard error.

func Fatal

func Fatal(args ...any)

Fatal outputs the given fatal error message to standard error and terminates the application.

func Fatalf

func Fatalf(format string, args ...any)

Fatalf outputs the given fatal error message to standard error and terminates the application.

func Fatalln

func Fatalln(args ...any)

Fatalln outputs the given fatal error message to standard error and terminates the application.

func Info

func Info(args ...any)

Info outputs the given info message to standard error.

func Infof

func Infof(format string, args ...any)

Infof outputs the given info message to standard error.

func Infoln

func Infoln(args ...any)

Infoln outputs the given info message to standard error.

func SetDebugOutput

func SetDebugOutput(w io.Writer)

SetDebugOutput sets the output writer of debug messages.

func SetDebugPrefix

func SetDebugPrefix(usePrefix bool)

SetDebugPrefix sets whether to use a prefix for debug messages.

func SetErrorOutput

func SetErrorOutput(w io.Writer)

SetErrorOutput sets the output writer of fatal error messages.

func SetErrorPrefix

func SetErrorPrefix(usePrefix bool)

SetErrorPrefix sets whether to use a prefix for error messages.

func SetInfoOutput

func SetInfoOutput(w io.Writer)

SetInfoOutput sets the output writer of info messages.

func SetInfoPrefix

func SetInfoPrefix(usePrefix bool)

SetInfoPrefix sets whether to use a prefix for info messages.

func SetMainPrefixName

func SetMainPrefixName(name string)

SetMainPrefixName sets the prefix name used for the 'main' package.

func SetPathLevel

func SetPathLevel(path string, level Level)

SetPathLevel sets the log level of the given path at package (e.g. "github.com/user/repo/pkg") or function (e.g. "github.com/user/repo/pkg.Func") granularity.

For function ganularity of leaf node functions, function inlining may have to be disabled (use the `//go:noinline` build tag).

func SetWarnOutput

func SetWarnOutput(w io.Writer)

SetWarnOutput sets the output writer of non-fatal warning messages.

func SetWarnPrefix

func SetWarnPrefix(usePrefix bool)

SetWarnPrefix sets whether to use a prefix for warning messages.

func Warn

func Warn(args ...any)

Warn outputs the given non-fatal warning message to standard error.

func Warnf

func Warnf(format string, args ...any)

Warnf outputs the given non-fatal warning message to standard error.

func Warnln

func Warnln(args ...any)

Warnln outputs the given non-fatal warning message to standard error.

Types

type Level

type Level int

Level specifies a log level which denotes the importance or severity of a log event.

const (
	// LevelDebug is used for debug messages (Magenta).
	LevelDebug Level = -4
	// LevelInfo is used for informational messages (Cyan).
	LevelInfo Level = 0
	// LevelWarn is used for non-fatal warnings (Red).
	LevelWarn Level = 4
	// LevelError is used for fatal errors (Red).
	LevelError Level = 8
)

Common log levels.

func PathLevel

func PathLevel(path string) (Level, bool)

PathLevel returns the current log level of the given path at package or function granularity (or a parent directory thereof), and a boolean indicating whether the log level was set.

Jump to

Keyboard shortcuts

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