Class: Plogger::Formatter
- Inherits:
-
Object
- Object
- Plogger::Formatter
- Defined in:
- lib/plogger/formatter.rb
Class Method Summary collapse
- .add_param_to_message(message, key, value) ⇒ Object
- .format(message, trace, type: 'system', user_id: nil, account_id: nil, category: '', extra_info: {}) ⇒ Object
Class Method Details
.add_param_to_message(message, key, value) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/plogger/formatter.rb', line 16 def self.(, key, value) result = is_string = value.class == String result += " #{key}=#{is_string ? "'" : ''}#{value}#{is_string ? "'" : ''}" result end |
.format(message, trace, type: 'system', user_id: nil, account_id: nil, category: '', extra_info: {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/plogger/formatter.rb', line 3 def self.format(, trace, type: 'system', user_id: nil, account_id: nil, category: '', extra_info: {}) result = "#{} -- trace='#{trace}'" args = {type: type, category: category, user_id: user_id, account_id: account_id} args.each do |key, value| result = (result, key, value) unless value.nil? end extra_info.keys.each do |key| result = (result, key, extra_info[key]) end result end |