GitHoox.Logger (GitHoox v0.3.0)

Copy Markdown View Source

Reference :telemetry handler that logs GitHoox events via Logger.

Attach during application start or before invoking hooks:

GitHoox.Logger.attach()

Detach with GitHoox.Logger.detach/0. The handler is opt-in; GitHoox does not attach it for you.

Log lines look like:

[git_hoox] pre_commit  ok (2 hooks, 3 files, 240ms)
[git_hoox]   GitHoox.Hooks.Format  ok (240ms)
[git_hoox]   GitHoox.Hooks.Credo  error (1.5s) reason: {1, "..."}

Levels:

  • stage events log at :info on success and :warning on failure
  • hook events log at :debug on success/skip and :warning on failure

Summary

Functions

Attach the handler.

Detach the handler. Safe to call when not attached.

Functions

attach()

@spec attach() :: :ok | {:error, :already_exists}

Attach the handler.

detach()

@spec detach() :: :ok | {:error, :not_found}

Detach the handler. Safe to call when not attached.