Skip to content

Commit 52dd33e

Browse files
committed
---
yaml --- r: 88835 b: refs/heads/snap-stage3 c: 7627081 h: refs/heads/master i: 88833: 25a8113 88831: b60752b v: v3
1 parent aec0bfc commit 52dd33e

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: dd19785f963fd1045e53447add17ab36ca41fc79
4+
refs/heads/snap-stage3: 76270816d527bfceef64bf6cbdc64f985ca73eba
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/logging.rs

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,16 @@ pub static ERROR: u32 = 1;
118118
/// It is not recommended to call this function directly, rather it should be
119119
/// invoked through the logging family of macros.
120120
pub fn log(_level: u32, args: &fmt::Arguments) {
121-
unsafe {
122-
let optional_task: Option<*mut Task> = Local::try_unsafe_borrow();
123-
match optional_task {
124-
Some(local) => {
125-
// Lazily initialize the local task's logger
126-
match (*local).logger {
127-
// Use the available logger if we have one
128-
Some(ref mut logger) => { logger.log(args); }
129-
None => {
130-
let mut logger = StdErrLogger::new();
131-
logger.log(args);
132-
(*local).logger = Some(logger);
133-
}
134-
}
135-
}
136-
// If there's no local task, then always log to stderr
137-
None => {
138-
let mut logger = StdErrLogger::new();
139-
logger.log(args);
140-
}
141-
}
121+
let mut logger = {
122+
let mut task = Local::borrow(None::<Task>);
123+
task.get().logger.take()
124+
};
125+
126+
if logger.is_none() {
127+
logger = Some(StdErrLogger::new());
142128
}
129+
logger.get_mut_ref().log(args);
130+
131+
let mut task = Local::borrow(None::<Task>);
132+
task.get().logger = logger;
143133
}

0 commit comments

Comments
 (0)