libcore: Add core::logging::console_on/off functions
These affect logging output to stdout globally, and turning the console off has no effect when overridden by RUST_LOG.
This commit is contained in:
parent
f5f36e8b49
commit
79207321ae
|
@ -10,7 +10,7 @@
|
||||||
export box, char, float, bessel, f32, f64, int, str, ptr;
|
export box, char, float, bessel, f32, f64, int, str, ptr;
|
||||||
export uint, u8, u32, u64, vec, bool;
|
export uint, u8, u32, u64, vec, bool;
|
||||||
export either, option, result;
|
export either, option, result;
|
||||||
export ctypes, sys, unsafe, comm, task;
|
export ctypes, sys, unsafe, comm, task, logging;
|
||||||
export extfmt;
|
export extfmt;
|
||||||
export math;
|
export math;
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ mod sys;
|
||||||
mod unsafe;
|
mod unsafe;
|
||||||
mod comm;
|
mod comm;
|
||||||
mod task;
|
mod task;
|
||||||
|
mod logging;
|
||||||
|
|
||||||
// Compiler support modules
|
// Compiler support modules
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#[doc = "Logging"];
|
||||||
|
|
||||||
|
export console_on, console_off;
|
||||||
|
|
||||||
|
#[nolink]
|
||||||
|
native mod rustrt {
|
||||||
|
fn rust_log_console_on();
|
||||||
|
fn rust_log_console_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc = "Turns on logging to stdout globally"]
|
||||||
|
fn console_on() {
|
||||||
|
rustrt::rust_log_console_on();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(
|
||||||
|
brief =
|
||||||
|
"Turns off logging to stdout globally",
|
||||||
|
desc =
|
||||||
|
"Turns off the console unless the user has overridden the \
|
||||||
|
runtime environment's logging spec, e.g. by setting \
|
||||||
|
the RUST_LOG environment variable"
|
||||||
|
)]
|
||||||
|
fn console_off() {
|
||||||
|
rustrt::rust_log_console_off();
|
||||||
|
}
|
Loading…
Reference in New Issue