112 return idx; |
112 return idx; |
113 } |
113 } |
114 |
114 |
115 void LogConfiguration::delete_output(size_t idx) { |
115 void LogConfiguration::delete_output(size_t idx) { |
116 assert(idx > 1 && idx < _n_outputs, |
116 assert(idx > 1 && idx < _n_outputs, |
117 err_msg("idx must be in range 1 < idx < _n_outputs, but idx = " SIZE_FORMAT |
117 "idx must be in range 1 < idx < _n_outputs, but idx = " SIZE_FORMAT |
118 " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs)); |
118 " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs); |
119 LogOutput* output = _outputs[idx]; |
119 LogOutput* output = _outputs[idx]; |
120 // Swap places with the last output and shrink the array |
120 // Swap places with the last output and shrink the array |
121 _outputs[idx] = _outputs[--_n_outputs]; |
121 _outputs[idx] = _outputs[--_n_outputs]; |
122 _outputs = REALLOC_C_HEAP_ARRAY(LogOutput*, _outputs, _n_outputs, mtLogging); |
122 _outputs = REALLOC_C_HEAP_ARRAY(LogOutput*, _outputs, _n_outputs, mtLogging); |
123 delete output; |
123 delete output; |
124 } |
124 } |
125 |
125 |
126 void LogConfiguration::configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators) { |
126 void LogConfiguration::configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators) { |
127 assert(idx < _n_outputs, err_msg("Invalid index, idx = " SIZE_FORMAT " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs)); |
127 assert(idx < _n_outputs, "Invalid index, idx = " SIZE_FORMAT " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs); |
128 LogOutput* output = _outputs[idx]; |
128 LogOutput* output = _outputs[idx]; |
129 output->set_decorators(decorators); |
129 output->set_decorators(decorators); |
130 output->set_config_string(tag_level_expression.to_string()); |
130 output->set_config_string(tag_level_expression.to_string()); |
131 bool enabled = false; |
131 bool enabled = false; |
132 for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { |
132 for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { |