<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libstd/rt/logging.rs, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2014-03-16T05:26:36+00:00</updated>
<entry>
<title>log: Introduce liblog, the old std::logging</title>
<updated>2014-03-16T05:26:36+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-03-09T06:11:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cc6ec8df95fbd8163b7c2c6c34469fb96b704e66'/>
<id>urn:sha1:cc6ec8df95fbd8163b7c2c6c34469fb96b704e66</id>
<content type='text'>
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:

* The crate map has always been a bit of a code smell among rust programs. It
  has difficulty being loaded on almost all platforms, and it's used almost
  exclusively for logging and only logging. Removing the crate map is one of the
  end goals of this movement.

* The compiler has a fair bit of special support for logging. It has the
  __log_level() expression as well as generating a global word per module
  specifying the log level. This is unfairly favoring the built-in logging
  system, and is much better done purely in libraries instead of the compiler
  itself.

* Initialization of logging is much easier to do if there is no reliance on a
  magical crate map being available to set module log levels.

* If the logging library can be written outside of the standard library, there's
  no reason that it shouldn't be. It's likely that we're not going to build the
  highest quality logging library of all time, so third-party libraries should
  be able to provide just as high-quality logging systems as the default one
  provided in the rust distribution.

With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:

* The core change of this migration is that there is no longer a physical
  log-level per module. This concept is still emulated (it is quite useful), but
  there is now only a global log level, not a local one. This global log level
  is a reflection of the maximum of all log levels specified. The previously
  generated logging code looked like:

    if specified_level &lt;= __module_log_level() {
        println!(...)
    }

  The newly generated code looks like:

    if specified_level &lt;= ::log::LOG_LEVEL {
        if ::log::module_enabled(module_path!()) {
            println!(...)
        }
    }

  Notably, the first layer of checking is still intended to be "super fast" in
  that it's just a load of a global word and a compare. The second layer of
  checking is executed to determine if the current module does indeed have
  logging turned on.

  This means that if any module has a debug log level turned on, all modules
  with debug log levels get a little bit slower (they all do more expensive
  dynamic checks to determine if they're turned on or not).

  Semantically, this migration brings no change in this respect, but
  runtime-wise, this will have a perf impact on some code.

* A `RUST_LOG=::help` directive will no longer print out a list of all modules
  that can be logged. This is because the crate map will no longer specify the
  log levels of all modules, so the list of modules is not known. Additionally,
  warnings can no longer be provided if a malformed logging directive was
  supplied.

The new "hello world" for logging looks like:

    #[phase(syntax, link)]
    extern crate log;

    fn main() {
        debug!("Hello, world!");
    }
</content>
</entry>
<entry>
<title>std: Remove lots of allocations from log settings</title>
<updated>2014-02-28T20:24:50+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-02-28T04:25:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d89074c8ae11d52b3b92d73bc684f5b964a05cf5'/>
<id>urn:sha1:d89074c8ae11d52b3b92d73bc684f5b964a05cf5</id>
<content type='text'>
Most of these are unnecessary because we're only looking at static strings. This
also moves to Vec in a few places instead of ~[T].

This didn't end up getting much of a code size win (update_log_settings is the
third largest function in the executables I'm looking at), but this seems like a
generally nice improvement regardless.
</content>
</entry>
<entry>
<title>Fixup the rest of the tests in the compiler</title>
<updated>2014-01-08T07:51:38+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-01-07T08:57:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0547fb9cad4053f3ec66e722b7a05df259d63038'/>
<id>urn:sha1:0547fb9cad4053f3ec66e722b7a05df259d63038</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std: Fill in all missing imports</title>
<updated>2014-01-08T07:51:38+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-01-07T00:48:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=7e0443d6c4e683105f20de85dc4591cc5cf2518d'/>
<id>urn:sha1:7e0443d6c4e683105f20de85dc4591cc5cf2518d</id>
<content type='text'>
Fallout from the previous commits
</content>
</entry>
<entry>
<title>Support arbitrary stdout/stderr/logger handles</title>
<updated>2014-01-06T21:19:53+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-01-06T18:26:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ac2a24ecc9df66279a7b6df478593b34e1d2449f'/>
<id>urn:sha1:ac2a24ecc9df66279a7b6df478593b34e1d2449f</id>
<content type='text'>
This will allow capturing of common things like logging messages, stdout prints
(using stdio println), and failure messages (printed to stderr).  Any new prints
added to libstd should be funneled through these task handles to allow capture
as well.

Additionally, this commit redirects logging back through a `Logger` trait so the
log level can be usefully consumed by an arbitrary logger.

This commit also introduces methods to set the task-local stdout handles:

* std::io::stdio::set_stdout
* std::io::stdio::set_stderr
* std::io::logging::set_logger

These methods all return the previous logger just in case it needs to be used
for inspection.

I plan on using this infrastructure for extra::test soon, but we don't quite
have the primitives that I'd like to use for it, so it doesn't migrate
extra::test at this time.

Closes #6369
</content>
</entry>
<entry>
<title>std: print RUST_LOG=::help in sorted order.</title>
<updated>2013-12-31T12:47:15+00:00</updated>
<author>
<name>Huon Wilson</name>
<email>dbau.pp+github@gmail.com</email>
</author>
<published>2013-12-31T12:47:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d255d4a4ff394da96bb669fef7a70871e08498fa'/>
<id>urn:sha1:d255d4a4ff394da96bb669fef7a70871e08498fa</id>
<content type='text'>
Fixes #8949.
</content>
</entry>
<entry>
<title>Removed useless cmp::{min, max} reexports from the integer modules</title>
<updated>2013-11-29T19:19:22+00:00</updated>
<author>
<name>Marvin Löbel</name>
<email>loebel.marvin@gmail.com</email>
</author>
<published>2013-11-29T19:19:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0d8ace823b33489284cc60aaab3945d764ab3394'/>
<id>urn:sha1:0d8ace823b33489284cc60aaab3945d764ab3394</id>
<content type='text'>
</content>
</entry>
<entry>
<title>libstd: Remove all non-`proc` uses of `do` from libstd</title>
<updated>2013-11-26T16:23:57+00:00</updated>
<author>
<name>Patrick Walton</name>
<email>pcwalton@mimiga.net</email>
</author>
<published>2013-11-20T22:17:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1eca34de7dd55719cd83153994e5caf2027f62a2'/>
<id>urn:sha1:1eca34de7dd55719cd83153994e5caf2027f62a2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Removed unneccessary `_iter` suffixes from various APIs</title>
<updated>2013-11-26T09:02:26+00:00</updated>
<author>
<name>Marvin Löbel</name>
<email>loebel.marvin@gmail.com</email>
</author>
<published>2013-11-23T10:18:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=24b316a3b9567cb2cc2fb6644bd891dbf8855c18'/>
<id>urn:sha1:24b316a3b9567cb2cc2fb6644bd891dbf8855c18</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Move std::rt::io to std::io</title>
<updated>2013-11-12T04:44:07+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2013-11-11T06:46:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=49ee49296b65f3d807142f3326bee71dd7e13290'/>
<id>urn:sha1:49ee49296b65f3d807142f3326bee71dd7e13290</id>
<content type='text'>
</content>
</entry>
</feed>
