Module: Rack::Insight::Logging

Class Method Summary collapse

Class Method Details

.loggerObject



11
12
13
# File 'lib/rack/insight/logging.rb', line 11

def logger
  Rack::Insight::Config.logger
end

.verbose(max_level = false) ⇒ Object

max_level is confusing because the ‘level’ of output goes up (and this is what max refers to) when the integer value goes DOWN



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rack/insight/logging.rb', line 18

def verbose(max_level = false)
  #logger.unknown "Rack::Insight::Logging.verbosity: #{Rack::Insight::Logging.verbosity} <= max_level: #{VERBOSITY[max_level]}" #for debugging the logger
  return false if (!verbosity) # false results in Exactly Zero output!
  return true if (verbosity == true) # Not checking truthy because need to check against max_level...
  # Example: if configured log spam level is high (1) logger should get all messages that are not :debug (0)
  #          so, if a log statement has if verbose(:low) (:low is 3)
  #          1 <= 3 # true => Message sent to logger
  #          then, if a log statement has if verbose(:debug) (:debug is 0)
  #          1 <= 0 # false => Nothing sent to logger
  return true if verbosity <= (Rack::Insight::Config::VERBOSITY[max_level]) # Integers!
end

.verbosityObject



6
7
8
# File 'lib/rack/insight/logging.rb', line 6

def verbosity
  Rack::Insight::Config.verbosity
end