zaplog

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package color adds coloring functionality for TTY output.

Index

Constants

View Source
const DevEncoderType = "dliver-dev"
View Source
const (
	EncoderType = "dliver"
)

Variables

This section is empty.

Functions

func NewDevelopmentEncoder

func NewDevelopmentEncoder(options ...DevEncoderOption) func(zapcore.EncoderConfig) (zapcore.Encoder, error)

NewDevelopmentEncoder create a new zapcore.Encoder configured for development.

func NewEncoder

func NewEncoder(specialKeys []string) func(zapcore.EncoderConfig) (zapcore.Encoder, error)

NewEncoder create a new zapcore.Encoder configured for the dliver system needs. During encoding field names matching a specialKeys entry will be added to the log message separately from the other fields. Special field keys and values may not include ';' and '='. These characters will be replaced with empty string.

func NewLogger

func NewLogger(zapLogger *zap.Logger, ctxLogger log.ContextMapper) log.Logger

NewLogger creates a new Logger backed by zap. This logger will check the debug level settings of the passed zap.Logger instance and handle some methods differently, based on that.

Types

type Color

type Color uint8

Color represents a text color.

const (
	Black Color = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

func (Color) Add

func (c Color) Add(s string) string

Add adds the coloring to the given string.

type DevEncoderOption

type DevEncoderOption func(de *DevEncoderOptions)

func ExcludeFilter

func ExcludeFilter(filters ...string) DevEncoderOption

func IndentFields

func IndentFields(indent bool) DevEncoderOption

func TimeLayout

func TimeLayout(layout string) DevEncoderOption

type DevEncoderOptions

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

type Encoder

type Encoder struct {
	zapcore.Encoder
	// contains filtered or unexported fields
}

func (*Encoder) Clone

func (de *Encoder) Clone() zapcore.Encoder

func (*Encoder) EncodeEntry

func (de *Encoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

Jump to

Keyboard shortcuts

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