Module: ServerEngine::ConfigLoader
- Included in:
- Daemon, Server, Supervisor
- Defined in:
- lib/serverengine/config_loader.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
39 40 41 |
# File 'lib/serverengine/config_loader.rb', line 39 def config @config end |
#logger ⇒ Object
Returns the value of attribute logger.
40 41 42 |
# File 'lib/serverengine/config_loader.rb', line 40 def logger @logger end |
Instance Method Details
#initialize(load_config_proc = {}, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/serverengine/config_loader.rb', line 23 def initialize(load_config_proc={}, &block) if block @load_config_proc = block else if load_config_proc.is_a?(Hash) @load_config_proc = lambda { load_config_proc } else @load_config_proc = load_config_proc end end @logger = nil reload_config end |
#reload_config ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/serverengine/config_loader.rb', line 42 def reload_config @config = @load_config_proc.call @logger_class = @config[:logger_class] || DaemonLogger if @logger logdev = logdev_from_config(@config) unless logdev.is_a?(IO) # Here doesn't allow to change logdev to IO dynamically # because Server#start_io_logging_thread can't follow it. @logger.logdev = logdev end @logger.level = @config[:log_level] || 'debug' end nil end |