/rust/registry/src/index.crates.io-1949cf8c6b5b557f/icu_capi-1.5.1/src/logging.rs
Line | Count | Source |
1 | | // This file is part of ICU4X. For terms of use, please see the file |
2 | | // called LICENSE at the top level of the ICU4X source tree |
3 | | // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |
4 | | |
5 | | #[diplomat::bridge] |
6 | | pub mod ffi { |
7 | | use alloc::boxed::Box; |
8 | | |
9 | | #[diplomat::opaque] |
10 | | /// An object allowing control over the logging used |
11 | | pub struct ICU4XLogger; |
12 | | |
13 | | impl ICU4XLogger { |
14 | | /// Initialize the logger using `simple_logger` |
15 | | /// |
16 | | /// Requires the `simple_logger` Cargo feature. |
17 | | /// |
18 | | /// Returns `false` if there was already a logger set. |
19 | | #[cfg(all(not(target_arch = "wasm32"), feature = "simple_logger"))] |
20 | 0 | pub fn init_simple_logger() -> bool { |
21 | 0 | simple_logger::init().is_ok() |
22 | 0 | } |
23 | | |
24 | | /// Deprecated: since ICU4X 1.4, this now happens automatically if the `log` feature is enabled. |
25 | | #[cfg(target_arch = "wasm32")] |
26 | | pub fn init_console_logger() -> bool { |
27 | | false |
28 | | } |
29 | | } |
30 | | } |
31 | | |
32 | | // semver? |
33 | | #[no_mangle] |
34 | | #[cfg(target_arch = "wasm32")] |
35 | | pub unsafe extern "C" fn icu4x_init() {} |