static int
test_format_specs (void)
{
#if 0
  Log_Spec_Verify  verifier;
  ACE_Log_Msg      logger;

  if (logger.open (ACE_TEXT ("Log_Msg_Test"), ACE_Log_Msg::MSG_CALLBACK) != 0)
    ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
                       ACE_TEXT ("%T: test_format_specs open")),
                      1);
  logger.msg_callback (&verifier);

  logger.linenum (42);
  logger.file (ACE_TEXT ("Log_Msg_Test.cpp"));
  logger.log (LM_DEBUG, ACE_TEXT ("l1:%l"));
  logger.log (LM_DEBUG, ACE_TEXT ("l2:%5l"));
  logger.log (LM_DEBUG, ACE_TEXT ("l3N1:%0*l,%.7N"), 4);
  return verifier.result ();
#else
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l1:%l\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l2:%5l\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l3N1:%0*l,%.7N\n"), 4));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%*ISTART INDENTING %{\n"), 4));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%IONE%{\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%ITWO%{\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%ITHREE\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%ITWO\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%IONE\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%IENDINDENTING\n")));
  errno = ENOENT;
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%m %p\n"), ACE_TEXT("perror")));
  return 0;
#endif
}
Ejemplo n.º 2
0
static int
test_format_specs (void)
{
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l1:%l\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l2:%5l\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l3N1:%0*l,%.7N\n"), 4));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%*ISTART INDENTING %{\n"), 4));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%IONE%{\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%ITWO%{\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%ITHREE\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%ITWO\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%IONE\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%IENDINDENTING\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%W\n"), ACE_TEXT_WIDE ("My string test\n")));
  ACE_TCHAR* nill_string = 0;
  char* char_nill_string = 0;
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%W\n"), nill_string));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), nill_string));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%C\n"), char_nill_string));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%m %p\n"), nill_string));
  errno = ENOENT;
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%m %p\n"), ACE_TEXT("perror")));

  Log_Spec_Verify  verifier;

  ACE_LOG_MSG->msg_callback (&verifier);
  ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE);
  ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE);
  ACE_LOG_MSG->linenum (42);
  ACE_LOG_MSG->file ("Log_Msg_Test.cpp");

  ACE_LOG_MSG->log (LM_DEBUG, ACE_TEXT ("l1:%l"));
  ACE_LOG_MSG->log (LM_DEBUG, ACE_TEXT ("l2:%5l"));
  ACE_LOG_MSG->log (LM_DEBUG, ACE_TEXT ("l3N1:%0*l,%.7N"), 4);
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l4:%T")));
  ACE_LOG_MSG->msg_ostream (ace_file_stream::instance ()->output_file ());
  ACE_LOG_MSG->msg_callback (0);
  ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
  ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE);

  return verifier.result ();
}
Ejemplo n.º 3
0
static int
test_format_specs (void)
{
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l1:%l\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l2:%5l\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l3N1:%0*l,%.7N\n"), 4));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%*ISTART INDENTING %{\n"), 4));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%IONE%{\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%ITWO%{\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%ITHREE\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%ITWO\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%IONE\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%}%IENDINDENTING\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%W\n"), ACE_TEXT_WIDE ("My string test\n")));
  ACE_TCHAR* nill_string = 0;
  char* char_nill_string = 0;
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%W\n"), nill_string));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), nill_string));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%C\n"), char_nill_string));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%m %p\n"), nill_string));
  errno = ENOENT;
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%m %p\n"), ACE_TEXT("perror")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%S\n"), SIGINT));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%S\n"), ACE_NSIG));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%D\n")));
  ACE_Time_Value tv = ACE_OS::gettimeofday ();
  tv += ACE_Time_Value (25*60*60); // + 25 hours
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%#D\n"), &tv));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%#T\n"), &tv));

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("thread id %t\n")));

  Log_Spec_Verify  verifier;

  ACE_LOG_MSG->msg_callback (&verifier);
  ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE);
  ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE);
  ACE_LOG_MSG->linenum (42);
  ACE_LOG_MSG->file ("Log_Msg_Test.cpp");

  ACE_LOG_MSG->log (LM_DEBUG, ACE_TEXT ("l1:%l"));
  ACE_LOG_MSG->log (LM_DEBUG, ACE_TEXT ("l2:%5l"));
  ACE_LOG_MSG->log (LM_DEBUG, ACE_TEXT ("l3N1:%0*l,%.7N"), 4);
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l4:%T")));

  ACE_LOG_MSG->priority_mask (LM_SHUTDOWN |
                              LM_TRACE |
                              LM_DEBUG |
                              LM_INFO |
                              LM_NOTICE |
                              LM_WARNING |
                              LM_STARTUP |
                              LM_ERROR |
                              LM_CRITICAL |
                              LM_ALERT |
                              LM_EMERGENCY,
                              ACE_Log_Msg::PROCESS);
  ACE_DEBUG ((LM_SHUTDOWN, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_TRACE, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_INFO, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_NOTICE, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_WARNING, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_STARTUP, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_ERROR, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_CRITICAL, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_ALERT, ACE_TEXT ("l5:%.1M")));
  ACE_DEBUG ((LM_EMERGENCY, ACE_TEXT ("l5:%.1M")));

  ACE_LOG_MSG->msg_ostream (ace_file_stream::instance ()->output_file ());
  ACE_LOG_MSG->msg_callback (0);
  ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
  ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE);

  return verifier.result ();
}