summaryrefslogtreecommitdiff
path: root/ace/Log_Msg_UNIX_Syslog.h
blob: 4c63d9de80ea87df185e713ac0a52b7e8125a052 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Log_Msg_UNIX_Syslog.h
 *
 *  $Id$
 *
 *  @author Jerry D. De Master <jdemaster@rite-solutions.com>
 */
//=============================================================================

#ifndef ACE_LOG_MSG_UNIX_SYSLOG_H
#define ACE_LOG_MSG_UNIX_SYSLOG_H
#include "ace/pre.h"

#include "ace/config-all.h"

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

#if !defined (ACE_WIN32) && !defined (ACE_LACKS_UNIX_SYSLOG)

#include "ace/Log_Msg_Backend.h"

/**
 * @class ACE_Log_Msg_UNIX_Syslog
 *
 * @brief Implements an ACE_Log_Msg_Backend that logs messages to a UNIX
 * system's syslog facility.
 */
class ACE_Export ACE_Log_Msg_UNIX_Syslog : public ACE_Log_Msg_Backend
{
public:
  /// Constructor
  ACE_Log_Msg_UNIX_Syslog (void);

  /// Destructor
  virtual ~ACE_Log_Msg_UNIX_Syslog (void);

  /// Open a new event log.
  /**
   * Initialize the event logging facility.
   * @param logger_key The name of the calling program. This name is
   *                   used as the @arg ident in the syslog entries. If
   *                   it is 0 (no name), the application name as
   *                   returned from ACE_Log_Msg::program_name() is used.
   */
  virtual int open (const ACE_TCHAR *logger_key);

  /// Reset the backend.
  virtual int reset (void);

  /// Close the backend completely.
  virtual int close (void);

  /// This is called when we want to log a message.
  virtual int log (ACE_Log_Record &log_record);

private:
  /// Convert an ACE_Log_Priority value to the corresponding syslog priority.
  int convert_log_priority (int lm_priority);

  /// Convert an ACE_Log_Priority mask to the corresponding syslog mask value.
  int convert_log_mask (int lm_mask);
};

#endif /* !ACE_WIN32 && !ACE_HAS_WINCE */

#include "ace/post.h"
#endif /* ACE_LOG_MSG_UNIX_SYSLOG_H */