Class: OxyLogger::LogRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/oxy_logger/log_record.rb

Instance Method Summary collapse

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_nameObject



17
18
19
# File 'lib/oxy_logger/log_record.rb', line 17

def file_name
  @data[:class_name] + '.log'
end

#for_dbObject



13
14
15
# File 'lib/oxy_logger/log_record.rb', line 13

def for_db
  @data.except(:save_to, :type)
end

#for_fileObject



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_toObject



9
10
11
# File 'lib/oxy_logger/log_record.rb', line 9

def save_to
  @data[:save_to]
end