logger

package
v1.6.23 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationInsightsCore

func ApplicationInsightsCore(cfg *AppInsightsConfig) (zapcore.Core, func(), error)

ApplicationInsightsCore builds a zapcore.Core that sends logs to Application Insights. The first return is the core, the second is a function to close the sink.

func FileCore

func FileCore(cfg *FileConfig) (zapcore.Core, func(), error)

FileCore builds a zapcore.Core that writes to a file. The first return is the core, the second is a function to close the file.

func StdoutCore

func StdoutCore(l zapcore.Level) zapcore.Core

StdoutCore builds a zapcore.Core that writes to stdout.

Types

type AppInsightsConfig

type AppInsightsConfig struct {
	Level            string          `json:"level"`
	IKey             string          `json:"ikey"`
	GracePeriod      time.Duration   `json:"grace_period"`
	MaxBatchInterval time.Duration   `json:"max_batch_interval"`
	MaxBatchSize     int             `json:"max_batch_size"`
	Fields           []zapcore.Field `json:"fields"`
	// contains filtered or unexported fields
}

func (*AppInsightsConfig) UnmarshalJSON

func (c *AppInsightsConfig) 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.

type FileConfig

type FileConfig struct {
	Filepath string `json:"filepath"`
	Level    string `json:"level"`

	MaxBackups int `json:"maxBackups"`
	MaxSize    int `json:"maxSize"`
	// contains filtered or unexported fields
}

func (*FileConfig) UnmarshalJSON

func (cfg *FileConfig) 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.

Jump to

Keyboard shortcuts

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