Module: Kirei::Logging

Defined in:
lib/kirei/logging/logger.rb,
lib/kirei/logging/level.rb,
lib/kirei/logging/metric.rb

Overview

Example Usage:

Kirei::Logging::Logger.call(
  level: Kirei::Logging::Level::INFO,
  label: "Request started",
  meta: {
    key: "value",
  },
)

You can define a custom log transformer to transform the logline:

Kirei::App.config.log_transformer = Proc.new { _1 }

By default, “meta” is flattened, and sensitive values are masked using sane defaults that you can finetune via ‘Kirei::App.config.sensitive_keys`.

You can also build on top of the provided log transformer:

Kirei::App.config.log_transformer = Proc.new do |meta|
   flattened_meta = Kirei::Logging::Logger.flatten_hash_and_mask_sensitive_values(meta)
   # Do something with the flattened meta
   flattened_meta.map { _1.to_json }
end

NOTE:

* The log transformer must return an array of strings to allow emitting multiple lines per log event.
* Whenever possible, key names follow OpenTelemetry Semantic Conventions, https://opentelemetry.io/docs/concepts/semantic-conventions/

Defined Under Namespace

Classes: Level, Logger, Metric