@@ -247,9 +247,10 @@ impl fmt::Show for LogLevel {
247
247
impl Logger for DefaultLogger {
248
248
fn log ( & mut self , record : & LogRecord ) {
249
249
match writeln ! ( & mut self . handle,
250
- "{}:{}: {}" ,
250
+ "{}:{}:{}: {}" ,
251
251
record. level,
252
252
record. module_path,
253
+ record. task_name,
253
254
record. args) {
254
255
Err ( e) => panic ! ( "failed to log: {}" , e) ,
255
256
Ok ( ( ) ) => { }
@@ -275,7 +276,7 @@ impl Drop for DefaultLogger {
275
276
/// It is not recommended to call this function directly, rather it should be
276
277
/// invoked through the logging family of macros.
277
278
#[ doc( hidden) ]
278
- pub fn log ( level : u32 , loc : & ' static LogLocation , args : & fmt:: Arguments ) {
279
+ pub fn log ( level : u32 , loc : LogLocation , args : & fmt:: Arguments ) {
279
280
// Test the literal string from args against the current filter, if there
280
281
// is one.
281
282
match unsafe { FILTER . as_ref ( ) } {
@@ -297,6 +298,9 @@ pub fn log(level: u32, loc: &'static LogLocation, args: &fmt::Arguments) {
297
298
file : loc. file ,
298
299
module_path : loc. module_path ,
299
300
line : loc. line ,
301
+ task_name : loc. task_name
302
+ . as_ref ( ) . map ( |s| & * * s)
303
+ . unwrap_or ( "<unnamed>" ) ,
300
304
} ) ;
301
305
set_logger ( logger) ;
302
306
}
@@ -335,13 +339,17 @@ pub struct LogRecord<'a> {
335
339
336
340
/// The line number of where the LogRecord originated.
337
341
pub line : uint ,
342
+
343
+ /// The task name of the task where the LogRecord originated.
344
+ pub task_name : & ' a str
338
345
}
339
346
340
347
#[ doc( hidden) ]
341
348
pub struct LogLocation {
342
349
pub module_path : & ' static str ,
343
350
pub file : & ' static str ,
344
351
pub line : uint ,
352
+ pub task_name : Option < String >
345
353
}
346
354
347
355
/// Tests whether a given module's name is enabled for a particular level of
0 commit comments