android_log_sys/
lib.rs

1// Copyright 2016 The android_log_sys Developers
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7
8use std::os::raw;
9
10#[allow(non_camel_case_types)]
11pub type c_va_list = raw::c_void;
12#[allow(non_camel_case_types)]
13pub type c_int = raw::c_int;
14#[allow(non_camel_case_types)]
15pub type c_char = raw::c_char;
16#[allow(non_camel_case_types)]
17pub type c_size_t = raw::c_ulong;
18
19// automatically generated by rust-bindgen
20
21#[derive(Clone, Copy)]
22#[repr(isize)]
23pub enum LogPriority {
24    UNKNOWN = 0,
25    DEFAULT = 1,
26    VERBOSE = 2,
27    DEBUG = 3,
28    INFO = 4,
29    WARN = 5,
30    ERROR = 6,
31    FATAL = 7,
32    SILENT = 8,
33}
34
35#[allow(non_camel_case_types)]
36#[derive(Clone, Copy)]
37#[non_exhaustive]
38#[repr(i32)]
39pub enum log_id_t {
40    MAIN = 0,
41    RADIO = 1,
42    EVENTS = 2,
43    SYSTEM = 3,
44    CRASH = 4,
45    STATS = 5,
46    SECURITY = 6,
47    KERNEL = 7,
48    MAX = 8,
49    DEFAULT = 0x7FFFFFFF,
50}
51
52#[allow(non_camel_case_types)]
53#[repr(C)]
54#[derive(Debug, Copy, Clone)]
55pub struct __android_log_message {
56    pub struct_size: usize,
57    pub buffer_id: i32,
58    pub priority: i32,
59    pub tag: *const c_char,
60    pub file: *const c_char,
61    pub line: u32,
62    pub message: *const c_char,
63}
64
65#[link(name = "log")]
66extern "C" {
67    pub fn __android_log_write(prio: c_int,
68                               tag: *const c_char,
69                               text: *const c_char)
70                               -> c_int;
71    pub fn __android_log_buf_write(bufID: c_int,
72                                   prio: c_int,
73                                   tag: *const c_char,
74                                   text: *const c_char)
75                                   -> c_int;
76    pub fn __android_log_print(prio: c_int,
77                               tag: *const c_char,
78                               fmt: *const c_char,
79                               ...)
80                               -> c_int;
81    pub fn __android_log_vprint(prio: c_int,
82                                tag: *const c_char,
83                                fmt: *const c_char,
84                                ap: *mut c_va_list)
85                                -> c_int;
86    pub fn __android_log_assert(cond: *const c_char,
87                                tag: *const c_char,
88                                fmt: *const c_char,
89                                ...);
90    pub fn __android_log_is_loggable(prio: c_int,
91                                     tag: *const c_char,
92                                     default_prio: c_int)
93                                     -> c_int;
94    pub fn __android_log_is_loggable_len(prio: c_int,
95                                         tag: *const c_char,
96                                         size: c_size_t,
97                                         default_prio: c_int)
98                                         -> c_int;
99    pub fn __android_log_write_log_message(log_message: *mut __android_log_message);
100}