Documentation ¶
Overview ¶
Package log provides logging utilities for S&D and makes it possible to hook into the logging to save the logs somewhere else.
Index ¶
- Constants
- func AddHook(fn func(e Entry))
- func Error(err error, values ...Value) error
- func ErrorString(err string, values ...Value) error
- func ErrorUser(err error, userError string, values ...Value) error
- func Info(text string, values ...Value)
- func SetOutput(writer io.Writer)
- type Entry
- type Level
- type Value
Constants ¶
View Source
const ( LevelError = Level("ERROR") LevelInfo = Level("INFO") )
Variables ¶
This section is empty.
Functions ¶
func AddHook ¶
func AddHook(fn func(e Entry))
AddHook adds a hook that will be called with each log entry that gets created.
func ErrorString ¶
ErrorString logs the error with the given values and returns a new err with string as it's content.
Types ¶
type Entry ¶
type Entry struct { Level Level `json:"level"` Time time.Time `json:"time"` Text string `json:"text"` Caller string `json:"caller"` Values []Value `json:"values"` }
Entry represents a single log entry.
Click to show internal directories.
Click to hide internal directories.