logger

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package logger provides an opinionated logger for CNS which knows how to log to Application Insights, file, stdout and ETW (based on platform).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsV1 added in v1.6.33

func AsV1(z *zap.Logger, closer func()) *shim

func MetadataToFields added in v1.6.33

func MetadataToFields(meta common.Metadata) []zap.Field

MetadataToFields transforms Az IMDS Metadata in to zap.Field for attaching to a root zap core or logger instance. This uses the nice-names from the zapai.DefaultMappers instead of raw AppInsights key names.

func New

func New(cfg *Config) (*zap.Logger, func(), error)

New creates a v2 CNS logger built with Zap.

Types

type Config

type Config struct {
	// Level is the general logging Level. If cores have more specific config it will override this.
	Level string `json:"level"`

	AppInsights *cores.AppInsightsConfig `json:"appInsights,omitempty"`
	File        *cores.FileConfig        `json:"file,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Normalize

func (c *Config) Normalize()

Normalize checks the Config for missing/default values and sets them if appropriate.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for the Config. It only differs from the default by parsing the Level string into a zapcore.Level and setting the level field.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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