Class: NseData::Config::Logger
- Defined in:
- lib/nse_data/config/logger.rb
Overview
Logger handles configuration specifically for logging.
It inherits from Base to utilize the hash-like configuration interface and provides default settings for logging.
Instance Attribute Summary collapse
-
#logger ⇒ Object
Retrieves/Sets the Logger instance.
Attributes inherited from Base
Class Method Summary collapse
-
.default_log_file ⇒ Object
Creates a default temporary log file.
Instance Method Summary collapse
-
#initialize(logger = ::Logger.new(self.class.default_log_file)) ⇒ Logger
constructor
Initializes the Logger with a default or custom Logger instance.
Methods inherited from Base
Constructor Details
#initialize(logger = ::Logger.new(self.class.default_log_file)) ⇒ Logger
Initializes the Logger with a default or custom Logger instance.
28 29 30 31 32 33 |
# File 'lib/nse_data/config/logger.rb', line 28 def initialize(logger = ::Logger.new(self.class.default_log_file)) super() @logger = logger @settings[:logger] = logger # puts "Log file created at: #{self.class.default_log_file}" end |
Instance Attribute Details
#logger ⇒ Object
Retrieves/Sets the Logger instance.
15 16 17 |
# File 'lib/nse_data/config/logger.rb', line 15 def logger @logger end |
Class Method Details
.default_log_file ⇒ Object
Creates a default temporary log file.
17 18 19 20 21 22 23 |
# File 'lib/nse_data/config/logger.rb', line 17 def self.default_log_file return $stdout if ENV['NSE_DEV'] temp_file = Tempfile.new(['nse_data', '.log']) temp_file.close # Close the file immediately after creation temp_file.path # Return the file path for the Logger end |