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:
Brian Anderson 2012-01-13 13:20:11 -08:00
parent f5f36e8b49
commit 79207321ae
2 changed files with 28 additions and 1 deletions

View File

@ -10,7 +10,7 @@
export box, char, float, bessel, f32, f64, int, str, ptr;
export uint, u8, u32, u64, vec, bool;
export either, option, result;
export ctypes, sys, unsafe, comm, task;
export ctypes, sys, unsafe, comm, task, logging;
export extfmt;
export math;
@ -52,6 +52,7 @@ mod sys;
mod unsafe;
mod comm;
mod task;
mod logging;
// Compiler support modules

26
src/libcore/logging.rs Normal file
View File

@ -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();
}