lgr

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package lgr An instance of library logger, used for direct output from the command line, etc.

To change logger level should use the system environment "UYMAS_LGR_LEVEL", to close logger color style shou use the system environment "UYMAS_LGR_NOCOLOR", to change debug maker for test use the system environment "UYMAS_TMP_MARK", like:

# window powershell
$env:UYMAS_LGR_LEVEL='all'
$env:UYMAS_LGR_NOCOLOR='true'
$env:UYMAS_TMP_MARK='TMarkShouldDEL'

# linux shell
export UYMAS_LGR_LEVEL=all
export UYMAS_LGR_NOCOLOR=true
export UYMAS_TMP_MARK=TMarkShouldDEL

if not info by default.

Index

Examples

Constants

View Source
const (
	// EnvLevelKey try set the lgr level by system environment, like `$ export UYMAS_LGR_LEVEL=info`
	EnvLevelKey = "UYMAS_LGR_LEVEL"
	// EnvNoColorKey try set the lgr no color by system environment, like `$ export UYMAS_LGR_NOCOLOR=true`
	EnvNoColorKey = "UYMAS_LGR_NOCOLOR"
	// EnvMarkKey try set the lgr mark by system environment, like `$ export UYMAS_TMP_MARK=mark`
	EnvMarkKey = "UYMAS_TMP_MARK"
)

Variables

This section is empty.

Functions

func Debug

func Debug(message string, args ...any)
Example
Debug("This is Debug logger.")

func Error

func Error(message string, args ...any)
Example
Error("This is Debug logger.")

func ErrorIf

func ErrorIf(err error, prefixErr ...error)

ErrorIf print error message only when err is not nil

func Fatal

func Fatal(message string, args ...any)

func FatalIf

func FatalIf(err error, prefixErr ...error)

func Info

func Info(message string, args ...any)

func Log

func Log() logger.Logger

func Pref

func Pref(logPref string) logger.Logger

func SetFlag

func SetFlag(flag int)

func TmpMark

func TmpMark(mark any, args ...any)

TmpMark temporary tags are used for debugging, and debugging should be removed before release

to global search keyword `lgr.TmpMark` then remove it.

Example
TmpMark("temp mark when develop.")
TmpMark("param: %s, Year %d", "Joshua Conero", time.Now().Year())

func Trace

func Trace(message string, args ...any)

func Warn

func Warn(message string, args ...any)

Types

This section is empty.

Jump to

Keyboard shortcuts

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