logger/lib.rs
1//! logger API suitable for C
2//!
3//! While we eventually want to move the implementation to Rust,
4//! Rust code should generally use Rust's `log` crate instead.
5//!
6//! Since we use this in the shim, we eventually want this to not depend on
7//! `std` nor `libc`. (The C part of the implementation currently uses libc).
8//! <https://github.com/shadow/shadow/issues/2919>
9
10// TODO:
11// #![no_std]
12
13// https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md
14#![deny(unsafe_op_in_unsafe_fn)]
15
16mod bindings {
17 #![allow(non_upper_case_globals)]
18 #![allow(non_camel_case_types)]
19 #![allow(non_snake_case)]
20 // https://github.com/rust-lang/rust/issues/66220
21 #![allow(improper_ctypes)]
22 include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
23}
24
25// For legacy compatibility.
26// TODO: wrap or replace with an idiomatic rust api.
27pub use bindings::*;
28
29// Force linking; currently only used from C code.
30extern crate linux_api;