summaryrefslogtreecommitdiff
path: root/apps/Orbix-Examples/Logger/Logger.h
blob: 5832c96aab68dff89d11bf96ee770fd510ae2fd8 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* -*- C++ -*- */
// $Id$


#if !defined (_LOGGER_H)
#define _LOGGER_H

#include "ace/OS.h"
#include "logger.hh"

class Logger
  // = TITLE
  //     Wrapper class that uses CORBA object reference 
  //     as the transport mechanism to simplify implementation.
{
public:
  Logger (char *server, size_t max_message_size);
  // Constructor takes the name of the host where the server
  // is located.  If server == 0, then use the locator service.

  ~Logger (void);
  // Destructor releases the object reference.

  int log (logger::Log_Priority prio, char msg[], int len);
  // Log a <msg> of length <len> with priority <prio>.

  int verbose (void);
  // Report current level of verbosity.

  int verbose (int verbosity);
  // Set the level of verbosity (0 == no verbose, > 0 == verbose).

  int start_timer (void);
  // Activate the timer.

  int stop_timer (profile_logger::Elapsed_Time &et);
  // Deactivate the timer and return the elapsed time.
  
private:
  profile_logger *logref_;
  // CORBA object reference proxy.

  int pid_;
  // Process ID.

  u_long ip_;
  // IP address of self.

  logger::Log_Record log_msg_;
  // Cache certain non-changing values to avoid recomputing them.

  char *server_;
  // Name of server that we are bound to.
};

#endif /* _LOGGER_H */