Module: IuguLogger

Defined in:
lib/iugu_logger.rb,
lib/iugu_logger/pii.rb,
lib/iugu_logger/buffer.rb,
lib/iugu_logger/logger.rb,
lib/iugu_logger/schema.rb,
lib/iugu_logger/railtie.rb,
lib/iugu_logger/version.rb,
lib/iugu_logger/severity.rb,
lib/iugu_logger/job_logger.rb,
lib/iugu_logger/smoke_test.rb,
lib/iugu_logger/configuration.rb,
lib/iugu_logger/trace_context.rb,
lib/iugu_logger/request_logger.rb,
lib/iugu_logger/tenant_context.rb,
lib/generators/iugu_logger/install/install_generator.rb

Overview

Loaded conditionally from lib/iugu_logger.rb only when ::Rails::Railtie is defined (i.e. Rails is on the load path). Apps without Rails ignore this file.

Defined Under Namespace

Modules: Generators, JobLogger, Pii, Schema, Severity, SmokeTest, TenantContext, TraceContext Classes: Buffer, Configuration, ConfigurationError, Error, Logger, Railtie, RequestLogger, SchemaViolation, UnknownEventAction

Constant Summary collapse

VERSION =
'0.11.0'
SUPPORTED_SCHEMA_VERSION =

Canonical schema version this SDK is built against. MUST match the version of the vendored snapshot at spec/conformance/fixtures/canonical_schema.json — the schema_version_spec asserts this, and the schema-freshness CI compares it against the latest release of iugu-private/iugu-logging-schema.

Bump this ONLY via rake iugu_logger:sync_schema (or the schema-sync workflow), never by hand. Schema changes upstream FIRST, the SDK syncs AFTER. See CONTRIBUTING / IUGU_LOGGING_STANDARD.md §4.

'2.0.0'

Class Method Summary collapse

Class Method Details

.configurationObject



50
51
52
# File 'lib/iugu_logger.rb', line 50

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields the configuration object for setup.

Yields:



45
46
47
48
# File 'lib/iugu_logger.rb', line 45

def configure
  yield(configuration) if block_given?
  configuration
end

.event(action, **fields) ⇒ Object

Convenience proxy to logger.event(...).



60
61
62
# File 'lib/iugu_logger.rb', line 60

def event(action, **fields)
  logger.event(action, **fields)
end

.loggerObject

The shared singleton logger. Lazy-instantiated.



55
56
57
# File 'lib/iugu_logger.rb', line 55

def logger
  @logger ||= Logger.new(configuration)
end

.reset!Object

Resets configuration and logger. For tests / repl only.



65
66
67
68
# File 'lib/iugu_logger.rb', line 65

def reset!
  @configuration = nil
  @logger = nil
end