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
use std::ffi::{c_char, c_int};

#[repr(C)]
#[allow(non_camel_case_types)]
pub enum log_priority {
    DLOG_UNKNOWN = 0,
    DLOG_DEFAULT,
    DLOG_VERBOSE,
    DLOG_DEBUG,
    DLOG_INFO,
    DLOG_WARN,
    DLOG_ERROR,
    DLOG_FATAL,
    DLOG_SILENT,
    DLOG_PRIO_MAX,
}

#[repr(C)]
#[allow(non_camel_case_types)]
pub enum log_id_t {
    LOG_ID_INVALID = -1,
    LOG_ID_MAIN,
    LOG_ID_RADIO,
    LOG_ID_SYSTEM,
    LOG_ID_APPS,
    LOG_ID_KMSG,
    LOG_ID_SYSLOG,
    LOG_ID_MAX,
}

extern "C" {
    pub fn dlog_print(prio: log_priority, tag: *const c_char, fmt: *const c_char, ...) -> c_int;
    pub fn __dlog_critical_print(
        log_id: log_id_t,
        prio: c_int,
        tag: *const c_char,
        fmt: *const c_char,
        ...
    ) -> c_int;
    pub fn dlog_set_minimum_priority(priority: c_int) -> c_int;
}