diff options
| author | Sean McArthur <sean.monstar@gmail.com> | 2014-05-02 19:32:47 -0700 |
|---|---|---|
| committer | Sean McArthur <sean.monstar@gmail.com> | 2014-05-05 11:18:53 -0700 |
| commit | ceb29314a7e6fc2d9f3527e36534b2d1608394d8 (patch) | |
| tree | 9889b1d7c7f928cc51b511f866c4e4e7caf9cda9 /src/libstd | |
| parent | b5d6b07370b665df6b54fa20e971e61041a233b0 (diff) | |
| download | rust-ceb29314a7e6fc2d9f3527e36534b2d1608394d8.tar.gz rust-ceb29314a7e6fc2d9f3527e36534b2d1608394d8.zip | |
log: Logger receiveis a LogRecord
The logging macros now create a LogRecord, and pass that to the
Logger, instead of passing a `level` and `args`. The new signature is:
trait Logger {
fn log(&mut self, record: &LogRecord);
}
The LogRecord includes additional values that may be useful to custom
loggers, and also allows for further expansion if not values are found
useful.
DefaultLogger's formatting was taken from Python's default formatting:
`LEVEL:from: message`
Also included: fmt::Arguments now implement Show, so they can be used to
extend format strings.
[breaking-change]
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fmt/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs index 8e4d8707cca..e225dc42e05 100644 --- a/src/libstd/fmt/mod.rs +++ b/src/libstd/fmt/mod.rs @@ -565,6 +565,12 @@ pub struct Arguments<'a> { args: &'a [Argument<'a>], } +impl<'a> Show for Arguments<'a> { + fn fmt(&self, fmt: &mut Formatter) -> Result { + write(fmt.buf, self) + } +} + /// When a format is not otherwise specified, types are formatted by ascribing /// to this trait. There is not an explicit way of selecting this trait to be /// used for formatting, it is only if no other format is specified. |
