82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/scarpe/components/modular_logger.rb', line 82
def configure_logger(log_config)
@custom_log_layout = Logging.layouts.pattern pattern: '[%r] %-5l %c: %m\n'
if log_config.is_a?(String) && File.exist?(log_config)
log_config = JSON.load_file(log_config)
end
log_config = freeze_log_config(log_config) unless log_config.nil?
@current_log_config = log_config
Logging.reset Logging.reopen return if log_config.nil?
Logging.logger.root.appenders = [Logging.appenders.stdout]
default_logger = log_config[DEFAULT_COMPONENT] || "info"
json_configure_logger(Logging.logger.root, default_logger)
log_config.each do |component, logger_data|
next if component == DEFAULT_COMPONENT
sublogger = Logging.logger[component]
json_configure_logger(sublogger, logger_data)
end
end
|