本文整理汇总了C++中ACE_Log_Record::format_msg方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Log_Record::format_msg方法的具体用法?C++ ACE_Log_Record::format_msg怎么用?C++ ACE_Log_Record::format_msg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Log_Record
的用法示例。
在下文中一共展示了ACE_Log_Record::format_msg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2:
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;
}
示例3:
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;
}
示例4: log
int KSGLogBackend::log(ACE_Log_Record& log_record)
{
if(log_record.type() < _priority )
return 0;
ACE_TCHAR msg_data[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
ACE_OS::sprintf(msg_data,"P[%d]F[%s]L[%d]- %s\n",ACE_OS::thr_self(),ACE_LOG_MSG->file()
,ACE_LOG_MSG->linenum(),log_record.msg_data());
log_record.msg_data(msg_data);
log_record.format_msg(ACE_LOG_MSG->local_host(),ACE_LOG_MSG->flags()
,msg_data);
int len = ACE_OS::strlen(msg_data);
if(_log_app & laStdout)
ACE_OS::printf(msg_data);
if(_log_app & laFile)
log2file(msg_data,len);
#ifndef WIN32
if(_log_app & laSyslog)
log2syslog(log_record);
#endif
return 0;
}