# How to configure, start and stop logging This sample application demonstrates how to configure, start and stop diagnostics logging. 1. Create the initialization callback object to be notified when initialization is complete and the object is ready to be used. auto initCb = [&](telux::common::ServiceStatus status) { initPromise.set_value(status); }; Copy to clipboard 2. Get the DiagnosticsFactory and DiagLogManager instances. auto &diagFactory = telux::platform::diag::DiagnosticsFactory::getInstance(); diagMgr = diagFactory.getDiagLogManager(initCb); Copy to clipboard 3. Ensure subsystem is ready. subSystemStatus = initPromise.get_future().get(); Copy to clipboard 4. Ensure logging is not currently in progress. if(diagStatus.isLoggingInProgress) { std::cout << " *** Logging already in progress - quitting application *** " << std::endl; break; } Copy to clipboard 5. Configure diagnostics logging. telux::platform::diag::DiagConfig fileMethodCfg {}; fileMethodCfg.method = telux::platform::diag::LogMethod::FILE; fileMethodCfg.srcType = telux::platform::diag::SourceType::DEVICE; fileMethodCfg.srcInfo.device = static_cast(2); fileMethodCfg.mdmLogMaskFile = maskFile; fileMethodCfg.modeType = telux::platform::diag::DiagLogMode::STREAMING; fileMethodCfg.methodConfig.fileConfig.maxSize = 0; fileMethodCfg.methodConfig.fileConfig.maxNumber = 0; errCode = diagMgr->setConfig(fileMethodCfg); Copy to clipboard 6. Start logging. errCode = diagMgr->startLogCollection(); if(telux::common::ErrorCode::SUCCESS != errCode) { std::cout << "Failed to start logging... Error Code: " << static_cast(errCode) << ". quitting application" <stopLogCollection(); if(telux::common::ErrorCode::SUCCESS != errCode) { std::cout << "Failed to stop logging... Error Code: " << static_cast(errCode) << ". quitting application" <