util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LOG_TYPE

type LOG_TYPE int
const (
	DEBUG LOG_TYPE = iota
	INFO
	WARN
	ERROR
)

func (LOG_TYPE) String

func (l LOG_TYPE) String() string

type Logger

type Logger struct {
	// Log level
	LogLevel LOG_TYPE
	Logger   *log.Logger
}

func Default

func Default() *Logger

Default returns the default logger. It will create a new logger with minimum log level based on the ENV_VERBOSE environment variable. If ENV_VERBOSE is set to "debug", the DEBUG and above level logs will be printed. Otherwise, only ERROR logs will be printed.

func NewLogger

func NewLogger(logLevel LOG_TYPE, logger *log.Logger) *Logger

NewLogger creates a logger with the specified log level and logger.

func (*Logger) PrintLogs

func (l *Logger) PrintLogs(level LOG_TYPE, log string)

Jump to

Keyboard shortcuts

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