Class: OxyLogger::LogRecord
- Inherits:
-
Object
- Object
- OxyLogger::LogRecord
- Defined in:
- lib/oxy_logger/log_record.rb
Instance Method Summary collapse
- #file_name ⇒ Object
- #for_db ⇒ Object
- #for_file ⇒ Object
-
#initialize(data) ⇒ LogRecord
constructor
A new instance of LogRecord.
- #save_to ⇒ Object
Constructor Details
#initialize(data) ⇒ LogRecord
Returns a new instance of LogRecord.
5 6 7 |
# File 'lib/oxy_logger/log_record.rb', line 5 def initialize(data) @data = data end |
Instance Method Details
#file_name ⇒ Object
17 18 19 |
# File 'lib/oxy_logger/log_record.rb', line 17 def file_name @data[:class_name] + '.log' end |
#for_db ⇒ Object
13 14 15 |
# File 'lib/oxy_logger/log_record.rb', line 13 def for_db @data.except(:save_to, :type) end |
#for_file ⇒ Object
21 22 23 24 25 26 |
# File 'lib/oxy_logger/log_record.rb', line 21 def for_file text = @data.slice(OxyLogger.logget_data) Mustache.template_file = "#{__dir__}/template.mustache" str = Mustache.render(@data) str end |
#save_to ⇒ Object
9 10 11 |
# File 'lib/oxy_logger/log_record.rb', line 9 def save_to @data[:save_to] end |