log

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEvents

func SetEvents(cls ...Event)

SetEvents is used to control which events are written to the log. By default all log events are writen.

func SetListener

func SetListener(lst func(Event, string))

SetListener will set the Logger to write to the specified listener.

func Should

func Should(cls Event) bool

Should returns true if the specified log event should be written to the log. By default all log events will be logged. Call SetEvents() to limit the log events for logging. If no listener has been set this will return false. Calling this method is useful when the message to log is computationally expensive and you want to avoid the overhead if its log event is not enabled.

func TestResetEvents

func TestResetEvents()

TestResetEvents is used for TESTING PURPOSES ONLY.

func Write

func Write(cls Event, message string)

Write invokes the underlying listener with the specified event and message. If the event shouldn't be logged or there is no listener then Write does nothing.

func Writef

func Writef(cls Event, format string, a ...interface{})

Writef invokes the underlying listener with the specified event and formatted message. If the event shouldn't be logged or there is no listener then Writef does nothing.

Types

type Event

type Event string

Event is used to group entries. Each group can be toggled on or off.

Jump to

Keyboard shortcuts

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