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.
42 43 44 45 |
# File 'lib/imap/backup/logger.rb', line 42 def initialize @logger = ::Logger.new($stdout) $stdout.sync = true end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
40 41 42 |
# File 'lib/imap/backup/logger.rb', line 40 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
30 31 32 33 34 35 36 37 38 |
# File 'lib/imap/backup/logger.rb', line 30 def self.sanitize_stderr sanitizer = Sanitizer.new($stdout) previous_stderr = $stderr $stderr = sanitizer yield ensure sanitizer.flush $stderr = previous_stderr end |
.setup_logging(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/imap/backup/logger.rb', line 15 def self.setup_logging( = {}) level = case when [:quiet] ::Logger::Severity::UNKNOWN when [:verbose] ::Logger::Severity::DEBUG else ::Logger::Severity::INFO end logger.level = level debug = level == ::Logger::Severity::DEBUG Net::IMAP.debug = debug end |