Class: NetuitiveRubyApi::NetuitiveLogger
- Inherits:
-
Object
- Object
- NetuitiveRubyApi::NetuitiveLogger
- Defined in:
- lib/netuitive_ruby_api/netuitive_logger.rb
Class Attribute Summary collapse
-
.log ⇒ Object
Returns the value of attribute log.
Class Method Summary collapse
Class Attribute Details
.log ⇒ Object
Returns the value of attribute log.
14 15 16 |
# File 'lib/netuitive_ruby_api/netuitive_logger.rb', line 14 def log @log end |
Class Method Details
.format_age(age) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/netuitive_ruby_api/netuitive_logger.rb', line 27 def format_age(age) return 'daily' if age.nil? begin Integer(age) rescue age end end |
.format_size(size) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/netuitive_ruby_api/netuitive_logger.rb', line 36 def format_size(size) return 1_000_000 if size.nil? begin Integer(size) rescue size end end |
.setup ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/netuitive_ruby_api/netuitive_logger.rb', line 15 def setup file = NetuitiveRubyApi::ConfigManager.property('logLocation', 'NETUITIVE_RUBY_LOG_LOCATION', "#{File.('../../..', __FILE__)}/log/netuitive.log") age = NetuitiveRubyApi::ConfigManager.property('logAge', 'NETUITIVE_RUBY_LOG_AGE', 'daily') age = format_age(age) size = NetuitiveRubyApi::ConfigManager.property('logSize', 'NETUITIVE_RUBY_LOG_SIZE', 1_000_000) size = format_size(size) @log = Logger.new(file, age, size) rescue => e puts "netuitive unable to open log file. error: #{e.}, backtrace: #{e.backtrace}" @log = NetuitiveRubyApi::CheaterLogger.new end |