Module: WolfCore::LoggingUtils

Included in:
ApplicationService, FileUtils, FkmOperations, HttpOperations
Defined in:
lib/wolf_core/utils/logging_utils.rb

Instance Method Summary collapse

Instance Method Details

#log_object(object, title: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/wolf_core/utils/logging_utils.rb', line 5

def log_object(object, title: nil)
  puts '---------------------------------'
  puts title if title
  case object
  when Hash, Array, OpenStruct, Result
    if object.instance_of?(OpenStruct) || object.instance_of?(Result)
      object = object.to_h
    end
    puts object.to_json
  when Object
    pp object
  else
    puts object
  end
end