summaryrefslogtreecommitdiff
path: root/examples/APG/Logging/Use_Stderr.cpp
blob: e0418c4d36254a91ebab7568f80ec804d9163191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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")));
}