Beispiel #1
0
void cvac::localAndClientMsg(VLogger::Levels rqLevel, const CallbackHandlerPrx& callbackHandler, const char* fmt, ...) {

  va_list args;
  va_start(args, fmt);
  
  // Echo locally according to config.service property 'CVAC.ServicesVerbosity' in CVAC root
  if(vLogger.getBaseLevel() >= rqLevel)
  {
    vLogger.printv(rqLevel, fmt, args);
  }

  // Echo remotely based on client verbosity.
  // commenting out the second if condition means: always echo client messages unless SILENT
  // Otherwise: Early pruning of expensive messages  (will use 'clientVerbosity')
  if( vLogger.getBaseLevel() > vLogger.getIntLevel(0)
      && vLogger.getBaseLevel() >= rqLevel
    )  
  {
    // Echo through callbackHandler if available, assemble string for client message from arglist
    if(0 != callbackHandler) {
     
      char buffer[1024];
      memset(&buffer[0], 0, sizeof(buffer));
      vsprintf(buffer, fmt, args);

      callbackHandler->message(rqLevel, buffer);  // Send to client
    }
    va_end(args);
  }
}
Beispiel #2
0
void cvac::localAndClientMsg(VLogger::Levels rqLevel, const CallbackHandlerPrx& callbackHandler, const char* fmt, ...) {

  va_list args;
  
  // Echo locally according to config.service property 'CVAC.ServicesVerbosity' in CVAC root
  if(vLogger.getBaseLevel() >= rqLevel)
  {
    va_start(args, fmt);
    vLogger.printv(rqLevel, fmt, args);
    va_end(args);
  }

  // Echo remotely based on client verbosity.
  // commenting out the second if condition means: always echo client messages unless SILENT
  // Otherwise: Early pruning of expensive messages  (will use 'clientVerbosity')
  if( vLogger.getBaseLevel() > vLogger.getIntLevel(0)
      && vLogger.getBaseLevel() >= rqLevel
    )  
  {
    // Echo through callbackHandler if available, assemble string for client message from arglist
    if(0 != callbackHandler) {
      const unsigned int BUFLEN=1024;
      if (strlen(fmt)>BUFLEN/2)
      {
        vLogger.printv( VLogger::DEBUG_2, 
                        "Really long debug message - might get truncated: %s\n", fmt );
      }
      char buffer[BUFLEN+1];
      // shouldn't need this:      memset(&buffer[0], 0, sizeof(buffer));
      va_start(args, fmt);
      vsnprintf(buffer, BUFLEN, fmt, args);
      va_end(args);
      buffer[BUFLEN]=0;
      callbackHandler->message(rqLevel, buffer);  // Send to client
    }
    va_end(args);
  }
}