当前位置: 首页>>代码示例>>C++>>正文


C++ ACE_Log_Record类代码示例

本文整理汇总了C++中ACE_Log_Record的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Log_Record类的具体用法?C++ ACE_Log_Record怎么用?C++ ACE_Log_Record使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ACE_Log_Record类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: log

void KSGLogCallback::log(ACE_Log_Record& log_record)
{
	ACE_TCHAR msg_data[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
	ACE_OS::sprintf(msg_data,"F[%s]L[%d]-%s\n",ACE_LOG_MSG->file()
		,ACE_LOG_MSG->linenum(),log_record.msg_data());
	log_record.msg_data(msg_data);
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:7,代码来源:logcallback.cpp

示例2:

  ssize_t
  NDDS_Log_Backend::log (ACE_Log_Record  &log_record)
  {
    Log_Record *instance (0);

    instance = Log_RecordTypeSupport::create_data_ex (DDS_BOOLEAN_FALSE);

    if (instance == 0)
      {
        ACE_ERROR ((LM_EMERGENCY, ACE_TEXT ("Unable to create data sample for log record\n")));
        return 0;
      }

    instance->node = this->node_.c_str ();
    instance->pid = log_record.pid ();
    instance->pid = log_record.pid ();
    instance->message = ACE_TEXT_ALWAYS_CHAR (log_record.msg_data ());

    DDS_ReturnCode_t const retval =
      this->log_record_writer_->write (*instance, DDS_HANDLE_NIL);

    if (retval != DDS_RETCODE_OK)
      {
        ACE_ERROR ((LM_EMERGENCY, ACE_TEXT ("Unable to write log record to DDS\n")));
        return 0;
      }

    if (instance != 0)
      {
        Log_RecordTypeSupport::delete_data_ex (instance,
                                               DDS_BOOLEAN_FALSE);
      }

    return log_record.msg_data_len ();
  }
开发者ID:DOCGroup,项目名称:DAnCE,代码行数:35,代码来源:Log_Backend.cpp

示例3:

ssize_t
ACE_Log_Msg_Android_Logcat::log (ACE_Log_Record &log_record)
{
  __android_log_write (
    convert_log_priority (static_cast<ACE_Log_Priority> (log_record.type ())),
    "ACE",
    log_record.msg_data ());
  return 0;
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:9,代码来源:Log_Msg_Android_Logcat.cpp

示例4: switch

int
Logging_Handler::handle_input (ACE_HANDLE)
{
  ssize_t n;
  size_t len;

  // Perform two recv's to emulate record-oriented semantics.  Note
  // that this code is not entirely portable since it relies on the
  // fact that sizeof (ssize_t) is the same on both the sender and
  // receiver side.  To correctly handle this is painful, and we leave
  // it as an exercise for the reader ;-).

  switch (n = this->cli_stream_.recv ((void *) &len, sizeof len))
    {
    case -1:
      ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p at host %s\n",
                         "client logger", this->host_name_), -1);
      /* NOTREACHED */
    case 0:
      ACE_ERROR_RETURN ((LM_ERROR,
                         "(%P|%t) closing log daemon at host %s (fd = %d)\n",
                         this->host_name_, this->get_handle ()), -1);
      /* NOTREACHED */
    case sizeof (size_t):
      {
        ACE_Log_Record lp;

        len = ntohl (len);
        n = this->cli_stream_.recv_n ((void *) &lp, len);
        if (n != (ssize_t) len)
          ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p at host %s\n",
                             "client logger", this->host_name_), -1);
        /* NOTREACHED */

        lp.decode ();

        if (lp.length () == n)
          {
            ACE_DEBUG ((LM_DEBUG, "(%P|%t) "));
            lp.print (this->host_name_, 1);
          }
        else
          ACE_ERROR ((LM_ERROR, "(%P|%t) error, lp.length = %d, n = %d\n",
                      lp.length (), n));
        break;
      }
    default:
      ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p at host %s\n",
                         "client logger", this->host_name_), -1);
      /* NOTREACHED */
    }

  return 0;
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:54,代码来源:Logging_Handler.cpp

示例5: log

//
// log
//
ssize_t CUTS_ACE_Msg_Backend::log (ACE_Log_Record &log_record)
{
  this->logger_.log (log_record.priority (),
                     log_record.msg_data (),
                     log_record.length ());

  // Manually invoke the old message callback
  if (this->old_msg_backend_ != 0)
    this->old_msg_backend_->log (log_record);

  return log_record.length ();
}
开发者ID:SEDS,项目名称:CUTS,代码行数:15,代码来源:ACE_Msg_Backend.cpp

示例6: defined

void
MFC_Log::log(ACE_Log_Record& log_record)
{
  unsigned long priority = log_record.type();
  char Message[512];

  ACE_OS::sprintf(Message,"%d.%03ld %s", log_record.time_stamp().sec(),
  log_record.time_stamp().usec()/ 1000, log_record.msg_data());

#if defined (ACE_WIN32)
  ::OutputDebugString(Message);
#endif /* ACE_WIN32 */
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:13,代码来源:MFC_Log.cpp

示例7: ACE_DEBUG

void
Logger::log (ACE_Log_Record &log_record)
{
  int use_log_msg = 0;
  if (this->recursive_)
    {
      this->recursive_ = 0;
      use_log_msg = 1;
    }

  if (!this->verbose_logging_)
    {
      if (use_log_msg)
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("Logger::log->%s\n"),
                    log_record.msg_data ()));
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
      else
        *ace_file_stream::instance ()->output_file ()
          << "Recursive Logger callback = "
          << log_record.msg_data ()
          << endl;
#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
    }
  else
    {
      ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
      int result = log_record.format_msg (ACE_LOG_MSG->local_host (),
                                          ACE_LOG_MSG->flags (),
                                          verbose_msg);
      if (result == 0)
        {
          if (use_log_msg)
            ACE_DEBUG ((LM_DEBUG,
                        ACE_TEXT ("Logger::log->%s\n"),
                        verbose_msg));
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
          else
            *ace_file_stream::instance ()->output_file ()
              << "Recursive Logger callback = "
              << log_record.msg_data ()
              << endl;
#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
        }
    }

  // Cleanup on the way out.
  if (use_log_msg)
    this->recursive_ = 1;
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:50,代码来源:Log_Msg_Test.cpp

示例8: ACE_TEXT

ssize_t
ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record)
{
  int syslog_priority = this->convert_log_priority (log_record.type ());
  u_long flags = ACE_LOG_MSG->flags ();

  // The UNIX syslog() facility does not support multi-line messages.
  // Break up the message data into separate lines and send each line
  // to the syslog daemon.

  ACE_TCHAR message[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
  ACE_OS::strcpy (message, log_record.msg_data ());
  ACE_TCHAR *strtokp = 0;

  for (ACE_TCHAR *line = ACE_OS::strtok_r (message,
                                           ACE_TEXT ("\n"),
                                           &strtokp);
       line != 0;
       line = ACE_OS::strtok_r (0,
                                ACE_TEXT ("\n"),
                                &strtokp))
    {
      // Format the message line.  Note that the processing for
      // VERBOSE is the same as for VERBOSE_LITE, since syslog()
      // already provides us with the hostname and PID.  However, the
      // timestamp is duplicated (albeit a shortened version) to
      // provide a timestamp with greater precision than that provided
      // by syslog().
      if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::VERBOSE)
          || ACE_BIT_ENABLED (flags, ACE_Log_Msg::VERBOSE_LITE))
        {
          ACE_TCHAR date_and_time[35];
          if (0 == ACE::timestamp (date_and_time, sizeof (date_and_time), 1))
            ACE_OS::strcpy (date_and_time, ACE_TEXT ("<time error>"));
          const ACE_TCHAR *prio_name =
            ACE_Log_Record::priority_name(ACE_Log_Priority(log_record.type()));
          syslog (syslog_priority,
                  "%s: %s: %s",
                  ACE_TEXT_ALWAYS_CHAR (date_and_time),
                  ACE_TEXT_ALWAYS_CHAR (prio_name),
                  ACE_TEXT_ALWAYS_CHAR (line));
        }
      else // No formatting required.
        syslog (syslog_priority, "%s", ACE_TEXT_ALWAYS_CHAR (line));
    }

  return 0;
}
开发者ID:Denominator13,项目名称:NeoCore,代码行数:48,代码来源:Log_Msg_UNIX_Syslog.cpp

示例9:

// Type based log message receiver
template<ACE_SYNCH_DECL> void
Log_Message_Receiver_Impl<ACE_SYNCH_USE>::log_record (const ACE_TCHAR *hostname,
                                                      ACE_Log_Record &record)
{
  ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, print_lock_);
  record.print (hostname,
                ACE_Log_Msg::instance ()->flags (),
                stderr);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:10,代码来源:Log_Message_Receiver.cpp

示例10: ACE_DEBUG

void
Logger::log (ACE_Log_Record &log_record)
{
  int use_log_msg = 0;
  if (this->recursive_)
    {
      this->recursive_ = 0;
      use_log_msg = 1;
    }

  if (!this->verbose_logging_)
    {
      if (use_log_msg)
        ACE_DEBUG ((LM_DEBUG,
                    "Logger::log->%s\n",
                    log_record.msg_data ()));
      else
        ACE_OS::printf ("Recursive Logger callback = %s\n",
                        log_record.msg_data ());
    }
  else
    {
      ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
      int result = log_record.format_msg (ACE_LOG_MSG->local_host (),
                                          ACE_LOG_MSG->flags (),
                                          verbose_msg);
      if (result == 0)
        {
          if (use_log_msg)
            ACE_DEBUG ((LM_DEBUG,
                        "Logger::log->%s\n",
                        verbose_msg));
          else
            ACE_OS::printf ("Recursive Logger callback = %s\n",
                            verbose_msg);
        }
    }

  // Cleanup on the way out.
  if (use_log_msg)
    this->recursive_ = 1;
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:42,代码来源:test_callback.cpp

示例11: log

void ACE_CE_Screen_Output::log(ACE_Log_Record &log_record)
{
    ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
    int result = log_record.format_msg (ACE_TEXT("WindozeCE"),  // host name
                                        0,                          // verbose flag
                                        verbose_msg);

    if (result == 0)
    {
        verbose_msg[ ACE_OS::strlen(verbose_msg) - 1 ] = 0;  // CE does not like '\n' by itself.
        *this << verbose_msg << endl;
    }
}
开发者ID:CCJY,项目名称:ACE,代码行数:13,代码来源:CE_Screen_Output.cpp

示例12: defined

// Type based log message receiver
template<ACE_SYNCH_DECL> void
Static_Log_Message_Receiver<ACE_SYNCH_USE>::log_record (const ACE_TCHAR *hostname,
                                                        ACE_Log_Record &record)
{
#if defined (ACE_HAS_THREADS)
  static ACE_SYNCH_MUTEX_T lock_;
  ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, lock_);
#endif /* ACE_HAS_THREADS */

  record.print (hostname,
                ACE_Log_Msg::instance ()->flags (),
                stderr);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:14,代码来源:Log_Message_Receiver.cpp

示例13: if

void
Log_Spec_Verify::log (ACE_Log_Record &log_record)
{
  const ACE_TCHAR *b = log_record.msg_data ();
  const ACE_TCHAR *expect = 0;

  if (ACE_OS::strncmp (b, ACE_TEXT ("l1:"), 3) == 0)
    {
      expect = ACE_TEXT ("42");
      b += 4;  //3
    }
  else if (ACE_OS::strncmp (b, ACE_TEXT ("l2:"), 3) == 0)
    {
      expect = ACE_TEXT ("   42");
      b += 3;
    }
  else if (ACE_OS::strncmp (b, ACE_TEXT ("l3N1:"), 4) == 0)
    {
      expect = ACE_TEXT ("0042,Log_Msg");
      b += 4;
    }
  else
    {
      ACE_ERROR ((LM_ERROR,
                  ACE_TEXT ("Log_Spec_Verify, unrecognized test: %s\n"),
                  b));
      this->fail_++;
    }

  if (b != log_record.msg_data () && ACE_OS::strcmp (b, expect) != 0)
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Test %s failed; expected %s\n"),
                  log_record.msg_data (), expect));
      this->fail_++;
    }

  return;
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:38,代码来源:Log_Msg_Test.cpp

示例14: defined

template<ACE_SYNCH_DECL> void
Static_Log_Message_Receiver<ACE_SYNCH_USE>::log_output (char const *hostname,
                                                        ACE_Log_Record &record,
                                                        ostream *outputfile)
{
  if (outputfile != 0)
    {
#if defined (ACE_HAS_THREADS)
      static ACE_SYNCH_MUTEX_T lock_;
      ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, lock_);
#endif /* ACE_HAS_THREADS */
      record.print (hostname,
                    ACE_Log_Msg::instance ()->flags (),
                    *outputfile);
    }
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:16,代码来源:Log_Message_Receiver.cpp

示例15: defined

int
operator<< (ACE_OutputCDR &cdr,
            const ACE_Log_Record &log_record)
{
  // The written message length can't be more than 32 bits (ACE_CDR::ULong)
  // so reduce it here if needed.
  ACE_CDR::ULong u_msglen =
    ACE_Utils::truncate_cast<ACE_CDR::ULong> (log_record.msg_data_len ());

  // Insert each field from <log_record> into the output CDR stream.
  cdr << ACE_CDR::Long (log_record.type ());
  cdr << ACE_CDR::Long (log_record.pid ());
  cdr << ACE_CDR::LongLong (log_record.time_stamp ().sec ());
  cdr << ACE_CDR::Long (log_record.time_stamp ().usec ());
  cdr << u_msglen;
#if defined (ACE_USES_WCHAR)
  cdr.write_wchar_array (log_record.msg_data (), u_msglen);
#else
  cdr.write_char_array (log_record.msg_data (), u_msglen);
#endif /* ACE_USES_WCHAR */
  return cdr.good_bit ();
}
开发者ID:Amara1231,项目名称:blizzlikecore,代码行数:22,代码来源:Log_Record.cpp


注:本文中的ACE_Log_Record类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。