logutils

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(message string, fields map[string]interface{})

Debug logs a debug message.

func Error

func Error(message string, err error, fields map[string]interface{})

Error logs an error message.

func Fatal

func Fatal(message string, err error, fields Fields)

Fatal logs a critical error message and terminates the program.

func Info

func Info(message string, fields map[string]interface{})

Info logs an information message.

func InitLogger

func InitLogger()

InitLogger configures the logger with a standardized format and log level. With().Caller().Timestamp().Logger() is used to include the caller and timestamp in the log output. The log level can be set using the LOG_LEVEL environment variable. The log output can be redirected to a file by setting the LOG_PATH environment variable. If the LOG_PATH environment variable is not set, the log output will be directed to stdout. The log level defaults to Debug if the LOG_LEVEL environment variable is not set. The log file path defaults to log.log if the LOG_PATH environment variable is not set.

func Warn

func Warn(message string, fields map[string]interface{})

Warn logs a warning message.

Types

type Fields added in v1.1.0

type Fields map[string]interface{}

Jump to

Keyboard shortcuts

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