Documentation
¶
Index ¶
- type Event
- func (e *Event) Array(k string, v *zerolog.Array) IEvent
- func (e *Event) Bytes(k string, bb []byte) IEvent
- func (e *Event) Caller() IEvent
- func (e *Event) Dict(k string, v *zerolog.Event) IEvent
- func (e *Event) ILogger() ILogger
- func (e *Event) Inactive() IEvent
- func (e *Event) Int(k string, v int) IEvent
- func (e *Event) Msgtag(msgtag *Msgtag, ss ...string) IEvent
- func (e *Event) RawJSON(k string, rj []byte) IEvent
- func (e *Event) RequestId(s string) IEvent
- func (e *Event) Send()
- func (e *Event) SendMsg(s string)
- func (e *Event) SendMsgf(s string, vv ...any)
- func (e *Event) SendTitle(s string)
- func (e *Event) Str(k, v string) IEvent
- func (e *Event) Strs(k string, vv []string) IEvent
- func (e *Event) SubSystem(s string) IEvent
- func (e *Event) Time(k string, t time.Time) IEvent
- func (e *Event) Title(s string) IEvent
- type IEvent
- type ILogger
- type Logger
- func (l *Logger) AddUO(uo any) ILogger
- func (l *Logger) DebugEvent() (e IEvent)
- func (l *Logger) ErrEvent(err error) (e IEvent)
- func (l *Logger) ErrorEvent() (e IEvent)
- func (l *Logger) GetNutzLogger() *Logger
- func (l *Logger) GetZeroLoggerPtr() *zerolog.Logger
- func (l *Logger) InfoEvent() (e IEvent)
- func (l *Logger) SetLevel(level zerolog.Level) ILogger
- func (l *Logger) SubLoggerInitChain() IEvent
- func (l *Logger) TraceEvent() (e IEvent)
- func (l *Logger) WarnEvent() (e IEvent)
- type Msgtag
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ParentLogger *Logger
IsInactive bool // per event
TheLevel string // per event
TheMsgtag Msgtag // per event
TheTitle string // per event
// contains filtered or unexported fields
}
func (*Event) Inactive ¶ added in v1.17.0
Inactivation applies to real events only, all data set ops will be bypassed. However, if applied to sub-logger init chain, nothing is bypassed.
func (*Event) Msgtag ¶
Some first strings are reported to metrics, be careful to NOT put in them high-cardinality IDs. Doesn't apply to sub-logger init chains, must be set per each event individually. If the ActicationHook is set, it is called, and it can reactivate the event.
type IEvent ¶
type IEvent interface {
Inactive() IEvent
Caller() IEvent
Str(string, string) IEvent
Strs(string, []string) IEvent
Time(string, time.Time) IEvent
Int(string, int) IEvent
Array(k string, v *zerolog.Array) (e IEvent)
Dict(k string, v *zerolog.Event) (e IEvent)
SendMsgf(string, ...any)
SendMsg(string)
Title(string) IEvent
SendTitle(string)
Msgtag(msgtag *Msgtag, ss ...string) IEvent
SubSystem(string) IEvent
RequestId(string) IEvent
RawJSON(string, []byte) IEvent
Bytes(string, []byte) IEvent
Send()
ILogger() ILogger
}
type Logger ¶
type Logger struct {
Settings *Settings
IsInactive bool // per whole logger instance
TheSubsystem string // per logger
UserObject any
// contains filtered or unexported fields
}
func New ¶
An initial zerologger must be provided by yours explicitly. Typical idiom:
import(
"github.com/rs/zerolog/log"
)
...
my.Logger = logger.New(&log.Logger, func(s *logger.Settings) {
s.PanicOnMisuse = false
})
func (*Logger) AddUO ¶ added in v1.18.0
Attach any user object to the event object, to be used later inside the callback hooks. Intended to pass user-level runtime data to the hook(s). Doesn't add anything to the logline serializations. Normally, the UO must be a pointer, and at the receiving side in the hook you do something along the lines:
myObject, _ := e.ParentLogger.UserObject.(*MyObject)
if myObject != nil {
...
}
func (*Logger) DebugEvent ¶ added in v1.17.0
func (*Logger) ErrorEvent ¶ added in v1.17.0
func (*Logger) GetNutzLogger ¶ added in v1.16.0
This is useful to access Settings later after init.
func (*Logger) GetZeroLoggerPtr ¶
func (*Logger) SubLoggerInitChain ¶
Can be used if you intend to call ILogger() on it later. By default, all new sub-loggers are active, even if parent was inactivated.
func (*Logger) TraceEvent ¶ added in v1.17.0
type Msgtag ¶
type Msgtag []string
Few first strings are reported to metrics, be careful to NOT put in them high-cardinality IDs.