logger

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package logger provides structured logging functionality for the application.

Package logger provides structured logging functionality for the application.

This package implements a centralized logging system using zerolog, providing: - Consistent structured logging patterns across the application - Log level configuration via Viper - Conditional JSON or console output based on environment - Optional caller information for debugging - Formatted console output with timestamps

The logger should be initialized once at application startup through the Init function, and then accessed through the zerolog.Logger instances throughout the codebase.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version logger for version-related operations
	Version zerolog.Logger

	// Changelog logger for changelog operations
	Changelog zerolog.Logger

	// Git logger for git operations
	Git zerolog.Logger

	// Config logger for configuration operations
	Config zerolog.Logger

	// UI logger for user interface operations
	UI zerolog.Logger

	// Docs logger for documentation generation
	Docs zerolog.Logger
)

Functions

func Init

func Init(out io.Writer) error

Init initializes the logger with options from Viper configuration.

It configures the global zerolog Logger instance with: - Log level from viper.GetString("app.log_level") - Log format (JSON or console) from viper.GetString("app.log_format") - Optional caller information from viper.GetBool("app.log_caller") - Timestamp in RFC3339 format

Log format behavior: - "console": Always use human-readable console output - "json": Always use JSON structured logging - "auto": Use console if output is a TTY, JSON otherwise (default)

This function should be called once in rootCmd's PersistentPreRunE or main initialization. If an invalid log level is provided, it will default to "info" and log a warning.

Parameters:

  • out: Writer where logs will be written. If nil, defaults to os.Stderr

Returns:

  • error: Any error encountered during initialization

func InitComponentLoggers

func InitComponentLoggers()

InitComponentLoggers initializes all component-specific loggers. This should be called after Init() has configured the global logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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