rainbowlog

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 15 Imported by: 0

README

rainbowlog

Simple, configurable,structured Logging for Go.

Documentation

Index

Examples

Constants

View Source
const (
	// TimeFormatUnix defines a time format that makes time fields to be
	// serialized as Unix timestamp integers.
	TimeFormatUnix = "UNIX"

	// TimeFormatUnixMs defines a time format that makes time fields to be
	// serialized as Unix timestamp integers in milliseconds.
	TimeFormatUnixMs = "UNIXMS"

	// TimeFormatUnixMicro defines a time format that makes time fields to be
	// serialized as Unix timestamp integers in microseconds.
	TimeFormatUnixMicro = "UNIXMICRO"

	// TimeFormatUnixNano defines a time format that makes time fields to be
	// serialized as Unix timestamp integers in nanoseconds.
	TimeFormatUnixNano = "UNIXNANO"
)
View Source
const (
	ColorBold          = 1
	ColorUnderline     = 4
	ColorStrikeThrough = 9
	ColorUnderlineBold = 21
)
View Source
const (
	ColorBlack = iota + 30
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorMagenta
	ColorCyan
	ColorPale
)
View Source
const (
	ColorBgBlack = iota + 40
	ColorBgRed
	ColorBgGreen
	ColorBgYellow
	ColorBgBlue
	ColorBgMagenta
	ColorBgCyan
	ColorBgPale
)
View Source
const (
	ColorHlBlack = iota + 90
	ColorHlRed
	ColorHlGreen
	ColorHlYellow
	ColorHlBlue
	ColorHlMagenta
	ColorHlCyan
	ColorHlPale
)
View Source
const (
	ColorHlBgBlack = iota + 100
	ColorHlBgRed
	ColorHlBgGreen
	ColorHlBgYellow
	ColorHlBgBlue
	ColorHlBgMagenta
	ColorHlBgCyan
	ColorHlBgPale
)
View Source
const (
	DefaultLevel        = level.Debug
	DefaultLabel        = ""
	DefaultConsolePrint = false
	DefaultConsoleColor = true
)

Variables

View Source
var (
	// MsgFieldName is the field name for core message.
	MsgFieldName = "message"
	// ErrFieldName is the field name for err.
	ErrFieldName = "error"
	// ErrStackFieldName is the field name for err stack.
	ErrStackFieldName = "stack"

	MetaTimeFieldName   = "_TIME_"
	MetaCallerFieldName = "_CALLER_"
	MetaLevelFieldName  = "_LEVEL_"
	MetaLabelFieldName  = "_LABEL_"

	GlobalDurationValueUseInt = false

	DefaultStack = false

	// ErrorHandler will be called whenever some error threw when logger working.
	// If not set, the error will be printed on the stderr.
	// This handler must be thread safe and non-blocking.
	ErrorHandler = func(err error) {
		fmt.Fprintf(os.Stderr, "rainbowlog: error found: %v\n", err)
	}

	GlobalTimeFormat = "2006-01-02 15:04:05.000"

	GlobalLevelFieldMarshalFunc LevelFieldMarshalFunc = func(l level.Level) string {
		return strings.ToUpper(l.String())
	}

	// CallerSkipFrameCount is the number of stack frames to skip to find the caller.
	CallerSkipFrameCount = 0

	// GlobalCallerMarshalFunc allows customization of global caller marshaling.
	GlobalCallerMarshalFunc CallerMarshalFunc = func(file string, line int) string {
		return file + ":" + strconv.Itoa(line)
	}

	// GlobalErrorMarshalFunc allows customization of global error marshaling.
	GlobalErrorMarshalFunc ErrorMarshalFunc = func(err error) string {
		if err == nil {
			return ""
		}
		return err.Error()
	}

	// GlobalErrorStackMarshalFunc extract the stack from err if any.
	GlobalErrorStackMarshalFunc ErrorStackMarshalFunc

	TimestampFunc = func() time.Time {
		return time.Now()
	}

	GlobalEncoderParseFunc EncoderParseFunc = func(encoder string) Encoder {
		switch strings.ToLower(encoder) {
		case "json":
			return JsonEnc
		case "txt", "text":
			return TextEnc
		default:
			panic("unsupported encoder: " + encoder)
		}
	}
)
View Source
var NewTextEncoder = func(metaKeys ...string) Encoder {
	return encoder.TextEncoder{MetaKeys: metaKeys}
}

Functions

func SyncWriter

func SyncWriter(w io.Writer) io.Writer

SyncWriter wraps writer so that each call to Write is synchronized with a mutex. This syncer can be used to wrap the call to writer's Write method if it is not thread safe. Note that you do not need this wrapper for os.File Write operations on POSIX and Windows systems as they are already thread-safe.

Types

type CallerMarshalFunc

type CallerMarshalFunc func(file string, line int) string

type ConsolePacker

type ConsolePacker struct {
	RecordPackerForWriter
	// contains filtered or unexported fields
}

func (*ConsolePacker) Done

func (j *ConsolePacker) Done()

func (*ConsolePacker) Err

func (j *ConsolePacker) Err(err error)

func (*ConsolePacker) Msg

func (j *ConsolePacker) Msg(msg string)

type Encoder

type Encoder interface {
	BeginMarker(dst []byte) []byte
	BlankSpace(dst []byte) []byte
	Bool(dst []byte, val bool) []byte
	Bytes(dst []byte, s []byte) []byte
	Comma(dst []byte) []byte
	Delim(dst []byte) []byte
	Duration(dst []byte, unit time.Duration, useInt bool, d time.Duration) []byte
	EndMarker(dst []byte) []byte
	Float32(dst []byte, val float32) []byte
	Float64(dst []byte, val float64) []byte
	Hex(dst []byte, s []byte) []byte
	IPAddr(dst []byte, ip net.IP) []byte
	IPPrefix(dst []byte, pfx net.IPNet) []byte
	Int(dst []byte, val int) []byte
	Int16(dst []byte, val int16) []byte
	Int32(dst []byte, val int32) []byte
	Int64(dst []byte, val int64) []byte
	Int8(dst []byte, val int8) []byte
	Interface(dst []byte, i interface{}) []byte
	Key(dst []byte, key string) []byte
	LineBreak(dst []byte) []byte
	MACAddr(dst []byte, ha net.HardwareAddr) []byte
	Nil(dst []byte) []byte
	ObjectData(dst []byte, o []byte) []byte
	String(dst []byte, s string) []byte
	Time(dst []byte, format string, t time.Time) []byte
	Uint(dst []byte, val uint) []byte
	Uint16(dst []byte, val uint16) []byte
	Uint32(dst []byte, val uint32) []byte
	Uint64(dst []byte, val uint64) []byte
	Uint8(dst []byte, val uint8) []byte
	MetaEnd(dst []byte) []byte
	// contains filtered or unexported methods
}
var JsonEnc Encoder = encoder.JsonEncoder{}
var TextEnc Encoder = encoder.TextEncoder{
	MetaKeys: defaultMetaKeys().Keys(),
}

type EncoderParseFunc

type EncoderParseFunc func(encoder string) Encoder

type ErrorMarshalFunc

type ErrorMarshalFunc func(err error) string

type ErrorStackMarshalFunc

type ErrorStackMarshalFunc func(err error) interface{}

type Hook

type Hook interface {
	// RunHook runs the hook with the event.
	RunHook(r *Record, level level.Level, message string)
}

Hook defines an interface to a record hook.

type HookFunc

type HookFunc func(r *Record, level level.Level, message string)

HookFunc is an adaptor to allow the use of an ordinary function as a Hook.

func (HookFunc) RunHook

func (hf HookFunc) RunHook(r *Record, level level.Level, message string)

RunHook implements the Hook interface.

type LevelFieldMarshalFunc

type LevelFieldMarshalFunc func(level.Level) string

type LevelHook

type LevelHook struct {
	NoneLevelHook, TraceHook, DebugHook, InfoHook, WarnHook, ErrorHook, FatalHook, PanicHook Hook
}

LevelHook applies a different hook for each level.

func NewLevelHook

func NewLevelHook() LevelHook

func (LevelHook) RunHook

func (lh LevelHook) RunHook(r *Record, lv level.Level, message string)

RunHook implements the Hook interface.

type LevelWriter

type LevelWriter interface {
	io.Writer
	WriteLevel(level level.Level, bz []byte) (n int, err error)
}

LevelWriter defines as interface a writer may implement in order to receive level information with payload.

func LevelWriterAdapter

func LevelWriterAdapter(writer io.Writer) LevelWriter

func MultiLevelWriter

func MultiLevelWriter(writers ...io.Writer) LevelWriter

MultiLevelWriter creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command. If some writers implement LevelWriter, their WriteLevel method will be used instead of Write.

type Logger

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

Logger is the rainbow-log structure. This is the main entrance of rainbow log.

func New

func New(opts ...Option) *Logger

New creates a new *Logger with options optional.

Example
package main

import (
	"os"

	"github.com/rambollwong/rainbowlog"
)

func main() {
	log := rainbowlog.New(
		rainbowlog.AppendsEncoderWriters(rainbowlog.JsonEnc, os.Stdout),
		rainbowlog.WithMetaKeys(rainbowlog.MetaLevelFieldName, rainbowlog.MsgFieldName),
	)
	log.Info().Msg("Hello world!").Done()

	log2 := rainbowlog.New(
		rainbowlog.AppendsEncoderWriters(rainbowlog.TextEnc, os.Stdout),
		rainbowlog.WithMetaKeys(rainbowlog.MetaLevelFieldName, rainbowlog.MsgFieldName))
	log2.Debug().Msg("Hello world!").Done()

}
Output:
{"META_LEVEL":"INFO","message":"Hello world!"}
DEBUG > Hello world!

func (*Logger) Debug

func (l *Logger) Debug() *Record

Debug create a new *Record with debug level setting.

func (*Logger) Error

func (l *Logger) Error() *Record

Error create a new *Record with error level setting.

func (*Logger) Fatal

func (l *Logger) Fatal() *Record

Fatal create a new *Record with fatal level setting.

func (*Logger) Info

func (l *Logger) Info() *Record

Info create a new *Record with info level setting.

Example
package main

import (
	"os"

	"github.com/rambollwong/rainbowlog"
)

func main() {
	log := rainbowlog.New(
		rainbowlog.AppendsEncoderWriters(rainbowlog.JsonEnc, os.Stdout),
		rainbowlog.WithMetaKeys(rainbowlog.MetaLevelFieldName),
	)
	log.Info().Msg("Hello world!").Done()

}
Output:
{"META_LEVEL":"INFO","message":"Hello world!"}

func (*Logger) Level

func (l *Logger) Level(le level.Level) *Record

Level create a new *Record with the logger level given.

func (*Logger) Panic

func (l *Logger) Panic() *Record

Panic create a new *Record with panic level setting.

func (*Logger) Record

func (l *Logger) Record() *Record

Record create a new *Record with basic.

Example
package main

import (
	"os"

	"github.com/rambollwong/rainbowlog"
	"github.com/rambollwong/rainbowlog/level"
)

func main() {
	log := rainbowlog.New(
		rainbowlog.AppendsEncoderWriters(rainbowlog.JsonEnc, os.Stdout),
		rainbowlog.WithMetaKeys(rainbowlog.MetaLevelFieldName),
	)
	log.Record().WithLevel(level.Info).Msg("Hello world!").Done()
	log.Record().WithLevel(level.Debug).Msg("Hello world!").Done()

}
Output:
{"META_LEVEL":"INFO","message":"Hello world!"}
{"META_LEVEL":"DEBUG","message":"Hello world!"}

func (*Logger) SubLogger

func (l *Logger) SubLogger(opts ...Option) *Logger

SubLogger creates a new *Logger that inherit from parent logger. Optional options for sub logger also be supported.

Example
package main

import (
	"os"

	"github.com/rambollwong/rainbowlog"
)

func main() {
	log := rainbowlog.New(rainbowlog.AppendsEncoderWriters(rainbowlog.JsonEnc, os.Stdout))

	subLog := log.SubLogger(
		rainbowlog.WithMetaKeys(rainbowlog.MetaLabelFieldName),
		rainbowlog.WithLabel("NewLabel"),
	)
	subLog.Info().Msg("Hello world!").Done()
}
Output:
{"META_LABEL":"NewLabel","message":"Hello world!"}

func (*Logger) Warn

func (l *Logger) Warn() *Record

Warn create a new *Record with warn level setting.

type NewRecordFunc

type NewRecordFunc func() *Record

type Option

type Option func(logger *Logger)

Option defines logger options for custom using.

func AppendsEncoderWriters

func AppendsEncoderWriters(encoder Encoder, writers ...io.Writer) Option

AppendsEncoderWriters appends writers who use a same encoder to logger.

func AppendsHooks

func AppendsHooks(hooks ...Hook) Option

AppendsHooks appends hooks to logger.

func WithCallerMarshalFunc

func WithCallerMarshalFunc(callerMarshalFunc CallerMarshalFunc) Option

WithCallerMarshalFunc sets the CallerMarshalFunc for logger. If MetaCallerFieldName has been set by WithMetaKeys option (if WithMetaKeys is not appended, MetaCallerFieldName is set by default), CallerMarshalFunc will be invoked when printing logs.

func WithConfig

func WithConfig(config config.LoggerConfig) Option

WithConfig sets the Logger's properties according to the provided configuration parameters. If the Enable field in the configuration is false, the logger level will be set Disabled. Normally, the WithDefault() option should be set before calling this option.

func WithConfigFile

func WithConfigFile(configFile string) Option

WithConfigFile loads the log configuration from the specified configuration file, sets the properties of the Logger according to the configuration parameters. If an error occurs while loading the configuration file, trigger a panic.

func WithConsolePrint

func WithConsolePrint(enable bool) Option

WithConsolePrint sets whether enable printing to console.

func WithDefault

func WithDefault() Option

WithDefault sets default configurations to logger. If you use this option, please put it at the top of all options, otherwise it may overwrite the modified configuration as the default.

func WithErrorMarshalFunc

func WithErrorMarshalFunc(errorMarshalFunc ErrorMarshalFunc) Option

WithErrorMarshalFunc sets the ErrorMarshalFunc for logger. If record.Err() has been invoked, ErrorMarshalFunc will be invoked when printing logs. The marshal result string will be used as the value of error key field.

func WithErrorStackMarshalFunc

func WithErrorStackMarshalFunc(errorStackMarshalFunc ErrorStackMarshalFunc) Option

WithErrorStackMarshalFunc sets the ErrorStackMarshalFunc for logger.

func WithLabels added in v0.0.2

func WithLabels(labels ...string) Option

WithLabels sets the labels for the Logger using one or more strings. The labels are joined using the "|" separator and assigned to the Logger's label property.

func WithLevel

func WithLevel(lv level.Level) Option

WithLevel sets logger level.

func WithLevelFieldMarshalFunc

func WithLevelFieldMarshalFunc(levelFieldMarshalFunc LevelFieldMarshalFunc) Option

WithLevelFieldMarshalFunc sets the LevelFieldMarshalFunc for logger. LevelFieldMarshalFunc will be invoked when printing logs, then the result string will be used as the value of level key field.

func WithMetaKeyColors

func WithMetaKeyColors(key string, colors ...int) Option

WithMetaKeyColors sets an ANSI code of color for printing the meta key.

NOTICE: MetaKeyColors only useful for console printing if rainbow console enabled. Colors defined in globals.go

func WithMetaKeys

func WithMetaKeys(keys ...string) Option

WithMetaKeys sets meta key field names for each record. Meta keys data will be placed at the front of the record.

func WithRainbowConsole

func WithRainbowConsole(enable bool) Option

WithRainbowConsole sets whether enable rainbow printing on console. This option is useful only when ConsolePrint enabled.

func WithStack

func WithStack(enable bool) Option

WithStack enables recording stack or not.

func WithTimeFormat

func WithTimeFormat(timeFormat string) Option

WithTimeFormat sets the format of time for logger printing.

type Record

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

Record represents a log record. It is finalized by the Done method. Done method also writes the encoded bytes to the writer.

func (*Record) Any added in v0.0.2

func (r *Record) Any(key string, i any) *Record

func (*Record) Bytes

func (r *Record) Bytes(key string, val []byte) *Record

func (*Record) Discard

func (r *Record) Discard() *Record

Discard disables the record that it won't be printed.

func (*Record) Done

func (r *Record) Done()

Done finish appending data and writing record.

NOTICE: once this method is called, the *Record should be disposed. Calling Done twice can have unexpected result.

func (*Record) Dur

func (r *Record) Dur(key string, unit, val time.Duration) *Record

func (*Record) Durs

func (r *Record) Durs(key string, unit time.Duration, vals ...time.Duration) *Record

func (*Record) Err added in v0.0.2

func (r *Record) Err(err error) *Record

Err sets the given err to the error field when err is not nil。 NOTICE: This method should only be called once。 Calling multiple times may cause unpredictable results。

func (*Record) Float32

func (r *Record) Float32(key string, val float32) *Record

func (*Record) Float32s

func (r *Record) Float32s(key string, vals ...float32) *Record

func (*Record) Float64

func (r *Record) Float64(key string, val float64) *Record

func (*Record) Float64s

func (r *Record) Float64s(key string, vals ...float64) *Record

func (*Record) Hex

func (r *Record) Hex(key string, val []byte) *Record

func (*Record) IPAddr

func (r *Record) IPAddr(key string, ip net.IP) *Record

func (*Record) IPPrefix

func (r *Record) IPPrefix(key string, pfx net.IPNet) *Record

func (*Record) Int

func (r *Record) Int(key string, val int) *Record

func (*Record) Int8

func (r *Record) Int8(key string, val int8) *Record

func (*Record) Int8s

func (r *Record) Int8s(key string, vals ...int8) *Record

func (*Record) Int16

func (r *Record) Int16(key string, val int16) *Record

func (*Record) Int16s

func (r *Record) Int16s(key string, vals ...int16) *Record

func (*Record) Int32

func (r *Record) Int32(key string, val int32) *Record

func (*Record) Int32s

func (r *Record) Int32s(key string, vals ...int32) *Record

func (*Record) Int64

func (r *Record) Int64(key string, val int64) *Record

func (*Record) Int64s

func (r *Record) Int64s(key string, vals ...int64) *Record

func (*Record) Ints

func (r *Record) Ints(key string, vals ...int) *Record

func (*Record) MACAddr

func (r *Record) MACAddr(key string, ha net.HardwareAddr) *Record

func (*Record) Msg

func (r *Record) Msg(msg string) *Record

Msg adds the msg as the message field if not empty. NOTICE: This method should only be called once。 Calling multiple times may cause unpredictable results。

func (*Record) Msgf

func (r *Record) Msgf(format string, v ...interface{}) *Record

Msgf adds the formatted msg as the message field if not empty.

func (*Record) Reset

func (r *Record) Reset()

Reset the record instance. This should be called before the record is used again.

func (*Record) Str

func (r *Record) Str(key, val string) *Record

func (*Record) Stringer

func (r *Record) Stringer(key string, val fmt.Stringer) *Record

func (*Record) Stringers

func (r *Record) Stringers(key string, vals ...fmt.Stringer) *Record

func (*Record) Strs

func (r *Record) Strs(key string, vals ...string) *Record

func (*Record) Time

func (r *Record) Time(key, format string, val time.Time) *Record

func (*Record) Times

func (r *Record) Times(key, format string, vals ...time.Time) *Record

func (*Record) Uint

func (r *Record) Uint(key string, val uint) *Record

func (*Record) Uint8

func (r *Record) Uint8(key string, val uint8) *Record

func (*Record) Uint8s

func (r *Record) Uint8s(key string, vals ...uint8) *Record

func (*Record) Uint16

func (r *Record) Uint16(key string, val uint16) *Record

func (*Record) Uint16s

func (r *Record) Uint16s(key string, vals ...uint16) *Record

func (*Record) Uint32

func (r *Record) Uint32(key string, val uint32) *Record

func (*Record) Uint32s

func (r *Record) Uint32s(key string, vals ...uint32) *Record

func (*Record) Uint64

func (r *Record) Uint64(key string, val uint64) *Record

func (*Record) Uint64s

func (r *Record) Uint64s(key string, vals ...uint64) *Record

func (*Record) Uints

func (r *Record) Uints(key string, vals ...uint) *Record

func (*Record) UseIntDur

func (r *Record) UseIntDur() *Record

UseIntDur enables the calculation of Duration to retain only integer digits.

func (*Record) WithCallerSkip

func (r *Record) WithCallerSkip(skip int) *Record

WithCallerSkip adds skip frames when calling caller.

func (*Record) WithDoneFunc

func (r *Record) WithDoneFunc(f func(msg string)) *Record

func (*Record) WithLabels added in v0.0.2

func (r *Record) WithLabels(label ...string) *Record

WithLabels sets the labels for the Logger using one or more strings. The labels are joined using the "|" separator.

func (*Record) WithLevel

func (r *Record) WithLevel(lv level.Level) *Record

WithLevel sets the level as the META_LEVEL field.

type RecordPackerForWriter

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

func (*RecordPackerForWriter) Any added in v0.0.2

func (j *RecordPackerForWriter) Any(key string, i any)

func (*RecordPackerForWriter) Bytes

func (j *RecordPackerForWriter) Bytes(key string, val []byte)

func (*RecordPackerForWriter) CallerSkip

func (j *RecordPackerForWriter) CallerSkip(skip int)

func (*RecordPackerForWriter) Done

func (j *RecordPackerForWriter) Done()

func (*RecordPackerForWriter) Dur

func (j *RecordPackerForWriter) Dur(key string, unit, val time.Duration)

func (*RecordPackerForWriter) Durs

func (j *RecordPackerForWriter) Durs(key string, unit time.Duration, vals ...time.Duration)

func (*RecordPackerForWriter) Err

func (j *RecordPackerForWriter) Err(err error)

func (*RecordPackerForWriter) Float32

func (j *RecordPackerForWriter) Float32(key string, val float32)

func (*RecordPackerForWriter) Float32s

func (j *RecordPackerForWriter) Float32s(key string, vals ...float32)

func (*RecordPackerForWriter) Float64

func (j *RecordPackerForWriter) Float64(key string, val float64)

func (*RecordPackerForWriter) Float64s

func (j *RecordPackerForWriter) Float64s(key string, vals ...float64)

func (*RecordPackerForWriter) Hex

func (j *RecordPackerForWriter) Hex(key string, val []byte)

func (*RecordPackerForWriter) IPAddr

func (j *RecordPackerForWriter) IPAddr(key string, ip net.IP)

func (*RecordPackerForWriter) IPPrefix

func (j *RecordPackerForWriter) IPPrefix(key string, pfx net.IPNet)

func (*RecordPackerForWriter) Int

func (j *RecordPackerForWriter) Int(key string, val int)

func (*RecordPackerForWriter) Int8

func (j *RecordPackerForWriter) Int8(key string, val int8)

func (*RecordPackerForWriter) Int8s

func (j *RecordPackerForWriter) Int8s(key string, vals ...int8)

func (*RecordPackerForWriter) Int16

func (j *RecordPackerForWriter) Int16(key string, val int16)

func (*RecordPackerForWriter) Int16s

func (j *RecordPackerForWriter) Int16s(key string, vals ...int16)

func (*RecordPackerForWriter) Int32

func (j *RecordPackerForWriter) Int32(key string, val int32)

func (*RecordPackerForWriter) Int32s

func (j *RecordPackerForWriter) Int32s(key string, vals ...int32)

func (*RecordPackerForWriter) Int64

func (j *RecordPackerForWriter) Int64(key string, val int64)

func (*RecordPackerForWriter) Int64s

func (j *RecordPackerForWriter) Int64s(key string, vals ...int64)

func (*RecordPackerForWriter) Ints

func (j *RecordPackerForWriter) Ints(key string, vals ...int)

func (*RecordPackerForWriter) MACAddr

func (j *RecordPackerForWriter) MACAddr(key string, ha net.HardwareAddr)

func (*RecordPackerForWriter) Msg

func (j *RecordPackerForWriter) Msg(msg string)

func (*RecordPackerForWriter) Reset

func (j *RecordPackerForWriter) Reset()

func (*RecordPackerForWriter) Str

func (j *RecordPackerForWriter) Str(key, val string)

func (*RecordPackerForWriter) Stringer

func (j *RecordPackerForWriter) Stringer(key string, val fmt.Stringer)

func (*RecordPackerForWriter) Stringers

func (j *RecordPackerForWriter) Stringers(key string, vals ...fmt.Stringer)

func (*RecordPackerForWriter) Strs

func (j *RecordPackerForWriter) Strs(key string, vals ...string)

func (*RecordPackerForWriter) Time

func (j *RecordPackerForWriter) Time(key, fmt string, val time.Time)

func (*RecordPackerForWriter) Times

func (j *RecordPackerForWriter) Times(key, fmt string, vals ...time.Time)

func (*RecordPackerForWriter) Uint

func (j *RecordPackerForWriter) Uint(key string, val uint)

func (*RecordPackerForWriter) Uint8

func (j *RecordPackerForWriter) Uint8(key string, val uint8)

func (*RecordPackerForWriter) Uint8s

func (j *RecordPackerForWriter) Uint8s(key string, vals ...uint8)

func (*RecordPackerForWriter) Uint16

func (j *RecordPackerForWriter) Uint16(key string, val uint16)

func (*RecordPackerForWriter) Uint16s

func (j *RecordPackerForWriter) Uint16s(key string, vals ...uint16)

func (*RecordPackerForWriter) Uint32

func (j *RecordPackerForWriter) Uint32(key string, val uint32)

func (*RecordPackerForWriter) Uint32s

func (j *RecordPackerForWriter) Uint32s(key string, vals ...uint32)

func (*RecordPackerForWriter) Uint64

func (j *RecordPackerForWriter) Uint64(key string, val uint64)

func (*RecordPackerForWriter) Uint64s

func (j *RecordPackerForWriter) Uint64s(key string, vals ...uint64)

func (*RecordPackerForWriter) Uints

func (j *RecordPackerForWriter) Uints(key string, vals ...uint)

type WriterEncoderPair

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

WriterEncoderPair wraps a writer and an encoder.

Directories

Path Synopsis
internal
Package log provides the definition and initialization operation of a global rainbow logger.
Package log provides the definition and initialization operation of a global rainbow logger.

Jump to

Keyboard shortcuts

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