summaryrefslogtreecommitdiffstats
path: root/src/syslog.rs
blob: 65c8283f49a9f57cb872f14fb62b80451596d455 (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
use std::ffi::c_int;

#[rustfmt::skip]
pub enum Level {
    Emergency = 0,
    Alert     = 1,
    Critical  = 2,
    Error     = 3,
    Warning   = 4,
    Notice    = 5,
    Info      = 6,
    Debug     = 7,
}

#[rustfmt::skip]
pub enum Facility {
    Kernel   =  0 << 3,
    User     =  1 << 3,
    Mail     =  2 << 3,
    Daemon   =  3 << 3,
    Auth     =  4 << 3,
    Syslog   =  5 << 3,
    Lpr      =  6 << 3,
    News     =  7 << 3,
    Uucp     =  8 << 3,
    Cron     =  9 << 3,
    AuthPriv = 10 << 3,
    Ftp      = 11 << 3,
    Local0   = 12 << 3,
    Local1   = 13 << 3,
    Local2   = 14 << 3,
    Local3   = 15 << 3,
    Local4   = 16 << 3,
    Local5   = 17 << 3,
    Local6   = 18 << 3,
    Local7   = 19 << 3,
}

pub struct Priority {
    pub level: Level,
    pub facility: Facility,
}

impl Into<c_int> for Priority {
    fn into(self) -> c_int {
        self.level as c_int | self.facility as c_int
    }
}