Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / APG / Logging / Use_Ostream.cpp
blob8834e497fe1207491c370d2881ff3b5e0723e03c
1 #include "ace/Log_Msg.h"
2 #include "ace/streams.h"
4 void foo ();
6 int ACE_TMAIN (int, ACE_TCHAR *[])
8 ACE_TRACE ("main");
10 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%IHi Mom\n")));
12 /* Alternatively, you can use the set_flags() method to do the same
13 thing after the singleton has been created:
15 // Listing 2 code/ch03
16 ACE_OSTREAM_TYPE *output =
17 (ACE_OSTREAM_TYPE *) new ofstream ("ostream.output.test");
18 ACE_LOG_MSG->msg_ostream (output, 1);
19 ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
20 ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR);
21 // Listing 2
23 foo ();
24 ACE_DEBUG ((LM_INFO, ACE_TEXT ("%IGoodnight\n")));
26 return 0;
29 void foo ()
31 ACE_TRACE ("foo");
33 ACE_DEBUG ((LM_INFO, ACE_TEXT ("%IHowdy Pardner\n")));