Module: ActiveAttr::Logger

Extended by:
ActiveSupport::Concern
Included in:
Model
Defined in:
lib/active_attr/logger.rb

Overview

Provides access to a configurable logger in model classes and instances

Examples:

Usage

class Person
  include ActiveAttr::Logger
end

Since:

  • 0.3.0

Class Method Summary collapse

Class Method Details

.loggernil, Object

The global default logger

Since:

  • 0.3.0



21
22
23
# File 'lib/active_attr/logger.rb', line 21

def self.logger
  @logger ||= nil
end

.logger=(new_logger) ⇒ Object

Configure the global default logger

Since:

  • 0.3.0



30
31
32
# File 'lib/active_attr/logger.rb', line 30

def self.logger=(new_logger)
  @logger = new_logger
end

.logger?Boolean

Determine if a global default logger is configured

Since:

  • 0.3.0



37
38
39
# File 'lib/active_attr/logger.rb', line 37

def self.logger?
  !!logger
end