observability

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

File: internal/observability/logger.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger() *zap.Logger

GetLogger returns the initialized global logger instance.

func Initialize

func Initialize(cfg config.LoggerConfig, consoleWriter zapcore.WriteSyncer)

Initialize sets up the global Zap logger based on configuration and a specified output writer. This is the core, flexible initializer.

func InitializeLogger

func InitializeLogger(cfg config.LoggerConfig)

InitializeLogger is a convenience wrapper around Initialize for production use. It defaults console output to a locked Stdout.

func ResetForTest

func ResetForTest()

ResetForTest resets the sync.Once and clears the global logger. This function should ONLY be used in tests to ensure isolation.

func SetLogger

func SetLogger(logger *zap.Logger)

SetLogger is a test helper that forcibly replaces the global logger instance. This should ONLY be used in tests to inject a specific logger (like a test logger) and bypass the sync.Once mechanism.

func Sync

func Sync()

Sync flushes any buffered log entries. Applications should call this before exiting.

Types

This section is empty.

Jump to

Keyboard shortcuts

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