summaryrefslogtreecommitdiff
path: root/ACE/examples/APG/Logging/Use_Stderr.cpp
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:30 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:30 +0000
commitc44379cc7d9c7aa113989237ab0f56db12aa5219 (patch)
tree66a84b20d47f2269d8bdc6e0323f338763424d3a /ACE/examples/APG/Logging/Use_Stderr.cpp
parent3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (diff)
downloadATCD-c44379cc7d9c7aa113989237ab0f56db12aa5219.tar.gz
Repo restructuring
Diffstat (limited to 'ACE/examples/APG/Logging/Use_Stderr.cpp')
-rw-r--r--ACE/examples/APG/Logging/Use_Stderr.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/ACE/examples/APG/Logging/Use_Stderr.cpp b/ACE/examples/APG/Logging/Use_Stderr.cpp
new file mode 100644
index 00000000000..e0418c4d362
--- /dev/null
+++ b/ACE/examples/APG/Logging/Use_Stderr.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#include "ace/Log_Msg.h"
+
+void foo (void);
+
+// Listing 1 code/ch03
+int ACE_TMAIN (int, ACE_TCHAR *argv[])
+{
+ // open() requires the name of the application
+ // (e.g. -- argv[0]) because the underlying
+ // implementation may use it in the log output.
+ ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::STDERR);
+ // Listing 1
+
+ /* Alternatively, you can use the set_flags() method to do the same
+ thing after the singleton has been created:
+ */
+
+ ACE_TRACE ("main");
+
+ // Listing 2 code/ch03
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%IHi Mom\n")));
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR);
+ foo ();
+ // Listing 2
+
+ ACE_DEBUG ((LM_INFO, ACE_TEXT ("%IGoodnight\n")));
+
+ return 0;
+}
+
+void foo (void)
+{
+ ACE_TRACE ("foo");
+
+ ACE_DEBUG ((LM_INFO, ACE_TEXT ("%IHowdy Pardner\n")));
+}