Class: SecureNative::Log
- Inherits:
-
Object
- Object
- SecureNative::Log
- Defined in:
- lib/securenative/utils/log.rb
Class Method Summary collapse
- .debug(msg) ⇒ Object
- .error(msg) ⇒ Object
- .info(msg) ⇒ Object
- .init_logger(level = 'DEBUG') ⇒ Object
- .warning(msg) ⇒ Object
Class Method Details
.debug(msg) ⇒ Object
34 35 36 |
# File 'lib/securenative/utils/log.rb', line 34 def self.debug(msg) @logger.debug(msg) end |
.error(msg) ⇒ Object
42 43 44 |
# File 'lib/securenative/utils/log.rb', line 42 def self.error(msg) @logger.error(msg) end |
.info(msg) ⇒ Object
30 31 32 |
# File 'lib/securenative/utils/log.rb', line 30 def self.info(msg) @logger.info(msg) end |
.init_logger(level = 'DEBUG') ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/securenative/utils/log.rb', line 9 def self.init_logger(level = 'DEBUG') @logger.level = case level when 'WARN' Logger::WARN when 'DEBUG' Logger::DEBUG when 'ERROR' Logger::ERROR when 'FATAL' Logger::FATAL when 'INFO' Logger::INFO else Logger::FATAL end @logger.formatter = proc do |severity, datetime, progname, msg| "[#{datetime}] #{severity} (#{progname}): #{msg}\n" end end |
.warning(msg) ⇒ Object
38 39 40 |
# File 'lib/securenative/utils/log.rb', line 38 def self.warning(msg) @logger.warning(msg) end |