lib/bolt/logger.rb in bolt-2.25.0 vs lib/bolt/logger.rb in bolt-2.26.0

- old
+ new

@@ -26,11 +26,11 @@ } ) end def self.configure(destinations, color) - root_logger = Logging.logger[:root] + root_logger = Bolt::Logger.logger(:root) root_logger.add_appenders Logging.appenders.stderr( 'console', layout: console_layout(color), level: default_console_level @@ -64,10 +64,17 @@ appender.level = params[:level] if params[:level] end end + # A helper to ensure the Logging library is always initialized with our + # custom log levels before retrieving a Logger instance. + def self.logger(name) + initialize_logging + Logging.logger[name] + end + def self.analytics=(analytics) @analytics = analytics end def self.console_layout(color) @@ -108,10 +115,10 @@ end def self.warn_once(type, msg) @mutex.synchronize { @warnings ||= [] - @logger ||= Logging.logger[self] + @logger ||= Bolt::Logger.logger(self) unless @warnings.include?(type) @logger.warn(msg) @warnings << type end }