Skip to content
Closed
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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ release_max_level_info = []
release_max_level_debug = []
release_max_level_trace = []

nightly = []
nightly = ["log_panics"]
log_panics = []
use_std = []
default = ["use_std"]
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/log/")]
#![warn(missing_docs)]
#![cfg_attr(feature = "nightly", feature(panic_handler))]

#![cfg_attr(not(feature = "use_std"), no_std)]

Expand Down Expand Up @@ -783,14 +782,14 @@ impl error::Error for ShutdownLoggerError {
/// The format is the same as the default panic hook . The reporting module is
/// `log::panic`.
///
/// Requires the `use_std` (enabled by default) and `nightly` features.
#[cfg(all(feature = "nightly", feature = "use_std"))]
/// Requires the `use_std` (enabled by default) and `log_panics` features.
#[cfg(all(feature = "log_panics", feature = "use_std"))]
pub fn log_panics() {
std::panic::set_hook(Box::new(panic::log));
}

// inner module so that the reporting module is log::panic instead of log
#[cfg(all(feature = "nightly", feature = "use_std"))]
#[cfg(all(feature = "log_panics", feature = "use_std"))]
mod panic {
use std::panic::PanicInfo;
use std::thread;
Expand Down