Class: Imap::Backup::Logger
- Inherits:
-
Object
- Object
- Imap::Backup::Logger
- Includes:
- Singleton
- Defined in:
- lib/imap/backup/logger.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
37 38 39 40 |
# File 'lib/imap/backup/logger.rb', line 37 def initialize @logger = ::Logger.new($stdout) $stdout.sync = true end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
35 36 37 |
# File 'lib/imap/backup/logger.rb', line 35 def logger @logger end |
Class Method Details
.logger ⇒ Object
11 12 13 |
# File 'lib/imap/backup/logger.rb', line 11 def self.logger Logger.instance.logger end |
.sanitize_stderr ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/imap/backup/logger.rb', line 25 def self.sanitize_stderr sanitizer = Sanitizer.new($stdout) previous_stderr = $stderr $stderr = sanitizer yield ensure sanitizer.flush $stderr = previous_stderr end |
.setup_logging(config = Configuration.new) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/imap/backup/logger.rb', line 15 def self.setup_logging(config = Configuration.new) logger.level = if config.debug? ::Logger::Severity::DEBUG else ::Logger::Severity::ERROR end Net::IMAP.debug = config.debug? end |