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

Function TSTextLogObjectCreate

src/api/InkAPI.cc:6301–6331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6299/************************** Logging API ****************************/
6300
6301TSReturnCode
6302TSTextLogObjectCreate(const char *filename, int mode, TSTextLogObject *new_object)
6303{
6304 sdk_assert(sdk_sanity_check_null_ptr((void *)filename) == TS_SUCCESS);
6305 sdk_assert(sdk_sanity_check_null_ptr((void *)new_object) == TS_SUCCESS);
6306
6307 if (mode < 0 || mode >= TS_LOG_MODE_INVALID_FLAG) {
6308 *new_object = nullptr;
6309 return TS_ERROR;
6310 }
6311
6312 TextLogObject *tlog = new TextLogObject(
6313 filename, Log::config->logfile_dir, static_cast<bool>(mode) & TS_LOG_MODE_ADD_TIMESTAMP, nullptr, Log::config->rolling_enabled,
6314 Log::config->preproc_threads, Log::config->rolling_interval_sec, Log::config->rolling_offset_hr, Log::config->rolling_size_mb,
6315 Log::config->rolling_max_count, Log::config->rolling_min_count, Log::config->rolling_allow_empty);
6316 if (tlog == nullptr) {
6317 *new_object = nullptr;
6318 return TS_ERROR;
6319 }
6320
6321 int err = (mode & TS_LOG_MODE_DO_NOT_RENAME ? Log::config->log_object_manager.manage_api_object(tlog, 0) :
6322 Log::config->log_object_manager.manage_api_object(tlog));
6323 if (err != LogObjectManager::NO_FILENAME_CONFLICTS) {
6324 delete tlog;
6325 *new_object = nullptr;
6326 return TS_ERROR;
6327 }
6328
6329 *new_object = reinterpret_cast<TSTextLogObject>(tlog);
6330 return TS_SUCCESS;
6331}
6332
6333TSReturnCode
6334TSTextLogObjectWrite(TSTextLogObject the_object, const char *format, ...)

Callers 15

protocol_initFunction · 0.85
TSPluginInitFunction · 0.85
TSPluginInitFunction · 0.85
TSPluginInitFunction · 0.85
initMethod · 0.85
TSPluginInitFunction · 0.85
initializeLogFunction · 0.85
createLogMethod · 0.85
TSPluginInitFunction · 0.85
TSPluginInitFunction · 0.85
create_log_fileFunction · 0.85

Calls 2

manage_api_objectMethod · 0.80

Tested by 2

TSPluginInitFunction · 0.68