diff options
Diffstat (limited to 'examples/Log_Msg')
-rw-r--r-- | examples/Log_Msg/Callback.dsp | 61 | ||||
-rw-r--r-- | examples/Log_Msg/Log_Msg.dsp | 61 | ||||
-rw-r--r-- | examples/Log_Msg/Makefile | 86 | ||||
-rw-r--r-- | examples/Log_Msg/Ostream.dsp | 61 | ||||
-rw-r--r-- | examples/Log_Msg/README | 65 | ||||
-rw-r--r-- | examples/Log_Msg/test_callback.cpp | 159 | ||||
-rw-r--r-- | examples/Log_Msg/test_log_msg.cpp | 190 | ||||
-rw-r--r-- | examples/Log_Msg/test_ostream.cpp | 71 |
8 files changed, 0 insertions, 754 deletions
diff --git a/examples/Log_Msg/Callback.dsp b/examples/Log_Msg/Callback.dsp deleted file mode 100644 index 6e509057f85..00000000000 --- a/examples/Log_Msg/Callback.dsp +++ /dev/null @@ -1,61 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Callback" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Callback - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Callback.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Callback.mak" CFG="Callback - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Callback - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace"
-# Begin Target
-
-# Name "Callback - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=test_callback.cpp
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/examples/Log_Msg/Log_Msg.dsp b/examples/Log_Msg/Log_Msg.dsp deleted file mode 100644 index 7a20a91e488..00000000000 --- a/examples/Log_Msg/Log_Msg.dsp +++ /dev/null @@ -1,61 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Log_Msg" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Log_Msg - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Log_Msg.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Log_Msg.mak" CFG="Log_Msg - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Log_Msg - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\Debug"
-# PROP BASE Intermediate_Dir ".\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /out:".\test_log_msg.exe" /libpath:"..\..\ace"
-# Begin Target
-
-# Name "Log_Msg - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\test_log_msg.cpp
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/examples/Log_Msg/Makefile b/examples/Log_Msg/Makefile deleted file mode 100644 index 52c6e086f15..00000000000 --- a/examples/Log_Msg/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile for testing the Log_Msg logger -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = test_log_msg test_ostream test_callback - -LSRC = $(addsuffix .cpp,$(BIN)) - -LDLIBS = - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/test_log_msg.o .obj/test_log_msg.so .shobj/test_log_msg.o .shobj/test_log_msg.so: test_log_msg.cpp \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Record.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i -.obj/test_ostream.o .obj/test_ostream.so .shobj/test_ostream.o .shobj/test_ostream.so: test_ostream.cpp \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Record.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i -.obj/test_callback.o .obj/test_callback.so .shobj/test_callback.o .shobj/test_callback.so: test_callback.cpp \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Record.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Log_Msg/Ostream.dsp b/examples/Log_Msg/Ostream.dsp deleted file mode 100644 index c3a1cc938f0..00000000000 --- a/examples/Log_Msg/Ostream.dsp +++ /dev/null @@ -1,61 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Ostream" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Ostream - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Ostream.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Ostream.mak" CFG="Ostream - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Ostream - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace"
-# Begin Target
-
-# Name "Ostream - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\test_ostream.cpp
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/examples/Log_Msg/README b/examples/Log_Msg/README deleted file mode 100644 index 08e43550c04..00000000000 --- a/examples/Log_Msg/README +++ /dev/null @@ -1,65 +0,0 @@ -This directory contains program(s) that demonstrate how to use ACE's -Log_Msg class to record various information. - - * test_callback.cpp: This program tests the Log_Msg - abstraction wrt writing to user defined callback objects. - - * test_ostream.cpp: This program illustrates how the - ACE_Log_Msg abstraction can be used to write to - stderr and to a file. For even more sophisticated - use-cases of ACE_Log_Msg please see the - $ACE_ROOT/netsvcs/clients/Logger/ examples. - - * test_log_msg.cpp: This program tests various feature of the - Log_Msg facility. It opens a log file and writes some - messages using different log priorities and output stream. - - You can invoke the program with or without command - parameters. When invoked with any parameters like, - - ./Log_Msg foobar - - the log messages are direct to stdout (or, ostream in C++.) - In this case, the program simulates an error EWOULDBLOCK and - write an error log to stdout as, - - would block - op_status and errnum work! - - When invoked without any parameters, except does the same - test as above but logs to default log stream "stderr," the - program also demonstrates logging messages/errors with - different priority and changing the logging destination. A - sample output is, - - would block - op_status and errnum work! - 3.141600, hello = 10000 - 6.283200, world = 20000 - 6.283200, world = 20000 - 9.424800, world = 30000 - 12.566400, world = 40000 - 15.708000, world = 50000 - HEXDUMP 48 bytes - 01 00 00 00 02 00 00 00 04 00 00 00 08 00 00 00 ................ - 10 00 00 00 20 00 00 00 40 00 00 00 80 00 00 00 .... ...@....... - 00 01 00 00 00 02 00 00 00 04 00 00 00 08 00 00 ................ - ./Log_Msg.EXE: (2710), badname: Function not implemented - - In this test, there are two lines containing "world` = - 20000." That's because in the program, both stderr and - stdout are "turned on" for logging before writing this log - message. The line containing "world = 30000" is written to - stdout only. Rest of the lines are all to the stderr. You - can examine this behavior by redirecting stderr and stdout - to different files. - - The HEXDUMP output shows how to take an arbitrary object and - hexdump its content for debugging. Finally, the program - shows an ordinary use case of logging error messages using - the ACE_ERROR macro. - - If you look into the program, there is also a demonstration - showing how to disable certain priorities of error message - temporarily. - diff --git a/examples/Log_Msg/test_callback.cpp b/examples/Log_Msg/test_callback.cpp deleted file mode 100644 index fc29d20207a..00000000000 --- a/examples/Log_Msg/test_callback.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples/Log_Msg -// -// = FILENAME -// test_callback.cpp -// -// = DESCRIPTION -// This program tests the <ACE_Log_Msg> class wrt writing to user -// defined callback objects. In particular, it tests to make sure -// that nested callbacks don't deadlock. -// -// = AUTHOR -// Irfan Pyarali <irfan@cs.wustl.edu> -// -// ============================================================================ - -#include "ace/OS.h" - -ACE_RCSID(Log_Msg, test_callback, "$Id$") - -class Logger : public ACE_Log_Msg_Callback -{ -public: - Logger (int be_recursive = 1); - // Constructor sets whether we're testing "recursive" callback - // logging! - - void log (ACE_Log_Record &log_record); - // Logging callback - - void verbose (int be_verbose); - -private: - int verbose_logging_; - // Flag for testing verbose logging. - - int recursive_; - // Flag for testing recursive callback logging. -}; - -void -Logger::verbose (int be_verbose) -{ - this->verbose_logging_ = be_verbose; -} - -Logger::Logger (int be_recursive) - : recursive_ (be_recursive) -{ -} - -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 - { - char 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; -} - -int -main (int, char *[]) -{ - // This message should show up in stderr. - ACE_DEBUG ((LM_DEBUG, - "(%t) first message\n")); - - ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR); - - // This message should not show up anywhere. - ACE_DEBUG ((LM_DEBUG, - "(%t) second message\n")); - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::MSG_CALLBACK); - - // This message should not show up anywhere since no callback object - // has been specified. - ACE_DEBUG ((LM_DEBUG, - "(%t) third message\n")); - - // Create a callback object and make it "verbose". - Logger logger; - logger.verbose (1); - - // Set the callback object. - ACE_LOG_MSG->msg_callback (&logger); - - // This message should show up via the Logger callback. - ACE_DEBUG ((LM_DEBUG, - "(%t) forth message\n")); - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); - - // This message should show up via the Logger callback (somewhat - // verbosely). - ACE_DEBUG ((LM_DEBUG, - "(%t) fifth message\n")); - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE); - - // This message should show up via the Logger callback (really - // verbosely). - ACE_DEBUG ((LM_DEBUG, - "(%t) sixth message\n")); - - logger.verbose (0); - - // This message should show up via the Logger callback (not - // verbosely). - ACE_DEBUG ((LM_DEBUG, - "(%t) seventh message\n")); - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR); - - // This message should show up in stderr and the Logger callback. - // The one from the Logger callback will not be verbose, but the one - // from stderr should be verbose. - ACE_DEBUG ((LM_DEBUG, - "(%t) eight message\n")); - return 0; -} diff --git a/examples/Log_Msg/test_log_msg.cpp b/examples/Log_Msg/test_log_msg.cpp deleted file mode 100644 index 01b9340d7ef..00000000000 --- a/examples/Log_Msg/test_log_msg.cpp +++ /dev/null @@ -1,190 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples/Log_Msg -// -// = FILENAME -// test_log_msg.cpp -// -// = DESCRIPTION -// This program tests the Log_Msg abstraction and demontrates -// several use cases. -// -// = AUTHOR -// Douglas Schmidt <schmidt@cs.wustl.edu> -// -// ============================================================================ - -#include "ace/OS.h" -#include "ace/streams.h" - -ACE_RCSID(Log_Msg, test_log_msg, "$Id$") - -static void -cleanup (void) -{ - ACE_DEBUG ((LM_INFO, - "leaving (%P)!\n")); -} - -static void -cause_error (void) -{ - errno = EWOULDBLOCK; - ACE_ERROR ((LM_DEBUG, - "would block\n")); -} - -int -main (int argc, char *argv[]) -{ - // Note that the default behavior is to log to STDERR... - - int counter = 1 ; - - if (argc > 1) - { - if (ACE_LOG_MSG->open (argv[0], - ACE_Log_Msg::OSTREAM) == -1) - ACE_ERROR ((LM_ERROR, - "cannot open logger!!!\n")); - - cause_error (); - // Check to see what happened. - if (ACE_LOG_MSG->op_status () == -1 - && ACE_LOG_MSG->errnum () == EWOULDBLOCK) - ACE_DEBUG ((LM_DEBUG, - "op_status and errnum work!\n")); - else - ACE_ERROR ((LM_ERROR, - "op_status and errnum failed!\n")); - } - else - { - if (ACE_LOG_MSG->open (argv[0]) == -1) - ACE_ERROR ((LM_ERROR, - "cannot open logger!!!\n")); - - cause_error (); - - // Check to see what happened. - if (ACE_LOG_MSG->op_status () == -1 - && ACE_LOG_MSG->errnum () == EWOULDBLOCK) - ACE_DEBUG ((LM_DEBUG, - "op_status and errnum work!\n")); - else - ACE_ERROR ((LM_ERROR, - "op_status and errnum failed!\n")); - - // Exercise many different combinations of STDERR and OSTREAM. - - ACE_DEBUG ((LM_INFO, - "%10f, %*s%s = %d\n", - 3.1416 * counter++, - 8, - "", - "hello", - 10000)); - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); - ACE_LOG_MSG->msg_ostream (&cout); - - ACE_DEBUG ((LM_INFO, - "%10f, %*s%s = %d\n", - 3.1416 * counter, - 8, - "", - "world", - 10000 * counter++)); - - ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR); - - ACE_DEBUG ((LM_INFO, - "%10f, %*s%s = %d\n", - 3.1416 * counter, - 8, - "", - "world", - 10000 * counter++)); - - ACE_LOG_MSG->msg_ostream (0); - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR); - - ACE_DEBUG ((LM_INFO, - "%10f, %*s%s = %d\n", - 3.1416 * counter, - 8, - "", - "world", - 10000 * counter++)); - - ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM); - ACE_LOG_MSG->msg_ostream (&cerr); - - ACE_DEBUG ((LM_INFO, - "%10f, %*s%s = %d\n", - 3.1416 * counter, - 8, - "", - "world", - 10000 * counter++)); - - static int array[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048}; - - // Print out the binary bytes of the array in hex form. - ACE_LOG_MSG->log_hexdump (LM_DEBUG, - (char *) array, - sizeof array); - - // Disable the LM_DEBUG and LM_INFO messages. - int priority_mask = ACE_LOG_MSG->priority_mask (); - ACE_CLR_BITS (priority_mask, - LM_DEBUG | LM_INFO); - ACE_LOG_MSG->priority_mask (priority_mask); - - ACE_DEBUG ((LM_INFO, - "This LM_INFO message should not print!\n")); - ACE_DEBUG ((LM_DEBUG, - "This LM_DEBUG message should not print!\n")); - - ACE_SET_BITS (priority_mask, - LM_INFO); - ACE_LOG_MSG->priority_mask (priority_mask, - ACE_Log_Msg::PROCESS); - - ACE_DEBUG ((LM_INFO, - "This LM_INFO message should print!\n")); - ACE_DEBUG ((LM_DEBUG, - "This LM_DEBUG message should not print!\n")); - - ACE_CLR_BITS (priority_mask, LM_INFO); - ACE_LOG_MSG->priority_mask (priority_mask, - ACE_Log_Msg::PROCESS); - - ACE_DEBUG ((LM_INFO, - "This LM_INFO message should not print!\n")); - ACE_DEBUG ((LM_DEBUG, - "This LM_DEBUG message should not print!\n")); - - char badname[] = "badname"; - - char *l_argv[2]; - l_argv[0] = badname; - l_argv[1] = 0; - - if (ACE_OS::execv (badname, - l_argv) == -1) - { - ACE_ERROR ((LM_ERROR, - "%n: (%x), %p%r\n", - 10000, - badname, - cleanup)); - ACE_OS::_exit (); - } - } - return 0; -} diff --git a/examples/Log_Msg/test_ostream.cpp b/examples/Log_Msg/test_ostream.cpp deleted file mode 100644 index 86accbea5b2..00000000000 --- a/examples/Log_Msg/test_ostream.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples/Log_Msg -// -// = FILENAME -// test_ostream.cpp -// -// = DESCRIPTION -// This program tests the Log_Msg abstraction wrt writing to -// stderr and to a file. -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/OS.h" -#include "ace/streams.h" - -ACE_RCSID(Log_Msg, test_ostream, "$Id$") - -int -main (int, char *[]) -{ - // This message should show up in stderr. - ACE_DEBUG ((LM_DEBUG, - "first message\n")); - - ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR); - - // This message should not show up anywhere. - ACE_DEBUG ((LM_DEBUG, - "second message\n")); - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); - - // This message should not show up anywhere since no ostream has - // been specified. - ACE_DEBUG ((LM_DEBUG, - "third message\n")); - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) - // Create a persistent store. - const char *filename = "output"; - int flags = ios::out | ios::trunc; - ofstream myostream (filename, flags); - - // Check for errors. - if (myostream.bad ()) - return 1; - - // Set the ostream. - ACE_LOG_MSG->msg_ostream (&myostream); - - // This message should show up in the ostream. - ACE_DEBUG ((LM_DEBUG, - "fourth message\n")); -#endif /* ACE_LACKS_IOSTREAM_TOTALLY */ - - ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR); - - // This message should show up in stderr and the ostream (without - // ACE_LACKS_IOSTREAM_TOTALLY). - ACE_DEBUG ((LM_DEBUG, - "fifth message\n")); - - return 0; -} |