logging

package
v1.5.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MPL-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package logging provides logging primitives.

Index

Constants

This section is empty.

Variables

View Source
var StdWriter = &logWrapper{nil}

StdWriter creates a sync writer that writes all logs to the std logger.

Functions

func Component

func Component(name string) zapcore.Field

Component helper for creating zap.Field.

func NewWriter

func NewWriter(l *zap.Logger, level zapcore.Level) io.Writer

NewWriter creates new log zap log writer.

func Wrap

func Wrap(writer io.Writer) *zap.Logger

Wrap is a simple helper to wrap io.Writer with default arguments.

func ZapLogger

func ZapLogger(dests ...*LogDestination) *zap.Logger

ZapLogger creates new default Zap Logger.

Types

type EncoderOption

type EncoderOption func(config *zapcore.EncoderConfig)

EncoderOption defines a log destination encoder config setter.

func WithColoredLevels

func WithColoredLevels() EncoderOption

WithColoredLevels enables log level colored output.

func WithoutLogLevels

func WithoutLogLevels() EncoderOption

WithoutLogLevels disable log level.

func WithoutTimestamp

func WithoutTimestamp() EncoderOption

WithoutTimestamp disables timestamp.

type LogDestination

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

LogDestination defines logging destination Config.

func NewLogDestination

func NewLogDestination(writer io.Writer, logLevel zapcore.LevelEnabler, options ...EncoderOption) *LogDestination

NewLogDestination creates new log destination.

type LogWriter

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

LogWriter is a wrapper around zap.Logger that implements io.Writer interface.

func (*LogWriter) Write

func (lw *LogWriter) Write(line []byte) (int, error)

Write implements io.Writer interface.

Jump to

Keyboard shortcuts

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