Module: IuguLogger::Schema

Defined in:
lib/iugu_logger/schema.rb

Overview

event.action registry validator.

Loads a compiled event.action registry (‘dist/registry.json`) and validates each `event.action` emitted against it.

Three modes:

:strict — raise IuguLogger::UnknownEventAction / SchemaViolation
:warn   — annotate the emitted log with `labels.schema_warning` and proceed
:off    — disable validation (default — backward compatible)

When validation passes and the registry definition declares an ‘event_kind` (e.g. `pix.out.executed` is audit-class), the validator surfaces it so the Logger can override the caller’s default.

Spec: IUGU_LOGGING_STANDARD.md §4

Defined Under Namespace

Classes: Result, Validator

Constant Summary collapse

STRICT =
:strict
WARN =
:warn
OFF =
:off
DEFAULT_MODE =
OFF
VALID_MODES =
[STRICT, WARN, OFF].freeze
SUGGESTION_LIMIT =
3
SUGGESTION_MAX_DISTANCE =

cap, otherwise unrelated names show up

6

Class Method Summary collapse

Class Method Details

.load_from_file(path) ⇒ Object

Loads a registry.json from a path on disk. Errors fail loud — registry loading is dev-time configuration, not runtime.



34
35
36
# File 'lib/iugu_logger/schema.rb', line 34

def self.load_from_file(path)
  JSON.parse(File.read(path))
end