Class: Reedb::DaemonLogger
- Inherits:
-
Object
- Object
- Reedb::DaemonLogger
- Defined in:
- lib/reedb/utils/logger.rb
Constant Summary collapse
- @@logger =
nil
Class Method Summary collapse
-
.setup(path) ⇒ Object
Sets up a logger on a vault and loads existing logs if they exist.
-
.write(message, level = "") ⇒ Object
- Writes something to the current vault log (under #@path/logs/) Possible parameters are: ‘debug’
-
Throwing every operation at the log.
Class Method Details
.setup(path) ⇒ Object
Sets up a logger on a vault and loads existing logs if they exist. Logs are limited not in size but only by dates. Vault logs don’t contain whitespaces.
65 66 67 68 |
# File 'lib/reedb/utils/logger.rb', line 65 def self.setup(path) log_path = "#{path}/#{Reedb::Utilities.get_time(true)}.log" @@logger = Logger.new("#{log_path}") end |
.write(message, level = "") ⇒ Object
Writes something to the current vault log (under #@path/logs/) Possible parameters are:
- ‘debug’
-
Throwing every operation at the log.
- ‘info’
-
Default logging level for most situations and events.
- ‘warn’
-
Logs a warning. Should be event that won’t impact stability.
- ‘error’
-
Logs an error. Should be recoverable event.
- ‘fatal’
-
Logs a fatal crash. Should make the Reepass daemon crash!
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/reedb/utils/logger.rb', line 78 def self.write(, level = "") if level == "warn" @@logger.warn() elsif level == "debug" @@logger.debug() elsif level == "error" @@logger.error() elsif level == "fatal" @@logger.fatal() else @@logger.info() end end |