Module: ContextLogger
- Defined in:
- lib/context_logger.rb,
lib/context_logger/engine.rb
Defined Under Namespace
Classes: Engine
Constant Summary collapse
- SEVERITY_TYPES =
[:info, :warn, :error, :debug, :unknown, :fatal]
- DEFAULTS =
{ context: :context_log, # action_id: nil, # server_name: nil, # method: nil, # params: nil, message: 'Empty message', # stack_trace: nil }
- ALL_DESTINATIONS =
{ write_rails_log: true, write_context_log: true, write_db_log: true }
Class Method Summary collapse
- .destinations ⇒ Object
- .logs_folder ⇒ Object
- .options ⇒ Object
- .set_destinations(_destinations) ⇒ Object
- .setup(options) ⇒ Object
Class Method Details
.destinations ⇒ Object
51 52 53 |
# File 'lib/context_logger.rb', line 51 def self.destinations return @destinations end |
.logs_folder ⇒ Object
55 56 57 58 |
# File 'lib/context_logger.rb', line 55 def self.logs_folder # TODO: set the path from config @logs_folder ||= "#{Rails.root}/log" end |
.options ⇒ Object
38 39 40 |
# File 'lib/context_logger.rb', line 38 def self. return @options end |
.set_destinations(_destinations) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/context_logger.rb', line 42 def self.set_destinations(_destinations) if _destinations == :all @destinations = ALL_DESTINATIONS.clone return end @destinations = _destinations.select{|k, _| ALL_DESTINATIONS[k]} end |
.setup(options) ⇒ Object
34 35 36 |
# File 'lib/context_logger.rb', line 34 def self.setup() @options = (@options || {}).merge() end |