zerologadapter

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package zerologadapter provides a zerolog adapter for onelog. See _examples/ for usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdapter

func NewAdapter(l *zerolog.Logger) onelog.Logger

NewAdapter creates a new zerolog adapter for onelog.

Types

type Adapter

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

Adapter is a zerolog adapter for onelog. It implements the onelog.Logger interface.

func (*Adapter) Debug

func (a *Adapter) Debug() onelog.LoggerContext

Debug returns a LoggerContext for a debug log. To send the log, use the Msg or Msgf methods.

func (*Adapter) Error

func (a *Adapter) Error() onelog.LoggerContext

Error returns a LoggerContext for a error log. To send the log, use the Msg or Msgf methods.

func (*Adapter) Fatal

func (a *Adapter) Fatal() onelog.LoggerContext

Fatal returns a LoggerContext for a fatal log. To send the log, use the Msg or Msgf methods.

func (*Adapter) Info

func (a *Adapter) Info() onelog.LoggerContext

Info returns a LoggerContext for a info log. To send the log, use the Msg or Msgf methods.

func (*Adapter) Warn

func (a *Adapter) Warn() onelog.LoggerContext

Warn returns a LoggerContext for a warn log. To send the log, use the Msg or Msgf methods.

func (*Adapter) With added in v0.6.0

func (a *Adapter) With(fields ...any) onelog.Logger

With returns the logger with the given fields.

type Context

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

Context is the zerolog logging context. It implements the onelog.LoggerContext interface.

func (*Context) AnErr

func (c *Context) AnErr(key string, err error) onelog.LoggerContext

AnErr adds the field key with err as a error to the logger context.

func (*Context) Any

func (c *Context) Any(key string, value any) onelog.LoggerContext

Any adds the field key with val as a arbitrary value to the logger context.

func (*Context) Bool

func (c *Context) Bool(key string, value bool) onelog.LoggerContext

Bool adds the field key with b as a bool to the logger context.

func (*Context) Bools

func (c *Context) Bools(key string, value []bool) onelog.LoggerContext

Bools adds the field key with b as a []bool to the logger context.

func (*Context) Bytes added in v0.5.0

func (c *Context) Bytes(key string, value []byte) onelog.LoggerContext

Bytes adds the field key with val as a []byte to the logger context.

func (*Context) Dur

func (c *Context) Dur(key string, value time.Duration) onelog.LoggerContext

Dur adds the field key with d as a time.Duration to the logger context.

func (*Context) Durs

func (c *Context) Durs(key string, value []time.Duration) onelog.LoggerContext

Durs adds the field key with d as a []time.Duration to the logger context.

func (*Context) Err

func (c *Context) Err(err error) onelog.LoggerContext

Err adds the field "error" with err as a error to the logger context.

func (*Context) Errs

func (c *Context) Errs(key string, errs []error) onelog.LoggerContext

Errs adds the field key with errs as a []error to the logger context.

func (*Context) Fields

func (c *Context) Fields(fields onelog.Fields) onelog.LoggerContext

Fields adds the fields to the logger context.

func (*Context) Float32

func (c *Context) Float32(key string, value float32) onelog.LoggerContext

Float32 adds the field key with f as a float32 to the logger context.

func (*Context) Float64

func (c *Context) Float64(key string, value float64) onelog.LoggerContext

Float64 adds the field key with f as a float64 to the logger context.

func (*Context) Floats32

func (c *Context) Floats32(key string, value []float32) onelog.LoggerContext

Floats32 adds the field key with f as a []float32 to the logger context.

func (*Context) Floats64

func (c *Context) Floats64(key string, value []float64) onelog.LoggerContext

Floats64 adds the field key with f as a []float64 to the logger context.

func (*Context) Hex added in v0.5.0

func (c *Context) Hex(key string, value []byte) onelog.LoggerContext

Hex adds the field key with val as a hex string to the logger context.

func (*Context) IPAddr

func (c *Context) IPAddr(key string, value net.IP) onelog.LoggerContext

IPAddr adds the field key with ip as a net.IP to the logger context.

func (*Context) IPPrefix

func (c *Context) IPPrefix(key string, value net.IPNet) onelog.LoggerContext

IPPrefix adds the field key with ip as a net.IPNet to the logger context.

func (*Context) Int

func (c *Context) Int(key string, value int) onelog.LoggerContext

Int adds the field key with i as a int to the logger context.

func (*Context) Int16

func (c *Context) Int16(key string, value int16) onelog.LoggerContext

Int16 adds the field key with i as a int16 to the logger context.

func (*Context) Int32

func (c *Context) Int32(key string, value int32) onelog.LoggerContext

Int32 adds the field key with i as a int32 to the logger context.

func (*Context) Int64

func (c *Context) Int64(key string, value int64) onelog.LoggerContext

Int64 adds the field key with i as a int64 to the logger context.

func (*Context) Int8

func (c *Context) Int8(key string, value int8) onelog.LoggerContext

Int8 adds the field key with i as a int8 to the logger context.

func (*Context) Ints

func (c *Context) Ints(key string, value []int) onelog.LoggerContext

Ints adds the field key with i as a []int to the logger context.

func (*Context) Ints16

func (c *Context) Ints16(key string, value []int16) onelog.LoggerContext

Ints16 adds the field key with i as a []int16 to the logger context.

func (*Context) Ints32

func (c *Context) Ints32(key string, value []int32) onelog.LoggerContext

Ints32 adds the field key with i as a []int32 to the logger context.

func (*Context) Ints64

func (c *Context) Ints64(key string, value []int64) onelog.LoggerContext

Ints64 adds the field key with i as a []int64 to the logger context.

func (*Context) Ints8

func (c *Context) Ints8(key string, value []int8) onelog.LoggerContext

Ints8 adds the field key with i as a []int8 to the logger context.

func (*Context) MACAddr

func (c *Context) MACAddr(key string, value net.HardwareAddr) onelog.LoggerContext

MACAddr adds the field key with ip as a net.HardwareAddr to the logger context.

func (*Context) Msg

func (c *Context) Msg(msg string)

Msg sends the LoggerContext with msg to the logger.

func (*Context) Msgf

func (c *Context) Msgf(format string, v ...any)

Msgf sends the LoggerContext with formatted msg to the logger.

func (*Context) RawJSON added in v0.5.0

func (c *Context) RawJSON(key string, value []byte) onelog.LoggerContext

RawJSON adds the field key with val as a json.RawMessage to the logger context.

func (*Context) Str

func (c *Context) Str(key, value string) onelog.LoggerContext

Str adds the field key with val as a string to the logger context.

func (*Context) Stringer added in v0.4.0

func (c *Context) Stringer(key string, val fmt.Stringer) onelog.LoggerContext

Stringer adds the field key with val as a fmt.Stringer to the logger context.

func (*Context) Stringers added in v0.4.0

func (c *Context) Stringers(key string, vals []fmt.Stringer) onelog.LoggerContext

Stringers adds the field key with val as a []fmt.Stringer to the logger context.

func (*Context) Strs

func (c *Context) Strs(key string, value []string) onelog.LoggerContext

Strs adds the field key with val as a []string to the logger context.

func (*Context) Time

func (c *Context) Time(key string, value time.Time) onelog.LoggerContext

Time adds the field key with t as a time.Time to the logger context.

func (*Context) TimeDiff added in v0.3.0

func (c *Context) TimeDiff(key string, begin, end time.Time) onelog.LoggerContext

TimeDiff adds the field key with begin and end as a time.Time to the logger context.

func (*Context) Times

func (c *Context) Times(key string, value []time.Time) onelog.LoggerContext

Times adds the field key with t as a []time.Time to the logger context.

func (*Context) Uint

func (c *Context) Uint(key string, value uint) onelog.LoggerContext

Uint adds the field key with i as a uint to the logger context.

func (*Context) Uint16

func (c *Context) Uint16(key string, value uint16) onelog.LoggerContext

Uint16 adds the field key with i as a uint16 to the logger context.

func (*Context) Uint32

func (c *Context) Uint32(key string, value uint32) onelog.LoggerContext

Uint32 adds the field key with i as a uint32 to the logger context.

func (*Context) Uint64

func (c *Context) Uint64(key string, value uint64) onelog.LoggerContext

Uint64 adds the field key with i as a uint64 to the logger context.

func (*Context) Uint8

func (c *Context) Uint8(key string, value uint8) onelog.LoggerContext

Uint8 adds the field key with i as a uint8 to the logger context.

func (*Context) Uints

func (c *Context) Uints(key string, value []uint) onelog.LoggerContext

Uints adds the field key with i as a []uint to the logger context.

func (*Context) Uints16

func (c *Context) Uints16(key string, value []uint16) onelog.LoggerContext

Uints16 adds the field key with i as a []uint16 to the logger context.

func (*Context) Uints32

func (c *Context) Uints32(key string, value []uint32) onelog.LoggerContext

Uints32 adds the field key with i as a []uint32 to the logger context.

func (*Context) Uints64

func (c *Context) Uints64(key string, value []uint64) onelog.LoggerContext

Uints64 adds the field key with i as a []uint64 to the logger context.

func (*Context) Uints8

func (c *Context) Uints8(key string, value []uint8) onelog.LoggerContext

Uints8 adds the field key with i as a []uint8 to the logger context.

Jump to

Keyboard shortcuts

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