Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / Reactor / Multicast / Log_Wrapper.h
blob13982529bce9905ed6c5f34b783580b5a10d51f4
1 /* -*- C++ -*- */
2 // log_wrapper.h
4 #include "ace/Profile_Timer.h"
6 #if !defined (ACE_LACKS_PRAGMA_ONCE)
7 # pragma once
8 #endif /* ACE_LACKS_PRAGMA_ONCE */
10 #include "ace/INET_Addr.h"
11 #include "ace/SOCK_Dgram_Mcast.h"
13 #ifndef _LOG_WRAPPER_H
14 #define _LOG_WRAPPER_H
16 class Log_Wrapper
17 // = TITLE
18 // Provide a wrapper around sending log messages via IP
19 // multicast.
21 public:
22 Log_Wrapper ();
23 ~Log_Wrapper ();
25 // = Types of logging messages.
26 enum Log_Priority
28 LM_MESSAGE,
29 LM_DEBUG,
30 LM_WARNING,
31 LM_ERROR,
32 LM_EMERG
35 int open (const int port, const char* mcast_addr);
36 // Subscribe to a given UDP multicast group
38 int log_message (Log_Priority type, char *message);
39 // send a string to the logger
41 // = Format of the logging record.
42 struct Log_Record
44 u_long sequence_number;
45 Log_Priority type;
46 long host;
47 long time;
48 long app_id;
49 long msg_length;
52 private:
53 ACE_INET_Addr server_;
54 // Server address where records are logged.
56 u_long sequence_number_;
57 // Keep track of the sequence.
59 Log_Record log_msg_;
60 // One record used for many log messages.
62 ACE_SOCK_Dgram_Mcast logger_;
63 // A logger object.
66 #endif /* _LOG_WRAPPER_H */