예제 #1
0
void ACSLogImpl::logCritical (acscommon::TimeStamp time,
			      const char * msg,
			      const ACSLog::RTContext & rtCont,
			      const ACSLog::SourceInfo & srcInfo,
			      const ACSLog::NVPairSeq & data) 
{  
  PriorityFlag  flag = write (rtCont, srcInfo, data);
  ACS_CHECK_LOGGER;
  LoggingProxy::Flags(flag);
  LOG_RECORD(Logging::BaseLog::LM_CRITICAL, msg, srcInfo.file.in(), srcInfo.line, srcInfo.routine.in(), time, rtCont.sourceObject.in());
}
예제 #2
0
void ACSLogImpl::logWithAudience (ACSLog::Priorities p,
			      acscommon::TimeStamp time,
			      const char * msg,
			      const ACSLog::RTContext & rtCont,
			      const ACSLog::SourceInfo & srcInfo,
			      const char * audience,
                              const char * array,
                              const char * antenna) 
{  
  PriorityFlag  flag = writeRTContext(rtCont)|writeSourceInfo(srcInfo);
  ACS_CHECK_LOGGER;
  LoggingProxy::Flags(flag);
  if(audience!=NULL)LoggingProxy::audience(audience);
  if(array!=NULL)LoggingProxy::array(array);
  if(antenna!=NULL)LoggingProxy::antenna(antenna);
  LOG_RECORD(acslog2loggingPriority(p), msg, srcInfo.file.in(), srcInfo.line, srcInfo.routine.in(), time, rtCont.sourceObject.in());
}
예제 #3
0
void ErrorTraceHelper::log (ACSErr::ErrorTrace * c,
			    int level, char* stackId,
			    ACE_Log_Priority priorty)
{
    unsigned int j;
    ACE_CString oldProcessName, oldThreadName, oldHost;
    Logging::BaseLog::Priority prio;

    LoggingProxy::StackLevel (level);
    LoggingProxy::StackId (stackId);

    for (j=0; j<c->data.length(); j++)
      LoggingProxy::AddData (c->data[j].name.in(), c->data[j].value.in());

  // set runtime context
//  ACE_Log_Msg::instance()->local_host(c->host.in());

  // here we save old process, host  and thread names
  oldHost = LoggingProxy::host();
  oldProcessName = LoggingProxy::ProcessName();
  oldThreadName = LoggingProxy::ThreadName();

  LoggingProxy::ProcessName (c->process.in());
  LoggingProxy::ThreadName (c->thread.in());

  //create the message
  std::ostringstream ostr;
  ostr << c->shortDescription.in() << " (type=" << c->errorType << ", code=" << c->errorCode << ")" << std::ends;
  //set the logging proxy flags
  LoggingProxy::Flags(LM_SOURCE_INFO | LM_RUNTIME_CONTEXT);

  prio = (priorty!=LM_ERROR) ? Logging::ace2acsPriority(priorty) :
      Logging::BaseLog::Priority(1 << (c->severity+7));

  ACS_CHECK_LOGGER;
  if (strlen(c->sourceObject.in())>0)
      {
      //just delegate
      LOG_RECORD(prio,
		 ostr.str(),
		 c->file.in(),
		 c->lineNum,
		 c->routine.in(),
		 c->timeStamp,
		 c->sourceObject.in());
      }
  else
      {
      //just delegate
      LOG_GLOBAL_RECORD(prio,
		 ostr.str(),
		 c->file.in(),
		 c->lineNum,
		 c->routine.in(),
		 c->timeStamp);
      }//if-else

  // reset process and thread name
  LoggingProxy::ProcessName (oldProcessName.c_str());
  LoggingProxy::ThreadName (oldThreadName.c_str());
  LoggingProxy::host (oldHost.c_str());
}//log