internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(logger *zap.Logger) *config

NewConfig constructs a Config struct which represents server settings, and populates it with default values.

func NewJSONFileLogger

func NewJSONFileLogger(consoleLogger *zap.Logger, fileName string, level zapcore.Level, format LoggingFormat) *zap.Logger

func NewJSONLogger

func NewJSONLogger(output *os.File, level zapcore.Level, format LoggingFormat) *zap.Logger

func NewMultiLogger

func NewMultiLogger(loggers ...*zap.Logger) *zap.Logger

func NewRotatingJSONFileLogger

func NewRotatingJSONFileLogger(consoleLogger *zap.Logger, config Config, level zapcore.Level, format LoggingFormat) *zap.Logger

func RedirectStdLog

func RedirectStdLog(logger *zap.Logger)

func SetupLogging

func SetupLogging(tmpLogger *zap.Logger, config Config) (*zap.Logger, *zap.Logger)

func StackdriverLevelEncoder

func StackdriverLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

Types

type Config

type Config interface {
	GetWatch() string
	GetLogger() *LoggerConfig

	Clone() (Config, error)
}

func ParseArgs

func ParseArgs(logger *zap.Logger, args []string) Config

type LoggerConfig

type LoggerConfig struct {
	Level    string `yaml:"level" json:"level" usage:"Log level to set. Valid values are 'debug', 'info', 'warn', 'error'. Default 'info'."`
	Stdout   bool   `yaml:"stdout" json:"stdout" usage:"Log to standard console output (as well as to a file if set). Default true."`
	File     string `` /* 135-byte string literal not displayed */
	Rotation bool   `yaml:"rotation" json:"rotation" usage:"Rotate log files. Default is false."`
	// Reference: https://godoc.org/gopkg.in/natefinch/lumberjack.v2
	MaxSize    int    `` /* 139-byte string literal not displayed */
	MaxAge     int    `` /* 195-byte string literal not displayed */
	MaxBackups int    `` /* 188-byte string literal not displayed */
	LocalTime  bool   `` /* 184-byte string literal not displayed */
	Compress   bool   `yaml:"compress" json:"compress" usage:"This determines if the rotated log files should be compressed using gzip."`
	Format     string `yaml:"format" json:"format" usage:"Set logging output format. Can either be 'JSON' or 'Stackdriver'. Default is 'JSON'."`
}

LoggerConfig is configuration relevant to logging levels and output.

func NewLoggerConfig

func NewLoggerConfig() *LoggerConfig

type LoggingFormat

type LoggingFormat int8
const (
	JSONFormat LoggingFormat = iota - 1
	StackdriverFormat
)

type RedirectStdLogWriter

type RedirectStdLogWriter struct {
	// contains filtered or unexported fields
}

func (*RedirectStdLogWriter) Write

func (r *RedirectStdLogWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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