spqrlog

package
v0.0.0-...-06f73d7 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: PostgreSQL Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Zero = NewZeroLogger("")

Functions

func GetPointer

func GetPointer(value interface{}) uint

GetPointer do the same thing like fmt.Sprintf("%p", &num) but fast GetPointer returns the memory address of the given value as an unsigned integer.

func NewZeroLogger

func NewZeroLogger(filepath string) *zerolog.Logger

NewZeroLogger creates a new ZeroLogger with the specified filepath. It initializes a writer and creates a logger with a timestamp. The logger is returned as a pointer to a zerolog.Logger. If the filepath is empty, the logger will be set to os.Stdout. Otherwise, a new log file will be opened and used for logging.

Parameters:

  • filepath: The path to the log file where the data will be written.

Returns:

  • *zerolog.Logger: A pointer to the created ZeroLogger.

func ReloadLogger

func ReloadLogger(filepath string)

ReloadLogger reloads the logger with a new log file. If the filepath is empty, the logger will be set to os.Stdout. Otherwise, a new log file will be opened and used for logging.

Parameters:

  • filepath: The path to the log file where the data will be written.

func UpdateZeroLogLevel

func UpdateZeroLogLevel(logLevel string) error

UpdateZeroLogLevel updates the log level of the Zero logger. It takes a logLevel string as input and returns an error if any. The logLevel string should be one of the following: "debug", "info", "warn", "error", "fatal", "panic". If the logLevel string is invalid, the function will return an error.

Parameters:

  • logLevel: The log level to set for the Zero logger.

Returns:

  • error: An error if any error occurs during the process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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