Module: Bolt::Logger
- Defined in:
- lib/bolt/logger.rb
Class Method Summary collapse
-
.initialize_logging ⇒ Object
This method provides a single point-of-entry to setup logging for both the CLI and for tests.
- .reset_logging ⇒ Object
Class Method Details
.initialize_logging ⇒ Object
This method provides a single point-of-entry to setup logging for both the CLI and for tests. This is necessary because we define custom log levels which create corresponding methods on the logger instances; without first initializing the Logging system, calls to those methods will fail.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bolt/logger.rb', line 10 def self.initialize_logging # Initialization isn't idempotent and will result in warnings about const # redefs, so skip it if it's already been initialized return if Logging.initialized? Logging.init :debug, :info, :notice, :warn, :error, :fatal, :any Logging.appenders.stderr( 'stderr', layout: Logging.layouts.pattern( pattern: '%d %-6l %c: %m\n', date_pattern: '%Y-%m-%dT%H:%M:%S.%6N' ) ) root_logger = Logging.logger[:root] root_logger.add_appenders :stderr root_logger.level = :notice end |
.reset_logging ⇒ Object
28 29 30 |
# File 'lib/bolt/logger.rb', line 28 def self.reset_logging Logging.reset end |