• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #[diplomat::abi_rename = "icu4x_{0}_mv1"]
7 #[diplomat::attr(auto, namespace = "icu4x")]
8 pub mod ffi {
9     use alloc::boxed::Box;
10 
11     #[diplomat::opaque]
12     /// An object allowing control over the logging used
13     pub struct Logger;
14 
15     impl Logger {
16         /// Initialize the logger using `simple_logger`
17         ///
18         /// Requires the `simple_logger` Cargo feature.
19         ///
20         /// Returns `false` if there was already a logger set.
21         #[cfg(all(not(target_arch = "wasm32"), feature = "simple_logger"))]
init_simple_logger() -> bool22         pub fn init_simple_logger() -> bool {
23             simple_logger::init().is_ok()
24         }
25     }
26 }
27