bool CWsLoggingServiceEx::onUpdateLog(IEspContext& context, IEspUpdateLogRequest& req, IEspUpdateLogResponse& resp) { try { context.ensureFeatureAccess(WSLOGGING_ACCESS, SecAccess_Write, EspLoggingErrors::WSLoggingAccessDenied, "WsLoggingService::UpdateLog: Permission denied."); context.addTraceSummaryTimeStamp(LogMin, "startQLog"); for (unsigned int x = 0; x < loggingAgentThreads.size(); x++) { IUpdateLogThread* loggingThread = loggingAgentThreads[x]; if (!loggingThread->hasService(LGSTUpdateLOG)) continue; loggingThread->queueLog(&req); } context.addTraceSummaryTimeStamp(LogMin, "endQLog"); resp.setStatusCode(0); resp.setStatusMessage("Log will be updated."); } catch (IException* e) { StringBuffer errorStr; e->errorMessage(errorStr); OERRLOG("Failed to update log: cannot add to log queue: %s",errorStr.str()); resp.setStatusCode(-1); resp.setStatusMessage(errorStr.str()); e->Release(); } return true; }
bool CWsLoggingServiceEx::onGetTransactionSeed(IEspContext& context, IEspGetTransactionSeedRequest& req, IEspGetTransactionSeedResponse& resp) { bool bRet = false; try { context.ensureFeatureAccess(WSLOGGING_ACCESS, SecAccess_Read, EspLoggingErrors::WSLoggingAccessDenied, "WsLoggingService::GetTransactionSeed: Permission denied."); LOGServiceType serviceType = LGSTGetTransactionSeed; for (unsigned int x = 0; x < loggingAgentThreads.size(); x++) { IUpdateLogThread* loggingThread = loggingAgentThreads[x]; if (!loggingThread->hasService(serviceType)) continue; IEspLogAgent* loggingAgent = loggingThread->getLogAgent(); bRet = loggingAgent->getTransactionSeed(req, resp); break; } } catch (IException* e) { StringBuffer errorStr; e->errorMessage(errorStr); errorStr.insert(0, "Failed to get Transaction Seed: "); OERRLOG("%s", errorStr.str()); resp.setStatusCode(-1); resp.setStatusMessage(errorStr.str()); e->Release(); } return bRet; }