Class: Jfrog::Saas::Log::ConfigHandler
- Inherits:
-
Object
- Object
- Jfrog::Saas::Log::ConfigHandler
- Includes:
- Singleton
- Defined in:
- lib/jfrog/saas/log/confighandler.rb
Constant Summary collapse
- @@file_name =
''
Class Attribute Summary collapse
-
.conn_config ⇒ Object
readonly
Returns the value of attribute conn_config.
-
.log_config ⇒ Object
readonly
Returns the value of attribute log_config.
-
.proc_config ⇒ Object
readonly
Returns the value of attribute proc_config.
Instance Attribute Summary collapse
-
#conn_config ⇒ Object
Returns the value of attribute conn_config.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#log_config ⇒ Object
Returns the value of attribute log_config.
-
#proc_config ⇒ Object
Returns the value of attribute proc_config.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ConfigHandler
constructor
A new instance of ConfigHandler.
- #load_all_config(config_file, thread_name) ⇒ Object
Constructor Details
#initialize ⇒ ConfigHandler
Returns a new instance of ConfigHandler.
257 258 259 260 261 262 263 264 265 266 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 257 def initialize @mutex = Mutex.new # If not found in options, check for the environment variable @config_path = if !@@file_name.nil? @@file_name else ENV['LOG_COLLECTOR_CONFIG'] end load_all_config(@config_path, 'initialize') end |
Class Attribute Details
.conn_config ⇒ Object (readonly)
Returns the value of attribute conn_config.
244 245 246 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 244 def conn_config @conn_config end |
.log_config ⇒ Object (readonly)
Returns the value of attribute log_config.
248 249 250 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 248 def log_config @log_config end |
.proc_config ⇒ Object (readonly)
Returns the value of attribute proc_config.
252 253 254 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 252 def proc_config @proc_config end |
Instance Attribute Details
#conn_config ⇒ Object
Returns the value of attribute conn_config.
255 256 257 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 255 def conn_config @conn_config end |
#file_name ⇒ Object
Returns the value of attribute file_name.
255 256 257 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 255 def file_name @file_name end |
#log_config ⇒ Object
Returns the value of attribute log_config.
255 256 257 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 255 def log_config @log_config end |
#proc_config ⇒ Object
Returns the value of attribute proc_config.
255 256 257 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 255 def proc_config @proc_config end |
Class Method Details
.file_name(file_name) ⇒ Object
239 240 241 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 239 def self.file_name(file_name) @@file_name = file_name end |
Instance Method Details
#load_all_config(config_file, thread_name) ⇒ Object
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/jfrog/saas/log/confighandler.rb', line 268 def load_all_config(config_file, thread_name) @mutex.synchronize do if !config_file.nil? @log_config = LogConfig.instance @log_config.configure(config_file) @conn_config = ConnectionConfig.instance @conn_config.configure(config_file) @proc_config = ProcessConfig.instance @proc_config.configure(config_file) MessageUtils.instance.(MessageUtils::CONFIG_LOAD_BEGIN, { "param1": thread_name, "param2": config_file, "#{MessageUtils::LOG_LEVEL}": CommonUtils::LOG_INFO }) if LogConfig.instance.debug_mode == true MessageUtils.instance.(MessageUtils::CONFIG_LOAD_DETAIL, { "param1": thread_name, "param2": @conn_config.to_s, "#{MessageUtils::LOG_LEVEL}": CommonUtils::LOG_DEBUG }) end if LogConfig.instance.debug_mode == true MessageUtils.instance.(MessageUtils::CONFIG_LOAD_DETAIL, { "param1": thread_name, "param2": @log_config.to_s, "#{MessageUtils::LOG_LEVEL}": CommonUtils::LOG_DEBUG }) end if LogConfig.instance.debug_mode == true MessageUtils.instance.(MessageUtils::CONFIG_LOAD_DETAIL, { "param1": thread_name, "param2": @proc_config.to_s, "#{MessageUtils::LOG_LEVEL}": CommonUtils::LOG_DEBUG }) end MessageUtils.instance.(MessageUtils::CONFIG_LOAD_END, { "param1": thread_name, "param2": config_file, "#{MessageUtils::LOG_LEVEL}": CommonUtils::LOG_INFO }) else MessageUtils.instance.(MessageUtils::CONFIG_ERROR_NO_FILE, { "#{MessageUtils::LOG_LEVEL}": CommonUtils::LOG_ERROR }) end end end |