Module: OmniauthOidc::Logging

Defined in:
lib/omniauth/oidc/logging.rb

Overview

Logging module providing both Ruby Logger and ActiveSupport::Notifications support

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject



11
12
13
# File 'lib/omniauth/oidc/logging.rb', line 11

def logger
  @logger ||= default_logger
end

Class Method Details

.debug(message, context = {}) ⇒ Object



33
34
35
# File 'lib/omniauth/oidc/logging.rb', line 33

def debug(message, context = {})
  log(:debug, message, context)
end

.error(message, context = {}) ⇒ Object



45
46
47
# File 'lib/omniauth/oidc/logging.rb', line 45

def error(message, context = {})
  log(:error, message, context)
end

.info(message, context = {}) ⇒ Object



37
38
39
# File 'lib/omniauth/oidc/logging.rb', line 37

def info(message, context = {})
  log(:info, message, context)
end

.instrument(event_name, payload = {}, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/omniauth/oidc/logging.rb', line 19

def instrument(event_name, payload = {}, &block)
  full_event_name = "#{event_name}.omniauth_oidc"

  # Always log the event
  log_event(event_name, payload)

  # Use ActiveSupport::Notifications if available
  if defined?(ActiveSupport::Notifications)
    ActiveSupport::Notifications.instrument(full_event_name, payload, &block)
  elsif block
    yield payload
  end
end

.log_level=(level) ⇒ Object



15
16
17
# File 'lib/omniauth/oidc/logging.rb', line 15

def log_level=(level)
  logger.level = level
end

.warn(message, context = {}) ⇒ Object



41
42
43
# File 'lib/omniauth/oidc/logging.rb', line 41

def warn(message, context = {})
  log(:warn, message, context)
end