Documentation
¶
Overview ¶
Package zap provides Uber's Zap logger implementations with environment-specific configurations and OpenTelemetry integration. This package handles the core logging functionality, offering both standard output logging and OpenTelemetry-enabled logging with appropriate configuration based on the application environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStdoutZapLogger ¶
NewStdoutZapLogger creates a Zap logger that only outputs to stdout without OpenTelemetry integration. This is used when OpenTelemetry is not enabled or not available, providing a standard logging solution with environment-specific formatting.
The logger format is environment-sensitive: - Development/QA/Local: Console output with colored level encoding - Production/Staging: JSON output for better machine parsing
Parameters:
- cfgs: Application configurations including environment and log level settings
Returns:
- A configured zap.Logger instance for standard output
- An error if logger initialization fails
func NewZapLogger ¶
NewZapLogger creates a Zap logger configured for both local output and OpenTelemetry export. It sets up a combined core that routes log entries to both standard output and the OpenTelemetry logger provider, allowing logs to be displayed locally while also being sent to observability systems.
The logger format is environment-sensitive: - Development/QA/Local: Console output with colored level encoding - Production/Staging: JSON output for better machine parsing
Parameters:
- cfgs: Application configurations including environment and log level settings
- provider: OpenTelemetry logger provider for exporting logs
Returns:
- A configured zap.Logger instance with both local and OTLP output
- An error if logger initialization fails
Types ¶
This section is empty.