log

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Level = Normal

Level contains current app logging level.

View Source
var TraceFile = utils.Join(
	getRoamingDir(),
	fmt.Sprintf("%s.log", time.Now().Format("060102150405")),
)

TraceFile contains path to log file for http package. Can be not exists.

Functions

func Debug

func Debug(value string)

Debug print input text to os.Stdout with "[DEB]" mark and appended new line when log level is Detailed.

func Debugf

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

Debugf format and print input text to os.Stdout with "[DEB]" mark and appended new line when log level is Detailed.

func Error

func Error(value string)

Error print input text to os.Stderr with "[ERR]" mark and appended new line when log level is Minimal or above.

func Errorf

func Errorf(format string, values ...any)

Errorf format and print input text to os.Stderr with "[ERR]" mark and appended new line when log level is Minimal or above.

func Info

func Info(value string)

Info print input text to os.Stdout with "[INF]" mark and appended new line when log level is Normal or above.

func Infof

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

Infof format and print input text to os.Stdout with "[INF]" mark and appended new line when log level is Normal or above.

func Success

func Success(value string)

Success print input text to os.Stdout with "[SCC]" mark and appended new line when log level is Minimal or above.

func Trace added in v1.4.0

func Trace(value string)

Trace print input text to os.Stdout with "[TRC]" mark and appended new line when log level is Detailed.

func Tracef added in v1.4.0

func Tracef(format string, values ...any)

Tracef format and print input text to os.Stdout with "[TRC]" mark and appended new line when log level is Detailed.

func Warning

func Warning(value string)

Warning print input text to os.Stderr with "[WRN]" mark and appended new line when log level is Normal or above.

func Warningf

func Warningf(format string, values ...any)

Warningf format and print input text to os.Stderr with "[WRN]" mark and appended new line when log level is Normal or above.

Types

type LogLevel

type LogLevel int
const (
	// Quiet - no output at all
	Quiet LogLevel = iota + 1
	// Minimal - only SUCCESS and ERROR logs
	Minimal
	// Normal - same as Minimal plus INFO and WARNING logs
	Normal
	// Detailed - same as Normal plus DEBUG logs and tracing net errors to log file
	Detailed
)

func NewLevel

func NewLevel(input string) (LogLevel, error)

NewLevel returns log level based on its string representation. Returns error if input string format is invalid.

Jump to

Keyboard shortcuts

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