Module: RfLogger

Extended by:
Forwardable
Defined in:
lib/rf_logger.rb,
lib/rf_logger/levels.rb,
lib/rf_logger/version.rb,
lib/rf_logger/sequel/base.rb,
lib/rf_logger/configuration.rb,
lib/rf_logger/sequel/logger.rb,
lib/rf_logger/simple_logger.rb,
lib/rf_logger/active_record/logger.rb,
lib/rf_logger/log_for_notification.rb,
lib/rf_logger/request/request_tags.rb,
lib/rf_logger/request/request_headers.rb,
lib/rf_logger/rails/rails_compatibility.rb,
lib/rf_logger/request/request_middleware.rb,
lib/rf_logger/notifications/error_notification.rb,
lib/rf_logger/rails/initialize_request_middleware.rb,
lib/rf_logger/notifications/error_notification_environment_constraints.rb

Defined Under Namespace

Modules: ActiveRecord, RequestTags, Sequel Classes: Configuration, ErrorNotification, InitializeRequestMiddleware, LogForNotification, RailsCompatibility, RequestHeaders, RequestMiddleware, SimpleLogger, UndefinedSetting

Constant Summary collapse

LEVELS =
[
  :debug, # dev-only, for exploring issues
  :info , # end users, to audit process
  :warn , # weird thing happened, but isn't really an issue
  :error, # someone fix the code
  :fatal, # system-wide errors
]
VERSION =
"0.4.0"
SequelLogger =
RfLogger::Sequel::Logger
RailsLogger =
RfLogger::ActiveRecord::Logger

Class Method Summary collapse

Class Method Details

.clear_configuration!Object



34
35
36
# File 'lib/rf_logger/sequel/base.rb', line 34

def clear_configuration!
  @configuration = nil
end

.configurationObject



23
24
25
# File 'lib/rf_logger/sequel/base.rb', line 23

def configuration
  @configuration ||= RfLogger::Configuration.new
end

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

Yields:



27
28
29
30
31
32
# File 'lib/rf_logger/sequel/base.rb', line 27

def configure(&block)
  unless block
    raise ArgumentError.new("You tried to .configure without a block!")
  end
  yield configuration
end

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

Yields:



38
39
40
41
42
43
44
# File 'lib/rf_logger/sequel/base.rb', line 38

def configure!(&block)
  unless block
    raise ArgumentError.new('You tried to .configure without a block!')
  end
  clear_configuration!
  yield configuration
end

.try_to_load(file) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/rf_logger.rb', line 4

def self.try_to_load(file)
  begin
    require file
    puts "RfLogger: Detected #{file}." if ENV["RF_LOGGER_LOAD_DEBUG"]
    yield
  rescue LoadError => e
    puts "RfLogger: #{file} not detected.\n\t#{e.to_s}" if ENV["RF_LOGGER_LOAD_DEBUG"]
  end
end