Releases: tomakado/logo
Releases · tomakado/logo
v1.0.0
The first version is the base of library.
Basic features
- Logging with verbose and important levels;
- Adding extra to events;
- Logging messages formatted with
fmt.Sprintf
; - Custom logging levels.
Event Formatting
Formatter
interface to implement custom formatters;JSONFormatter
(used by default);- Pre-made formatters:
TableTextFormatter
— table-like formatter;SimpleTextFormatter
;
TemplateFormatter
that uses Go's template standard library to render event layout.
Hooks
- Event hooks — functions called before and after event was logged;
- Pre-made hooks (consider mostly as examples):
ExitOnImportant
— callsos.Exit(1)
if event level ≥IMPORTANT
(log.LevelImportant
);EventID
— puts UUID into extra's fieldevent_id
;
- Hook filters, also a couple of pre-made ones:
LevelFilter
— run hook on events with level ≥ given level;LevelBoundsFilter
— run hook on events with level that belongs to given bounds (inclusive);FilteredHook
— function that wraps regular hook to hook with filter.