File: Log_Wrapper.h

package info (click to toggle)
ace 6.0.3%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,368 kB
  • sloc: cpp: 341,826; perl: 30,850; ansic: 20,952; makefile: 10,144; sh: 4,744; python: 828; exp: 787; yacc: 511; xml: 330; lex: 158; lisp: 116; csh: 48; tcl: 5
file content (68 lines) | stat: -rw-r--r-- 1,304 bytes parent folder | download | duplicates (2)
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
57
58
59
60
61
62
63
64
65
66
67
68
/* -*- C++ -*- */
// $Id: Log_Wrapper.h 80826 2008-03-04 14:51:23Z wotte $

// log_wrapper.h

#include "ace/Profile_Timer.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/INET_Addr.h"
#include "ace/SOCK_Dgram_Mcast.h"

#ifndef _LOG_WRAPPER_H
#define _LOG_WRAPPER_H

class Log_Wrapper
  // = TITLE
  //      Provide a wrapper around sending log messages via IP
  //      multicast.
{
public:
  Log_Wrapper (void);
  ~Log_Wrapper (void);

  // = Types of logging messages.
  enum Log_Priority
  {
    LM_MESSAGE,
    LM_DEBUG,
    LM_WARNING,
    LM_ERROR,
    LM_EMERG
  };

  int open (const int port, const char* mcast_addr);
  // Subscribe to a given UDP multicast group

  int log_message (Log_Priority type, char *message);
  // send a string to the logger

  // = Format of the logging record.
  struct Log_Record
  {
    u_long sequence_number;
    Log_Priority type;
    long  host;
    long  time;
    long  app_id;
    long  msg_length;
  };

private:
  ACE_INET_Addr server_;
  // Server address where records are logged.

  u_long sequence_number_;
  // Keep track of the sequence.

  Log_Record log_msg_;
  // One record used for many log messages.

  ACE_SOCK_Dgram_Mcast logger_;
  // A logger object.
};

#endif /* _LOG_WRAPPER_H */