Skip to content

Commit

Permalink
Merge pull request #371 from KodrAus/cargo/0.4.10
Browse files Browse the repository at this point in the history
Prepare for 0.4.10 release
  • Loading branch information
KodrAus authored Dec 16, 2019
2 parents 62c0975 + fbd138a commit 4e196f9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [0.4.10] - 2019-12-16

### Fixed

* Fixed the `log!` macros so they work in expression context (this regressed in `0.4.9`, which has been yanked).

## [0.4.9] - 2019-12-12

### Minimum Supported Rust Version
Expand Down Expand Up @@ -149,7 +155,8 @@ version using log 0.4.x to avoid losing module and file information.

Look at the [release tags] for information about older releases.

[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.8...HEAD
[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.10...HEAD
[0.4.10]: https://github.com/rust-lang-nursery/log/compare/0.4.9...0.4.10
[0.4.9]: https://github.com/rust-lang-nursery/log/compare/0.4.8...0.4.9
[0.4.8]: https://github.com/rust-lang-nursery/log/compare/0.4.7...0.4.8
[0.4.7]: https://github.com/rust-lang-nursery/log/compare/0.4.6...0.4.7
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "log"
version = "0.4.9" # remember to update html_root_url
version = "0.4.10" # remember to update html_root_url
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
#![doc(
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://docs.rs/log/0.4.9"
html_root_url = "https://docs.rs/log/0.4.10"
)]
#![warn(missing_docs)]
#![deny(missing_debug_implementations)]
Expand Down
24 changes: 13 additions & 11 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@
#[macro_export(local_inner_macros)]
macro_rules! log {
// log!(target: "...", "...")
(target: $target:expr, $lvl:expr, $e:expr) => {
(target: $target:expr, $lvl:expr, $e:expr) => (
$crate::log_impl!(target: $target, $lvl, ($e));
};
);

// log!(target: "...", "...", args...)
(target: $target:expr, $lvl:expr, $e:expr, $($rest:tt)*) => {
(target: $target:expr, $lvl:expr, $e:expr, $($rest:tt)*) => (
$crate::log_impl!(target: $target, $lvl, ($e) $($rest)*);
};
);

// log!("...", args...)
($lvl:expr, $($arg:tt)+) => ($crate::log!(target: __log_module_path!(), $lvl, $($arg)+))
($lvl:expr, $($arg:tt)+) => (
$crate::log!(target: __log_module_path!(), $lvl, $($arg)+);
)
}

#[macro_export(local_inner_macros)]
Expand Down Expand Up @@ -83,19 +85,19 @@ macro_rules! log_impl {
}};

// Trailing k-v pairs with trailing comma
(target: $target:expr, $lvl:expr, ($($e:expr),*) { $($key:ident : $value:expr,)* }) => {
(target: $target:expr, $lvl:expr, ($($e:expr),*) { $($key:ident : $value:expr,)* }) => (
$crate::log_impl!(target: $target, $lvl, ($($e),*) { $($key : $value),* });
};
);

// Last expression arg with no trailing comma
(target: $target:expr, $lvl:expr, ($($e:expr),*) $arg:expr) => {
(target: $target:expr, $lvl:expr, ($($e:expr),*) $arg:expr) => (
$crate::log_impl!(target: $target, $lvl, ($($e,)* $arg));
};
);

// Expression arg
(target: $target:expr, $lvl:expr, ($($e:expr),*) $arg:expr, $($rest:tt)*) => {
(target: $target:expr, $lvl:expr, ($($e:expr),*) $arg:expr, $($rest:tt)*) => (
$crate::log_impl!(target: $target, $lvl, ($($e,)* $arg) $($rest)*);
};
)
}

/// Logs a message at the error level.
Expand Down

0 comments on commit 4e196f9

Please sign in to comment.