Module: Flare::Util::Logging
- Included in:
- Net::Connection, Tools::Cli::Activate, Tools::Cli::Dispatch, Tools::Cli::IndexServerConfig, Tools::Cli::Ping, Tools::Cli::Stats, Tools::Cli::SubCommand, Tools::Cli::Summary, Tools::Client, Tools::Client, Tools::Common, Bwlimit
- Defined in:
- lib/flare/util/logging.rb,
lib/flare/util/logging.rb
Overview
Description
Logging is a mix-in module for logging.
Constant Summary collapse
- @@logger =
nil
Class Method Summary collapse
Instance Method Summary collapse
- #debug(msg) ⇒ Object
- #error(msg) ⇒ Object
- #fatal(msg) ⇒ Object
- #info(msg) ⇒ Object
-
#puts(*args) ⇒ Object
This hides Kernel’s puts().
- #trace(msg) ⇒ Object
- #warn(msg) ⇒ Object
Class Method Details
.logger ⇒ Object
38 39 40 |
# File 'lib/flare/util/logging.rb', line 38 def self.logger @@logger end |
Instance Method Details
#debug(msg) ⇒ Object
67 68 69 70 |
# File 'lib/flare/util/logging.rb', line 67 def debug(msg) Logging.set_logger if @@logger.nil? @@logger.debug(msg) end |
#error(msg) ⇒ Object
57 58 59 60 |
# File 'lib/flare/util/logging.rb', line 57 def error(msg) Logging.set_logger if @@logger.nil? @@logger.error(msg) end |
#fatal(msg) ⇒ Object
62 63 64 65 |
# File 'lib/flare/util/logging.rb', line 62 def fatal(msg) Logging.set_logger if @@logger.nil? @@logger.fatal(msg) end |
#info(msg) ⇒ Object
42 43 44 45 |
# File 'lib/flare/util/logging.rb', line 42 def info(msg) Logging.set_logger if @@logger.nil? @@logger.info(msg) end |
#puts(*args) ⇒ Object
This hides Kernel’s puts()
73 74 75 76 77 78 79 80 |
# File 'lib/flare/util/logging.rb', line 73 def puts(*args) Logging.set_logger if @@logger.nil? return Kernel.puts(*args) if @@logger.console? for msg in args info(msg) end nil end |
#trace(msg) ⇒ Object
52 53 54 55 |
# File 'lib/flare/util/logging.rb', line 52 def trace(msg) Logging.set_logger if @@logger.nil? @@logger.debug(msg) end |
#warn(msg) ⇒ Object
47 48 49 50 |
# File 'lib/flare/util/logging.rb', line 47 def warn(msg) Logging.set_logger if @@logger.nil? @@logger.warn(msg) end |