MCPcopy Create free account
hub / github.com/apache/trafficserver / init

Method init

src/proxy/logging/LogConfig.cc:289–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287 -------------------------------------------------------------------------*/
288
289void
290LogConfig::init(LogConfig *prev_config)
291{
292 LogObject *errlog = nullptr;
293
294 ink_assert(!initialized);
295
296 update_space_used();
297
298 // create log objects
299 //
300 if (Log::transaction_logging_enabled()) {
301 setup_log_objects();
302 }
303
304 // ----------------------------------------------------------------------
305 // Construct a new error log object candidate.
306 if (Log::error_logging_enabled()) {
307 std::unique_ptr<LogFormat> fmt(MakeTextLogFormat("error"));
308
309 Dbg(dbg_ctl_log, "creating predefined error log object");
310
311 errlog = new LogObject(this, fmt.get(), logfile_dir, error_log_filename, LOG_FILE_ASCII, nullptr, rolling_enabled,
312 preproc_threads, rolling_interval_sec, rolling_offset_hr, rolling_size_mb, /* auto_created */ false,
313 rolling_max_count, rolling_min_count);
314
315 log_object_manager.manage_object(errlog);
316 errlog->set_fmt_timestamps();
317 } else {
318 Log::error_log = nullptr;
319 }
320
321 if (prev_config) {
322 // Transfer objects from previous configuration.
323 transfer_objects(prev_config);
324
325 // After transferring objects, we are going to keep either the new error log or the old one. Figure out
326 // which one we are keeping and make that the global ...
327 if (Log::error_log) {
328 errlog = this->log_object_manager.find_by_format_name(Log::error_log->m_format->name());
329 }
330 }
331
332 ink_atomic_swap(&Log::error_log, errlog);
333
334 initialized = true;
335}
336
337/*-------------------------------------------------------------------------
338 LogConfig::display

Callers

nothing calls this directly

Calls 7

MakeTextLogFormatFunction · 0.85
ink_atomic_swapFunction · 0.85
manage_objectMethod · 0.80
set_fmt_timestampsMethod · 0.80
find_by_format_nameMethod · 0.80
getMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected