Skip to content

v1.0.0

Latest
Compare
Choose a tag to compare
@tomakado tomakado released this 11 Mar 22:44
· 5 commits to main since this release

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 — calls os.Exit(1) if event level ≥ IMPORTANT (log.LevelImportant);
    • EventID — puts UUID into extra's field event_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.