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

Method init

src/proxy/logging/Log.cc:1061–1116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1059}
1060
1061void
1062Log::init(int flags)
1063{
1064 preproc_threads = 1;
1065
1066 // store the configuration flags
1067 //
1068 config_flags = flags;
1069
1070 // create the configuration object
1071 config = new LogConfig();
1072 ink_assert(config != nullptr);
1073
1074 log_configid = configProcessor.set(log_configid, config);
1075
1076 // set the logging_mode and read config variables if needed
1077 //
1078 if (config_flags & LOGCAT) {
1079 logging_mode = LOG_MODE_NONE;
1080 } else {
1081 LogConfig::register_stat_callbacks();
1082
1083 config->read_configuration_variables();
1084 preproc_threads = config->preproc_threads;
1085
1086 int val = static_cast<int>(REC_ConfigReadInteger("proxy.config.log.logging_enabled"));
1087 if (val < LOG_MODE_NONE || val > LOG_MODE_FULL) {
1088 logging_mode = LOG_MODE_FULL;
1089 Warning("proxy.config.log.logging_enabled has an invalid "
1090 "value, setting it to %d",
1091 logging_mode);
1092 } else {
1093 logging_mode = static_cast<LoggingMode>(val);
1094 }
1095 // periodic task interval are set on a per instance basis
1096 MgmtInt pti = REC_ConfigReadInteger("proxy.config.log.periodic_tasks_interval");
1097 if (pti <= 0) {
1098 Error("proxy.config.log.periodic_tasks_interval = %" PRId64 " is invalid", pti);
1099 Note("falling back to default periodic tasks interval = %d", PERIODIC_TASKS_INTERVAL_FALLBACK);
1100 periodic_tasks_interval = PERIODIC_TASKS_INTERVAL_FALLBACK;
1101 } else {
1102 periodic_tasks_interval = static_cast<uint32_t>(pti);
1103 }
1104
1105 REC_RegisterConfigUpdateFunc("proxy.config.log.periodic_tasks_interval", &Log::handle_periodic_tasks_int_change, nullptr);
1106 }
1107
1108 init_fields();
1109 if (!(config_flags & LOGCAT)) {
1110 REC_RegisterConfigUpdateFunc("proxy.config.log.logging_enabled", &Log::handle_logging_mode_change, nullptr);
1111
1112 Dbg(dbg_ctl_log_config, "Log::init(): logging_mode = %d init status = %d", logging_mode, init_status);
1113 config->init();
1114 init_when_enabled();
1115 }
1116}
1117
1118void

Callers 3

change_configurationMethod · 0.45
init_fieldsMethod · 0.45
accessMethod · 0.45

Calls 5

register_stat_callbacksFunction · 0.85
REC_ConfigReadIntegerFunction · 0.85
ErrorClass · 0.50
setMethod · 0.45

Tested by

no test coverage detected