3 //! To use in a debug build, set the env var `RAYON_LOG=1`. In a
4 //! release build, logs are compiled out. You will have to change
5 //! `DUMP_LOGS` to be `true`.
7 //! **Old environment variable:** `RAYON_LOG` is a one-to-one
8 //! replacement of the now deprecated `RAYON_RS_LOG` environment
9 //! variable, which is still supported for backwards compatibility.
11 #[cfg(debug_assertions)]
14 #[cfg_attr(debug_assertions, derive(Debug))]
15 #[cfg_attr(not(debug_assertions), allow(dead_code))]
16 pub(super) enum Event
{
78 JobPanickedErrorStored
{
81 JobPanickedErrorNotStored
{
84 ScopeCompletePanicked
{
87 ScopeCompleteNoPanic
{
92 #[cfg(debug_assertions)]
93 lazy_static
::lazy_static
! {
94 pub(super) static ref LOG_ENV
: bool
=
95 env
::var("RAYON_LOG").is_ok() || env
::var("RAYON_RS_LOG").is_ok();
98 #[cfg(debug_assertions)]
101 if *$
crate::log
::LOG_ENV
{
102 eprintln
!("{:?}", $event
);
107 #[cfg(not(debug_assertions))]
111 // Expand `$event` so it still appears used, but without
112 // any of the formatting code to be optimized away.