Esempio n. 1
0
void Node::log(Priority      pri,
               const char   *file,
               const char   *call,
               unsigned int  line,
               const char   *msg) const
{
  try
  {
    // skip if priority's below threshold
    if( nc_->getThreshold().toInt() > pri.toInt() )
      return;

    // get current time-stamp
    timeb ts;
    ftime(&ts);

    // format string
    stringstream ss;
    assert( nc_->getFormatter().get()!=NULL );
    nc_->getFormatter()->format(ss, ts, nn_, pri, file, call, line, msg);
    // append it to configured appender
    nc_->getAppender()->append( ss.str() );
  }
  catch(const exception &ex)
  {
    errorWhileLogging( ex.what() );
  }
  catch(...)
  {
    errorWhileLogging(NULL);
  }
}