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 ¶
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 ¶
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 ¶
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.