Class: Log
- Inherits:
-
Object
- Object
- Log
- Defined in:
- lib/AuthenticationSDK/core/Logger.rb
Overview
Logger Class
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logDirectory, logFilename, logSize, enableLog) ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize(logDirectory, logFilename, logSize, enableLog) ⇒ Log
Returns a new instance of Log.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/AuthenticationSDK/core/Logger.rb', line 6 def initialize(logDirectory, logFilename, logSize, enableLog) #log if enableLog == true filename = logDirectory + '/' + logFilename + '.log' datetime = DateTime.now if File.exist?(filename) && File.size(filename) >= logSize updatedFileName = logDirectory + '/' + logFilename + '_' + datetime.strftime('%Y%m%d%H%M%S') + '.log' File.rename(filename, updatedFileName) end @logger = Logger.new(STDOUT) @logger = Logger.new(filename, logSize) @logger.datetime_format = datetime.strftime('%Y-%m-%d %H:%M:%S') else @logger = Logger.new(false) end rescue StandardError => err puts err exit! end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
25 26 27 |
# File 'lib/AuthenticationSDK/core/Logger.rb', line 25 def logger @logger end |