Module: Siba::LoggerPlug
- Included in:
- Archive::Tar::Archive, Archive::Tar::Init, Backup, Destination::Dir::DestDir, Encryption::Gpg::Encryption, Encryption::Gpg::Encryption, Encryption::Gpg::Init, OptionsBackup, OptionsLoader, PluginLoader, Restore, Scaffold, SibaTask, Source::Files::Files, Source::Files::Init, TmpDir, TmpDir, TmpDirPlug
- Defined in:
- lib/siba/logger_plug.rb
Overview
Used to inject “logger” to classes that include this module
Class Method Summary collapse
- .close ⇒ Object
- .create(name, path_to_log_file, show_start_message = true) ⇒ Object
- .logger ⇒ Object
- .opened? ⇒ Boolean
Instance Method Summary collapse
Class Method Details
.close ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/siba/logger_plug.rb', line 23 def close @logger.close if LoggerPlug.opened? @logger = nil SibaLogger.quiet = false SibaLogger.verbose = false SibaLogger.no_log = false end |
.create(name, path_to_log_file, show_start_message = true) ⇒ Object
18 19 20 21 |
# File 'lib/siba/logger_plug.rb', line 18 def create(name, path_to_log_file, = true) raise Siba::Error, "Log is already created" if LoggerPlug.opened? @logger = SibaLogger.new name, path_to_log_file, end |
.logger ⇒ Object
13 14 15 16 |
# File 'lib/siba/logger_plug.rb', line 13 def logger raise Siba::Error, "Log is not created" unless LoggerPlug.opened? @logger end |
.opened? ⇒ Boolean
31 32 33 |
# File 'lib/siba/logger_plug.rb', line 31 def opened? !@logger.nil? end |
Instance Method Details
#logger ⇒ Object
8 9 10 |
# File 'lib/siba/logger_plug.rb', line 8 def logger LoggerPlug.logger end |