Documentation
¶
Overview ¶
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncoderConfig ¶
func EncoderConfig() zapcore.EncoderConfig
func LogrLogger ¶ added in v1.2.1
LogrLogger returns a logr.Logger backed by the global zap logger. This is useful for integrating with controller-runtime and other libraries that use logr.Logger, ensuring consistent log format across the application.
The returned logr.Logger is backed by a logr.LogSink that resolves the zap core on every call, so controller-runtime loggers set up before SetupZapLogger runs automatically start flowing to Application Insights once the zap global is initialized.
func SetDefaultSlog ¶ added in v1.2.1
func SetDefaultSlog()
SetDefaultSlog sets Go's global slog default to use the zap-backed handler. After calling this, slog.Default() returns a logger that routes through zap.
func SlogHandler ¶ added in v1.2.1
SlogHandler returns an slog.Handler backed by the global zap core. All slog messages will flow through zap's pipeline (stdout + Application Insights). The returned handler resolves the global zap core on every call, so it keeps working even if registered (e.g. via logging.AddHandlers) before SetupZapLogger runs — once the global is initialized, records start flowing to AI.
func SlogLogger ¶ added in v1.2.1
SlogLogger returns a new *slog.Logger backed by the global zap core.
Types ¶
type LogOpts ¶
type LogOpts struct {
Level string
File bool
FileName string
MaxFileSizeMB int
MaxBackups int
MaxAgeDays int
ApplicationInsightsID string
EnableTelemetry bool
}
func GetDefaultLogOpts ¶
func GetDefaultLogOpts() *LogOpts