From ceb29314a7e6fc2d9f3527e36534b2d1608394d8 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 2 May 2014 19:32:47 -0700 Subject: 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] --- src/libstd/fmt/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libstd') 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. -- cgit 1.4.1-3-g733a5