Class: ConfigCat::ConfigCatLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/configcat/configcatlogger.rb

Instance Method Summary collapse

Constructor Details

#initialize(hooks) ⇒ ConfigCatLogger

Returns a new instance of ConfigCatLogger.



3
4
5
# File 'lib/configcat/configcatlogger.rb', line 3

def initialize(hooks)
  @hooks = hooks
end

Instance Method Details

#debug(message) ⇒ Object



11
12
13
# File 'lib/configcat/configcatlogger.rb', line 11

def debug(message)
  ConfigCat.logger.debug("[0] " + message)
end

#enabled_for?(log_level) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/configcat/configcatlogger.rb', line 7

def enabled_for?(log_level)
  ConfigCat.logger.level <= log_level
end

#error(event_id, message) ⇒ Object



23
24
25
26
# File 'lib/configcat/configcatlogger.rb', line 23

def error(event_id, message)
  @hooks.invoke_on_error(message)
  ConfigCat.logger.error("[" + event_id.to_s + "] " + message)
end

#info(event_id, message) ⇒ Object



15
16
17
# File 'lib/configcat/configcatlogger.rb', line 15

def info(event_id, message)
  ConfigCat.logger.info("[" + event_id.to_s + "] " + message)
end

#warn(event_id, message) ⇒ Object



19
20
21
# File 'lib/configcat/configcatlogger.rb', line 19

def warn(event_id, message)
  ConfigCat.logger.warn("[" + event_id.to_s + "] " + message)
end