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
extern crate libc;

use libc::{c_char, c_int, size_t};

#[repr(C)]
pub enum LogPriority {
    UNKNOWN = 0,
    DEFAULT,
    VERBOSE,
    DEBUG,
    INFO,
    WARN,
    ERROR,
    FATAL,
    SILENT,
}

#[link(name = "log")]
extern "C" {
    pub fn __android_log_write(prio: c_int,
                               tag: *const c_char,
                               text: *const c_char) -> c_int;

    pub fn __android_log_print(prio: c_int,
                               tag: *const c_char,
                               ...) -> c_int;

    // pub fn __android_log_vprint(prio: c_int,
    //                            tag: *const c_char,
    //                            fmt: *const c_char,
    //                            ap: va_list) -> c_int;

    pub fn __android_log_assert(prio: c_int,
                                tag: *const c_char,
                                fmt: *const c_char,
                                ...) -> !;

    pub fn __android_log_is_loggable(prio: c_int,
                                     tag: *const c_char,
                                     default_prio: c_int) -> c_int;

    pub fn __android_log_is_loggable_len(prio: c_int,
                                         tag: *const c_char,
                                         len: size_t,
                                         default_prio: c_int) -> c_int;
}