zap

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 6 Imported by: 0

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

func NewStdoutZapLogger(cfgs *configs.Configs) (*zap.Logger, error)

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

func NewZapLogger(cfgs *configs.Configs, provider *log.LoggerProvider) (*zap.Logger, error)

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.

Jump to

Keyboard shortcuts

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