Class: LogManager
- Defined in:
- lib/wingify/packages/logger/core/log_manager.rb
Class Method Summary collapse
-
.instance(config = {}) ⇒ Object
Use the ‘instance` method to initialize and get the instance.
Instance Method Summary collapse
- #debug(message) ⇒ Object
- #error(message, extraData = {}) ⇒ Object
- #info(message) ⇒ Object
-
#initialize(config = {}) ⇒ LogManager
constructor
A new instance of LogManager.
- #trace(message) ⇒ Object
- #warn(message) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ LogManager
Returns a new instance of LogManager.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/wingify/packages/logger/core/log_manager.rb', line 34 def initialize(config = {}) # Store the config in an instance variable @config = config # Initialize default config values inside @config @config[:name] ||= 'VWO Logger' @config[:request_id] ||= SecureRandom.uuid @config[:level] ||= 'ERROR' @config[:prefix] ||= 'VWO-SDK' @config[:date_time_format] ||= lambda { Time.now.iso8601 } # Initialize the transport manager with the @config hash @transport_manager = LogTransportManager.new(@config) handle_transports end |
Class Method Details
.instance(config = {}) ⇒ Object
Use the ‘instance` method to initialize and get the instance
26 27 28 29 30 31 32 |
# File 'lib/wingify/packages/logger/core/log_manager.rb', line 26 def self.instance(config = {}) # If an instance already exists, return it if @instance.nil? @instance = new(config) end @instance end |
Instance Method Details
#debug(message) ⇒ Object
54 55 56 |
# File 'lib/wingify/packages/logger/core/log_manager.rb', line 54 def debug() @transport_manager.log('DEBUG', ) end |
#error(message, extraData = {}) ⇒ Object
66 67 68 69 |
# File 'lib/wingify/packages/logger/core/log_manager.rb', line 66 def error(, extraData = {}) @transport_manager.log('ERROR', ) # sendLogToVWO(message, LogLevelEnum::ERROR, extraData) end |
#info(message) ⇒ Object
58 59 60 |
# File 'lib/wingify/packages/logger/core/log_manager.rb', line 58 def info() @transport_manager.log('INFO', ) end |
#trace(message) ⇒ Object
50 51 52 |
# File 'lib/wingify/packages/logger/core/log_manager.rb', line 50 def trace() @transport_manager.log('TRACE', ) end |
#warn(message) ⇒ Object
62 63 64 |
# File 'lib/wingify/packages/logger/core/log_manager.rb', line 62 def warn() @transport_manager.log('WARN', ) end |