Skip to content

Cleanup the log crate a little. #29044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/liblog/directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
spec);
return (dirs, None);
}
mods.map(|m| {
if let Some(m) = mods {
for s in m.split(',') {
if s.is_empty() {
continue
Expand Down Expand Up @@ -83,7 +83,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
level: log_level,
});
}
});
}

(dirs, filter.map(str::to_owned))
}
Expand Down
3 changes: 1 addition & 2 deletions src/liblog/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ pub fn log_level() -> u32 {
/// Replaces the thread-local logger with the specified logger, returning the old
/// logger.
pub fn set_logger(logger: Box<Logger + Send>) -> Option<Box<Logger + Send>> {
let mut l = Some(logger);
LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), l.take()))
LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), Some(logger)))
}

/// A LogRecord is created by the logging macros, and passed as the only
Expand Down