summaryrefslogtreecommitdiff
path: root/src/include/syslogdevice.h
blob: f0d32edcc2b4acbdc99a59fd0f6397bee79cf74b (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
/**
 *  @file Syslogdevice.h
 *  @brief Declaration of the SyslogDevice class.
 *  @author Andreas Aardal Hanssen
 *  @date 2002, 2003
 */

#ifndef syslogdevice_h_included
#define syslogdevice_h_included

#include "iodevice.h"

#include <syslog.h>

namespace Binc {
  class SyslogDevice : public IODevice {
  public:
    SyslogDevice(int flags,
                 const char *ident = "bincimap",
                 int option = LOG_NDELAY | LOG_PID,
                 int facility = LOG_USER);
    ~SyslogDevice();

    void setPriority(int p);

    std::string service() const;

  protected:
    bool waitForWrite() const;
    bool waitForRead() const;

    WriteResult write();
    bool fillInputBuffer();

  private:
    static std::string ident;

    int option;
    int facility;
    int priority;
  };
}

#endif