vlog

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is a lightweight wrapper around zerolog.Logger, facilitating advanced logging capabilities such as dynamic log level setting and custom log formatting. It encapsulates the zerolog.Logger to leverage its high performance and concurrency-safe logging features while providing a simplified and intuitive API for application logging.

func New

func New(debug bool) *Logger

New creates and configures a new Logger instance. It takes a boolean flag 'debug' to set the appropriate logging level. The logger is set up with a console writer that formats output to a human-friendly, readable format. It is the primary entry point for creating a logger with the vlog package.

func (*Logger) Logger

func (l *Logger) Logger() *zerolog.Logger

Logger retrieves the underlying zerolog.Logger, providing direct access to its advanced functionality if required. This allows users of vlog to utilize zerolog's full capabilities while defaulting to simplified use.

func (*Logger) Printf

func (l *Logger) Printf(ctx context.Context, format string, v ...interface{})

Printf provides a formatted output function that adheres to the Logger interface required by various packages like database/sql. It allows vlog to be easily plugged into other libraries or frameworks that accept standard loggers. Contextual information from the context.Context parameter can be utilized here for more contextual logging.

Jump to

Keyboard shortcuts

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