From d1a1b3647f332e094d9d9db7d45ddaf727a316f5 Mon Sep 17 00:00:00 2001 From: Son Date: Sat, 16 Mar 2019 20:36:35 +1100 Subject: [PATCH 01/15] First try with some copies from log crate --- tokio-trace/Cargo.toml | 1 + tokio-trace/src/lib.rs | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/tokio-trace/Cargo.toml b/tokio-trace/Cargo.toml index c4460b9694f..de087ebab57 100644 --- a/tokio-trace/Cargo.toml +++ b/tokio-trace/Cargo.toml @@ -16,6 +16,7 @@ publish = false [dependencies] tokio-trace-core = "0.1" +cfg-if = "0.1.7" [dev-dependencies] ansi_term = "0.11" diff --git a/tokio-trace/src/lib.rs b/tokio-trace/src/lib.rs index 23e5cce0d1f..95c947be358 100644 --- a/tokio-trace/src/lib.rs +++ b/tokio-trace/src/lib.rs @@ -309,10 +309,12 @@ //! [`tokio-trace-futures`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-futures //! [`tokio-trace-fmt`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-fmt //! [`tokio-trace-log`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-log +extern crate cfg_if; extern crate tokio_trace_core; // Somehow this `use` statement is necessary for us to re-export the `core` // macros on Rust 1.26.0. I'm not sure how this makes it work, but it does. +use cfg_if::cfg_if; #[allow(unused_imports)] #[doc(hidden)] use tokio_trace_core::*; @@ -345,3 +347,58 @@ pub mod subscriber; mod sealed { pub trait Sealed {} } + +/// An enum representing the available verbosity level filters of the logger. +#[repr(usize)] +#[derive(Copy, Clone, Debug, Hash)] +pub enum LevelFilter { + /// A level lower than all log levels. + Off, + /// Corresponds to the `Error` log level. + Error, + /// Corresponds to the `Warn` log level. + Warn, + /// Corresponds to the `Info` log level. + Info, + /// Corresponds to the `Debug` log level. + Debug, + /// Corresponds to the `Trace` log level. + Trace, +} + +/// The statically resolved maximum trace level. +/// +/// See the crate level documentation for information on how to configure this. +/// +/// This value is checked by the `event` macro. Code that manually calls functions on that value +/// should compare the level against this value. +/// +pub const STATIC_MAX_LEVEL: LevelFilter = MAX_LEVEL_INNER; + +cfg_if! { + if #[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Off; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Error; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Warn; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Info; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Debug; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Trace; + } else if #[cfg(feature = "max_level_off")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Off; + } else if #[cfg(feature = "max_level_error")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Error; + } else if #[cfg(feature = "max_level_warn")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Warn; + } else if #[cfg(feature = "max_level_info")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Info; + } else if #[cfg(feature = "max_level_debug")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Debug; + } else { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Trace; + } +} From da556668c1516c12865294ddba4df4e407b7ebda Mon Sep 17 00:00:00 2001 From: Son Date: Sun, 17 Mar 2019 11:36:58 +1100 Subject: [PATCH 02/15] Use STATIC_MAX_LEVEL for event and span macro And remove cfg-if dependency --- tokio-trace/Cargo.toml | 1 - tokio-trace/src/lib.rs | 76 ++++++++++++++------------------------- tokio-trace/src/macros.rs | 10 ++++-- 3 files changed, 34 insertions(+), 53 deletions(-) diff --git a/tokio-trace/Cargo.toml b/tokio-trace/Cargo.toml index de087ebab57..c4460b9694f 100644 --- a/tokio-trace/Cargo.toml +++ b/tokio-trace/Cargo.toml @@ -16,7 +16,6 @@ publish = false [dependencies] tokio-trace-core = "0.1" -cfg-if = "0.1.7" [dev-dependencies] ansi_term = "0.11" diff --git a/tokio-trace/src/lib.rs b/tokio-trace/src/lib.rs index 95c947be358..bd2cdc01887 100644 --- a/tokio-trace/src/lib.rs +++ b/tokio-trace/src/lib.rs @@ -309,12 +309,10 @@ //! [`tokio-trace-futures`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-futures //! [`tokio-trace-fmt`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-fmt //! [`tokio-trace-log`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-log -extern crate cfg_if; extern crate tokio_trace_core; // Somehow this `use` statement is necessary for us to re-export the `core` // macros on Rust 1.26.0. I'm not sure how this makes it work, but it does. -use cfg_if::cfg_if; #[allow(unused_imports)] #[doc(hidden)] use tokio_trace_core::*; @@ -348,57 +346,37 @@ mod sealed { pub trait Sealed {} } -/// An enum representing the available verbosity level filters of the logger. -#[repr(usize)] -#[derive(Copy, Clone, Debug, Hash)] -pub enum LevelFilter { - /// A level lower than all log levels. - Off, - /// Corresponds to the `Error` log level. - Error, - /// Corresponds to the `Warn` log level. - Warn, - /// Corresponds to the `Info` log level. - Info, - /// Corresponds to the `Debug` log level. - Debug, - /// Corresponds to the `Trace` log level. - Trace, -} - /// The statically resolved maximum trace level. /// /// See the crate level documentation for information on how to configure this. /// /// This value is checked by the `event` macro. Code that manually calls functions on that value /// should compare the level against this value. -/// -pub const STATIC_MAX_LEVEL: LevelFilter = MAX_LEVEL_INNER; +pub const STATIC_MAX_LEVEL: Level = Level::TRACE; -cfg_if! { - if #[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Off; - } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Error; - } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Warn; - } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Info; - } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Debug; - } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Trace; - } else if #[cfg(feature = "max_level_off")] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Off; - } else if #[cfg(feature = "max_level_error")] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Error; - } else if #[cfg(feature = "max_level_warn")] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Warn; - } else if #[cfg(feature = "max_level_info")] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Info; - } else if #[cfg(feature = "max_level_debug")] { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Debug; - } else { - const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Trace; - } -} +#[cfg(feature = "max_level_error")] +pub const STATIC_MAX_LEVEL: Level = Level::ERROR; + +#[cfg(feature = "max_level_warn")] +pub const STATIC_MAX_LEVEL: Level = Level::WARN; + +#[cfg(feature = "max_level_info")] +pub const STATIC_MAX_LEVEL: Level = Level::INFO; + +#[cfg(feature = "max_level_debug")] +pub const STATIC_MAX_LEVEL: Level = Level::DEBUG; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] +pub const STATIC_MAX_LEVEL: Level = Level::ERROR; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] +pub const STATIC_MAX_LEVEL: Level = Level::WARN; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] +pub const STATIC_MAX_LEVEL: Level = Level::INFO; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] +pub const STATIC_MAX_LEVEL: Level = Level::DEBUG; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] +pub const STATIC_MAX_LEVEL: Level = Level::TRACE; diff --git a/tokio-trace/src/macros.rs b/tokio-trace/src/macros.rs index e2d231de2b9..6aeeac4f74c 100644 --- a/tokio-trace/src/macros.rs +++ b/tokio-trace/src/macros.rs @@ -101,7 +101,7 @@ macro_rules! span { $name:expr, $($k:ident $( = $val:expr )* ),* ) => { - { + if $lvl <= $crate::STATIC_MAX_LEVEL { use $crate::callsite; use $crate::callsite::Callsite; let callsite = callsite! { @@ -120,6 +120,8 @@ macro_rules! span { } else { $crate::Span::new_disabled() } + } else { + $crate::Span::new_disabled() } }; ( @@ -128,7 +130,7 @@ macro_rules! span { $name:expr, $($k:ident $( = $val:expr )* ),* ) => { - { + if $lvl <= $crate::STATIC_MAX_LEVEL { use $crate::callsite; use $crate::callsite::Callsite; let callsite = callsite! { @@ -146,6 +148,8 @@ macro_rules! span { } else { $crate::Span::new_disabled() } + } else { + $crate::Span::new_disabled() } }; (target: $target:expr, level: $lvl:expr, parent: $parent:expr, $name:expr) => { @@ -334,7 +338,7 @@ macro_rules! span { #[macro_export(local_inner_macros)] macro_rules! event { (target: $target:expr, $lvl:expr, { $( $k:ident = $val:expr ),* $(,)*} )=> ({ - { + if $lvl <= $crate::STATIC_MAX_LEVEL { #[allow(unused_imports)] use $crate::{callsite, dispatcher, Event, field::{Value, ValueSet}}; use $crate::callsite::Callsite; From 88a52e6561cf8e28d97e4a68c6c1d8521d790753 Mon Sep 17 00:00:00 2001 From: Son Date: Wed, 20 Mar 2019 21:50:22 +1100 Subject: [PATCH 03/15] Add level filters --- tokio-trace/src/level_filters.rs | 121 +++++++++++++++++++++++++++++++ tokio-trace/src/lib.rs | 36 +-------- tokio-trace/src/macros.rs | 6 +- 3 files changed, 125 insertions(+), 38 deletions(-) create mode 100644 tokio-trace/src/level_filters.rs diff --git a/tokio-trace/src/level_filters.rs b/tokio-trace/src/level_filters.rs new file mode 100644 index 00000000000..97d832c4898 --- /dev/null +++ b/tokio-trace/src/level_filters.rs @@ -0,0 +1,121 @@ +use std::cmp::Ordering; +use tokio_trace_core::Level; + +/// Describes the level of verbosity of a span or event. +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct LevelFilter(LevelFilterInner, Option); + +impl LevelFilter { + /// The "zero" level. + /// + /// Designates no logging. + pub const ZERO: LevelFilter = LevelFilter(LevelFilterInner::Zero, None); + /// The "error" level. + /// + /// Designates very serious errors. + pub const ERROR: LevelFilter = LevelFilter(LevelFilterInner::Error, Some(Level::ERROR)); + /// The "warn" level. + /// + /// Designates hazardous situations. + pub const WARN: LevelFilter = LevelFilter(LevelFilterInner::Warn, Some(Level::WARN)); + /// The "info" level. + /// + /// Designates useful information. + pub const INFO: LevelFilter = LevelFilter(LevelFilterInner::Info, Some(Level::INFO)); + /// The "debug" level. + /// + /// Designates lower priority information. + pub const DEBUG: LevelFilter = LevelFilter(LevelFilterInner::Debug, Some(Level::DEBUG)); + /// The "trace" level. + /// + /// Designates very low priority, often extremely verbose, information. + pub const TRACE: LevelFilter = LevelFilter(LevelFilterInner::Trace, Some(Level::TRACE)); +} + +#[repr(usize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] +enum LevelFilterInner { + Zero = 0, + /// The "error" level. + /// + /// Designates very serious errors. + Error, + /// The "warn" level. + /// + /// Designates hazardous situations. + Warn, + /// The "info" level. + /// + /// Designates useful information. + Info, + /// The "debug" level. + /// + /// Designates lower priority information. + Debug, + /// The "trace" level. + /// + /// Designates very low priority, often extremely verbose, information. + Trace, +} + +impl PartialEq for Level { + fn eq(&self, other: &LevelFilter) -> bool { + match other.1 { + None => false, + Some(ref level) => self.eq(level), + } + } +} + +impl PartialOrd for Level { + fn partial_cmp(&self, other: &LevelFilter) -> Option { + match other.1 { + None => Some(Ordering::Less), + Some(ref level) => self.partial_cmp(level), + } + } +} + +/// The statically resolved maximum trace level. +/// +/// See the crate level documentation for information on how to configure this. +/// +/// This value is checked by the `event` macro. Code that manually calls functions on that value +/// should compare the level against this value. +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ZERO; + +#[cfg(feature = "max_level_zero")] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ZERO; + +#[cfg(feature = "max_level_error")] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; + +#[cfg(feature = "max_level_warn")] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; + +#[cfg(feature = "max_level_info")] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; + +#[cfg(feature = "max_level_debug")] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; + +#[cfg(feature = "max_level_trace")] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_zero"))] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ZERO; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; + +#[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; diff --git a/tokio-trace/src/lib.rs b/tokio-trace/src/lib.rs index bd2cdc01887..626e0ffa346 100644 --- a/tokio-trace/src/lib.rs +++ b/tokio-trace/src/lib.rs @@ -339,44 +339,10 @@ pub use self::{ mod macros; pub mod field; +pub mod level_filters; pub mod span; pub mod subscriber; mod sealed { pub trait Sealed {} } - -/// The statically resolved maximum trace level. -/// -/// See the crate level documentation for information on how to configure this. -/// -/// This value is checked by the `event` macro. Code that manually calls functions on that value -/// should compare the level against this value. -pub const STATIC_MAX_LEVEL: Level = Level::TRACE; - -#[cfg(feature = "max_level_error")] -pub const STATIC_MAX_LEVEL: Level = Level::ERROR; - -#[cfg(feature = "max_level_warn")] -pub const STATIC_MAX_LEVEL: Level = Level::WARN; - -#[cfg(feature = "max_level_info")] -pub const STATIC_MAX_LEVEL: Level = Level::INFO; - -#[cfg(feature = "max_level_debug")] -pub const STATIC_MAX_LEVEL: Level = Level::DEBUG; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] -pub const STATIC_MAX_LEVEL: Level = Level::ERROR; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] -pub const STATIC_MAX_LEVEL: Level = Level::WARN; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] -pub const STATIC_MAX_LEVEL: Level = Level::INFO; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] -pub const STATIC_MAX_LEVEL: Level = Level::DEBUG; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] -pub const STATIC_MAX_LEVEL: Level = Level::TRACE; diff --git a/tokio-trace/src/macros.rs b/tokio-trace/src/macros.rs index 6aeeac4f74c..847917476ea 100644 --- a/tokio-trace/src/macros.rs +++ b/tokio-trace/src/macros.rs @@ -101,7 +101,7 @@ macro_rules! span { $name:expr, $($k:ident $( = $val:expr )* ),* ) => { - if $lvl <= $crate::STATIC_MAX_LEVEL { + if $lvl <= $crate::level_filters::STATIC_MAX_LEVEL { use $crate::callsite; use $crate::callsite::Callsite; let callsite = callsite! { @@ -130,7 +130,7 @@ macro_rules! span { $name:expr, $($k:ident $( = $val:expr )* ),* ) => { - if $lvl <= $crate::STATIC_MAX_LEVEL { + if $lvl <= $crate::level_filters::STATIC_MAX_LEVEL { use $crate::callsite; use $crate::callsite::Callsite; let callsite = callsite! { @@ -338,7 +338,7 @@ macro_rules! span { #[macro_export(local_inner_macros)] macro_rules! event { (target: $target:expr, $lvl:expr, { $( $k:ident = $val:expr ),* $(,)*} )=> ({ - if $lvl <= $crate::STATIC_MAX_LEVEL { + if $lvl <= $crate::level_filters::STATIC_MAX_LEVEL { #[allow(unused_imports)] use $crate::{callsite, dispatcher, Event, field::{Value, ValueSet}}; use $crate::callsite::Callsite; From 4ca52750f38f2c3e831fa0d62fd8e881d99a6330 Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 21 Mar 2019 07:19:02 +1100 Subject: [PATCH 04/15] Simplify LevelFilter --- tokio-trace/src/level_filters.rs | 58 +++++++++----------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/tokio-trace/src/level_filters.rs b/tokio-trace/src/level_filters.rs index 97d832c4898..61193c1f4dc 100644 --- a/tokio-trace/src/level_filters.rs +++ b/tokio-trace/src/level_filters.rs @@ -3,64 +3,38 @@ use tokio_trace_core::Level; /// Describes the level of verbosity of a span or event. #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] -pub struct LevelFilter(LevelFilterInner, Option); +pub struct LevelFilter(Option); impl LevelFilter { - /// The "zero" level. + /// The "off" level. /// - /// Designates no logging. - pub const ZERO: LevelFilter = LevelFilter(LevelFilterInner::Zero, None); + /// Designates to turn off logging. + pub const OFF: LevelFilter = LevelFilter(None); /// The "error" level. /// /// Designates very serious errors. - pub const ERROR: LevelFilter = LevelFilter(LevelFilterInner::Error, Some(Level::ERROR)); + pub const ERROR: LevelFilter = LevelFilter(Some(Level::ERROR)); /// The "warn" level. /// /// Designates hazardous situations. - pub const WARN: LevelFilter = LevelFilter(LevelFilterInner::Warn, Some(Level::WARN)); + pub const WARN: LevelFilter = LevelFilter(Some(Level::WARN)); /// The "info" level. /// /// Designates useful information. - pub const INFO: LevelFilter = LevelFilter(LevelFilterInner::Info, Some(Level::INFO)); + pub const INFO: LevelFilter = LevelFilter(Some(Level::INFO)); /// The "debug" level. /// /// Designates lower priority information. - pub const DEBUG: LevelFilter = LevelFilter(LevelFilterInner::Debug, Some(Level::DEBUG)); + pub const DEBUG: LevelFilter = LevelFilter(Some(Level::DEBUG)); /// The "trace" level. /// /// Designates very low priority, often extremely verbose, information. - pub const TRACE: LevelFilter = LevelFilter(LevelFilterInner::Trace, Some(Level::TRACE)); -} - -#[repr(usize)] -#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] -enum LevelFilterInner { - Zero = 0, - /// The "error" level. - /// - /// Designates very serious errors. - Error, - /// The "warn" level. - /// - /// Designates hazardous situations. - Warn, - /// The "info" level. - /// - /// Designates useful information. - Info, - /// The "debug" level. - /// - /// Designates lower priority information. - Debug, - /// The "trace" level. - /// - /// Designates very low priority, often extremely verbose, information. - Trace, + pub const TRACE: LevelFilter = LevelFilter(Some(Level::TRACE)); } impl PartialEq for Level { fn eq(&self, other: &LevelFilter) -> bool { - match other.1 { + match other.0 { None => false, Some(ref level) => self.eq(level), } @@ -69,7 +43,7 @@ impl PartialEq for Level { impl PartialOrd for Level { fn partial_cmp(&self, other: &LevelFilter) -> Option { - match other.1 { + match other.0 { None => Some(Ordering::Less), Some(ref level) => self.partial_cmp(level), } @@ -82,10 +56,10 @@ impl PartialOrd for Level { /// /// This value is checked by the `event` macro. Code that manually calls functions on that value /// should compare the level against this value. -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ZERO; +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; -#[cfg(feature = "max_level_zero")] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ZERO; +#[cfg(feature = "max_level_off")] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; #[cfg(feature = "max_level_error")] pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; @@ -102,8 +76,8 @@ pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; #[cfg(feature = "max_level_trace")] pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; -#[cfg(all(not(debug_assertions), feature = "release_max_level_zero"))] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ZERO; +#[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] +pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; #[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; From 19c8decd2c09ccc4213c499abfb9c89261717f00 Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 21 Mar 2019 09:57:40 +1100 Subject: [PATCH 05/15] Back flip to use cfg-if --- tokio-trace/Cargo.toml | 1 + tokio-trace/src/level_filters.rs | 64 ++++++++++++++------------------ tokio-trace/src/lib.rs | 2 + 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/tokio-trace/Cargo.toml b/tokio-trace/Cargo.toml index c4460b9694f..de087ebab57 100644 --- a/tokio-trace/Cargo.toml +++ b/tokio-trace/Cargo.toml @@ -16,6 +16,7 @@ publish = false [dependencies] tokio-trace-core = "0.1" +cfg-if = "0.1.7" [dev-dependencies] ansi_term = "0.11" diff --git a/tokio-trace/src/level_filters.rs b/tokio-trace/src/level_filters.rs index 61193c1f4dc..9aae7e50447 100644 --- a/tokio-trace/src/level_filters.rs +++ b/tokio-trace/src/level_filters.rs @@ -56,40 +56,30 @@ impl PartialOrd for Level { /// /// This value is checked by the `event` macro. Code that manually calls functions on that value /// should compare the level against this value. -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; - -#[cfg(feature = "max_level_off")] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; - -#[cfg(feature = "max_level_error")] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; - -#[cfg(feature = "max_level_warn")] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; - -#[cfg(feature = "max_level_info")] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; - -#[cfg(feature = "max_level_debug")] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; - -#[cfg(feature = "max_level_trace")] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; - -#[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] -pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; +cfg_if! { + if #[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; + } else if #[cfg(feature = "max_level_off")] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; + } else if #[cfg(feature = "max_level_error")] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; + } else if #[cfg(feature = "max_level_warn")] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; + } else if #[cfg(feature = "max_level_info")] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; + } else if #[cfg(feature = "max_level_debug")] { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; + } else { + pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; + } +} diff --git a/tokio-trace/src/lib.rs b/tokio-trace/src/lib.rs index 626e0ffa346..6182b55277c 100644 --- a/tokio-trace/src/lib.rs +++ b/tokio-trace/src/lib.rs @@ -309,6 +309,8 @@ //! [`tokio-trace-futures`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-futures //! [`tokio-trace-fmt`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-fmt //! [`tokio-trace-log`]: https://github.com/tokio-rs/tokio-trace-nursery/tree/master/tokio-trace-log +#[macro_use] +extern crate cfg_if; extern crate tokio_trace_core; // Somehow this `use` statement is necessary for us to re-export the `core` From b50d7d87d409f4ea27e88bb3accef18bff6861db Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 21 Mar 2019 09:59:16 +1100 Subject: [PATCH 06/15] Better description for OFF level filter --- tokio-trace/src/level_filters.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio-trace/src/level_filters.rs b/tokio-trace/src/level_filters.rs index 9aae7e50447..3e01826b85a 100644 --- a/tokio-trace/src/level_filters.rs +++ b/tokio-trace/src/level_filters.rs @@ -8,7 +8,7 @@ pub struct LevelFilter(Option); impl LevelFilter { /// The "off" level. /// - /// Designates to turn off logging. + /// Designates that logging should be to turned off. pub const OFF: LevelFilter = LevelFilter(None); /// The "error" level. /// From 833bf7adb680a712113e1b8b538422b90d87542c Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 21 Mar 2019 21:15:35 +1100 Subject: [PATCH 07/15] Docs for LevelFilter --- tokio-trace/src/level_filters.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio-trace/src/level_filters.rs b/tokio-trace/src/level_filters.rs index 3e01826b85a..771e8565369 100644 --- a/tokio-trace/src/level_filters.rs +++ b/tokio-trace/src/level_filters.rs @@ -1,7 +1,8 @@ use std::cmp::Ordering; use tokio_trace_core::Level; -/// Describes the level of verbosity of a span or event. +/// `LevelFilter` is used to statistically filter the logging messages based on its `Level`. +/// Logging messages will be discarded if its `Level` is greater than `LevelFilter`. #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] pub struct LevelFilter(Option); From fdb9aa21241af21d07dea22e1ae4a9ca2ffe6119 Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 21 Mar 2019 21:24:48 +1100 Subject: [PATCH 08/15] Have STATIC_MAX_LEVEL as a separate var. --- tokio-trace/src/level_filters.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tokio-trace/src/level_filters.rs b/tokio-trace/src/level_filters.rs index 771e8565369..4d383112c72 100644 --- a/tokio-trace/src/level_filters.rs +++ b/tokio-trace/src/level_filters.rs @@ -57,30 +57,32 @@ impl PartialOrd for Level { /// /// This value is checked by the `event` macro. Code that manually calls functions on that value /// should compare the level against this value. +pub const STATIC_MAX_LEVEL: LevelFilter = MAX_LEVEL; + cfg_if! { if #[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; + const MAX_LEVEL: LevelFilter = LevelFilter::OFF; } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; + const MAX_LEVEL: LevelFilter = LevelFilter::ERROR; } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; + const MAX_LEVEL: LevelFilter = LevelFilter::WARN; } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; + const MAX_LEVEL: LevelFilter = LevelFilter::INFO; } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; + const MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; + const MAX_LEVEL: LevelFilter = LevelFilter::TRACE; } else if #[cfg(feature = "max_level_off")] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::OFF; + const MAX_LEVEL: LevelFilter = LevelFilter::OFF; } else if #[cfg(feature = "max_level_error")] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::ERROR; + const MAX_LEVEL: LevelFilter = LevelFilter::ERROR; } else if #[cfg(feature = "max_level_warn")] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::WARN; + const MAX_LEVEL: LevelFilter = LevelFilter::WARN; } else if #[cfg(feature = "max_level_info")] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::INFO; + const MAX_LEVEL: LevelFilter = LevelFilter::INFO; } else if #[cfg(feature = "max_level_debug")] { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; + const MAX_LEVEL: LevelFilter = LevelFilter::DEBUG; } else { - pub const STATIC_MAX_LEVEL: LevelFilter = LevelFilter::TRACE; + const MAX_LEVEL: LevelFilter = LevelFilter::TRACE; } } From f36e76fce4512959b0896c2ae91b31920a342eaa Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 21 Mar 2019 21:44:05 +1100 Subject: [PATCH 09/15] Add list of features to tokio-trace --- tokio-trace/Cargo.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tokio-trace/Cargo.toml b/tokio-trace/Cargo.toml index de087ebab57..0d4bdcbb88f 100644 --- a/tokio-trace/Cargo.toml +++ b/tokio-trace/Cargo.toml @@ -24,6 +24,21 @@ humantime = "1.1.1" futures = "0.1" log = "0.4" +[features] +max_level_off = [] +max_level_error = [] +max_level_warn = [] +max_level_info = [] +max_level_debug = [] +max_level_trace = [] + +release_max_level_off = [] +release_max_level_error = [] +release_max_level_warn = [] +release_max_level_info = [] +release_max_level_debug = [] +release_max_level_trace = [] + # These are used for the "basic" example from the tokio-trace-prototype repo, # which is currently not included as it used the `tokio-trace-log` crate, and # that crate is currently unstable. From 8d22c946876918e23b7fd992221b44d121d276c9 Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 21 Mar 2019 21:44:22 +1100 Subject: [PATCH 10/15] Add test_static_max_level_features --- .../test_static_max_level_features/Cargo.toml | 12 +++ .../test_static_max_level_features/main.rs | 75 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 tokio-trace/test_static_max_level_features/Cargo.toml create mode 100644 tokio-trace/test_static_max_level_features/main.rs diff --git a/tokio-trace/test_static_max_level_features/Cargo.toml b/tokio-trace/test_static_max_level_features/Cargo.toml new file mode 100644 index 00000000000..f57c248aee8 --- /dev/null +++ b/tokio-trace/test_static_max_level_features/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "test_cargo_max_level_features" +version = "0.1.0" +publish = false + +[[bin]] +name = "main" +path = "main.rs" + +[dependencies.tokio-trace] +path = ".." +features = ["max_level_debug", "release_max_level_info"] \ No newline at end of file diff --git a/tokio-trace/test_static_max_level_features/main.rs b/tokio-trace/test_static_max_level_features/main.rs new file mode 100644 index 00000000000..2cc83c039f1 --- /dev/null +++ b/tokio-trace/test_static_max_level_features/main.rs @@ -0,0 +1,75 @@ +#[macro_use] +extern crate log; + +use std::sync::{Arc, Mutex}; +use log::{Level, LevelFilter, Log, Record, Metadata}; + +#[cfg(feature = "std")] +use log::set_boxed_logger; +#[cfg(not(feature = "std"))] +fn set_boxed_logger(logger: Box) -> Result<(), log::SetLoggerError> { + unsafe { + log::set_logger(&*Box::into_raw(logger)) + } +} + +struct State { + last_log: Mutex>, +} + +struct Logger(Arc); + +impl Log for Logger { + fn enabled(&self, _: &Metadata) -> bool { + true + } + + fn log(&self, record: &Record) { + *self.0.last_log.lock().unwrap() = Some(record.level()); + } + + fn flush(&self) {} +} + +fn main() { + let me = Arc::new(State { last_log: Mutex::new(None) }); + let a = me.clone(); + set_boxed_logger(Box::new(Logger(me))).unwrap(); + + test(&a, LevelFilter::Off); + test(&a, LevelFilter::Error); + test(&a, LevelFilter::Warn); + test(&a, LevelFilter::Info); + test(&a, LevelFilter::Debug); + test(&a, LevelFilter::Trace); +} + +fn test(a: &State, filter: LevelFilter) { + log::set_max_level(filter); + error!(""); + last(&a, t(Level::Error, filter)); + warn!(""); + last(&a, t(Level::Warn, filter)); + info!(""); + last(&a, t(Level::Info, filter)); + + debug!(""); + if cfg!(debug_assertions) { + last(&a, t(Level::Debug, filter)); + } else { + last(&a, None); + } + + trace!(""); + last(&a, None); + + fn t(lvl: Level, filter: LevelFilter) -> Option { + if lvl <= filter {Some(lvl)} else {None} + } +} + +fn last(state: &State, expected: Option) { + let mut lvl = state.last_log.lock().unwrap(); + assert_eq!(*lvl, expected); + *lvl = None; +} \ No newline at end of file From f707b638cfe0195c8b200ce5c24b769074567073 Mon Sep 17 00:00:00 2001 From: Son Date: Fri, 22 Mar 2019 22:23:42 +1100 Subject: [PATCH 11/15] Fix test_static_max_level_features --- Cargo.toml | 1 + .../test_static_max_level_features/main.rs | 95 +++++++++---------- 2 files changed, 46 insertions(+), 50 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 87132b2e446..b82c18e366e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ members = [ "tokio-tcp", "tokio-tls", "tokio-trace", + "tokio-trace/test_static_max_level_features", "tokio-trace/tokio-trace-core", "tokio-udp", "tokio-uds", diff --git a/tokio-trace/test_static_max_level_features/main.rs b/tokio-trace/test_static_max_level_features/main.rs index 2cc83c039f1..e117c365911 100644 --- a/tokio-trace/test_static_max_level_features/main.rs +++ b/tokio-trace/test_static_max_level_features/main.rs @@ -1,75 +1,70 @@ #[macro_use] -extern crate log; +extern crate tokio_trace; use std::sync::{Arc, Mutex}; -use log::{Level, LevelFilter, Log, Record, Metadata}; - -#[cfg(feature = "std")] -use log::set_boxed_logger; -#[cfg(not(feature = "std"))] -fn set_boxed_logger(logger: Box) -> Result<(), log::SetLoggerError> { - unsafe { - log::set_logger(&*Box::into_raw(logger)) - } -} +use tokio_trace::span::{Attributes, Record}; +use tokio_trace::{span, Event, Id, Level, Metadata, Subscriber}; struct State { - last_log: Mutex>, + last_level: Mutex>, } -struct Logger(Arc); +struct TestSubscriber(Arc); -impl Log for Logger { +impl Subscriber for TestSubscriber { fn enabled(&self, _: &Metadata) -> bool { true } - fn log(&self, record: &Record) { - *self.0.last_log.lock().unwrap() = Some(record.level()); + fn new_span(&self, _span: &Attributes) -> Id { + span::Id::from_u64(42) } - fn flush(&self) {} -} + fn record(&self, _span: &Id, _values: &Record) {} -fn main() { - let me = Arc::new(State { last_log: Mutex::new(None) }); - let a = me.clone(); - set_boxed_logger(Box::new(Logger(me))).unwrap(); + fn record_follows_from(&self, _span: &Id, _follows: &Id) {} - test(&a, LevelFilter::Off); - test(&a, LevelFilter::Error); - test(&a, LevelFilter::Warn); - test(&a, LevelFilter::Info); - test(&a, LevelFilter::Debug); - test(&a, LevelFilter::Trace); -} + fn event(&self, event: &Event) { + *self.0.last_level.lock().unwrap() = Some(event.metadata().level().clone()); + } -fn test(a: &State, filter: LevelFilter) { - log::set_max_level(filter); - error!(""); - last(&a, t(Level::Error, filter)); - warn!(""); - last(&a, t(Level::Warn, filter)); - info!(""); - last(&a, t(Level::Info, filter)); + fn enter(&self, _span: &Id) {} - debug!(""); - if cfg!(debug_assertions) { - last(&a, t(Level::Debug, filter)); - } else { - last(&a, None); - } + fn exit(&self, _span: &Id) {} +} - trace!(""); - last(&a, None); +fn main() { + let me = Arc::new(State { + last_level: Mutex::new(None), + }); + let a = me.clone(); + tokio_trace::subscriber::with_default(TestSubscriber(me), || { + error!(""); + last(&a, Some(Level::ERROR)); + warn!(""); + last(&a, Some(Level::WARN)); + info!(""); + last(&a, Some(Level::INFO)); + debug!(""); + last(&a, Some(Level::DEBUG)); + trace!(""); + last(&a, None); - fn t(lvl: Level, filter: LevelFilter) -> Option { - if lvl <= filter {Some(lvl)} else {None} - } + span!(level: Level::ERROR, ""); + last(&a, None); + span!(level: Level::WARN, ""); + last(&a, None); + span!(level: Level::INFO, ""); + last(&a, None); + span!(level: Level::DEBUG, ""); + last(&a, None); + span!(level: Level::TRACE, ""); + last(&a, None); + }); } fn last(state: &State, expected: Option) { - let mut lvl = state.last_log.lock().unwrap(); + let mut lvl = state.last_level.lock().unwrap(); assert_eq!(*lvl, expected); *lvl = None; -} \ No newline at end of file +} From 0655762b68a85e633d9a3bd357a45856e2731ef9 Mon Sep 17 00:00:00 2001 From: Son Date: Sat, 23 Mar 2019 09:31:17 +1100 Subject: [PATCH 12/15] Small adjustment --- azure-pipelines.yml | 1 + .../test_static_max_level_features/{main.rs => tests/test.rs} | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) rename tokio-trace/test_static_max_level_features/{main.rs => tests/test.rs} (97%) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 677c7292638..f58aea14c74 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -47,6 +47,7 @@ jobs: - tokio-timer - tokio-trace - tokio-trace/tokio-trace-core + - tokio-trace/tokio-trace-core - template: ci/azure-cargo-check.yml parameters: diff --git a/tokio-trace/test_static_max_level_features/main.rs b/tokio-trace/test_static_max_level_features/tests/test.rs similarity index 97% rename from tokio-trace/test_static_max_level_features/main.rs rename to tokio-trace/test_static_max_level_features/tests/test.rs index e117c365911..ba3f2757665 100644 --- a/tokio-trace/test_static_max_level_features/main.rs +++ b/tokio-trace/test_static_max_level_features/tests/test.rs @@ -33,7 +33,8 @@ impl Subscriber for TestSubscriber { fn exit(&self, _span: &Id) {} } -fn main() { +#[cfg(test)] +fn test_static_max_level_features() { let me = Arc::new(State { last_level: Mutex::new(None), }); From b720a423a7cc48f0544da30fd7af1bc9ab29097e Mon Sep 17 00:00:00 2001 From: Son Date: Sat, 23 Mar 2019 21:42:37 +1100 Subject: [PATCH 13/15] Remove un-necessary [[bin]] --- tokio-trace/test_static_max_level_features/Cargo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tokio-trace/test_static_max_level_features/Cargo.toml b/tokio-trace/test_static_max_level_features/Cargo.toml index f57c248aee8..91288b5907b 100644 --- a/tokio-trace/test_static_max_level_features/Cargo.toml +++ b/tokio-trace/test_static_max_level_features/Cargo.toml @@ -3,10 +3,6 @@ name = "test_cargo_max_level_features" version = "0.1.0" publish = false -[[bin]] -name = "main" -path = "main.rs" - [dependencies.tokio-trace] path = ".." features = ["max_level_debug", "release_max_level_info"] \ No newline at end of file From 0455b639bcc57e6ad297e2c7bcf4b9ff1ae60c25 Mon Sep 17 00:00:00 2001 From: Son Date: Sun, 24 Mar 2019 07:17:12 +1100 Subject: [PATCH 14/15] Copy and paste fix --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f58aea14c74..6a870026802 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -47,7 +47,7 @@ jobs: - tokio-timer - tokio-trace - tokio-trace/tokio-trace-core - - tokio-trace/tokio-trace-core + - tokio-trace/test_static_max_level_features - template: ci/azure-cargo-check.yml parameters: From dcf501a19ee65e2aa73a5f3d69a2ace661565d8d Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Mon, 25 Mar 2019 12:55:24 -0700 Subject: [PATCH 15/15] de-break FreeBSD CI --- .cirrus.yml | 1 + Cargo.toml | 1 - tokio-trace/test_static_max_level_features/Cargo.toml | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 4172a50d95c..66c8151d1f0 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -20,6 +20,7 @@ task: test_script: - . $HOME/.cargo/env - cargo test --all --no-fail-fast + - (cd tokio-trace/test_static_max_level_features && cargo test) - cargo doc --all i686_test_script: - . $HOME/.cargo/env diff --git a/Cargo.toml b/Cargo.toml index b82c18e366e..87132b2e446 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,6 @@ members = [ "tokio-tcp", "tokio-tls", "tokio-trace", - "tokio-trace/test_static_max_level_features", "tokio-trace/tokio-trace-core", "tokio-udp", "tokio-uds", diff --git a/tokio-trace/test_static_max_level_features/Cargo.toml b/tokio-trace/test_static_max_level_features/Cargo.toml index 91288b5907b..a40596a3fde 100644 --- a/tokio-trace/test_static_max_level_features/Cargo.toml +++ b/tokio-trace/test_static_max_level_features/Cargo.toml @@ -1,3 +1,5 @@ +[workspace] + [package] name = "test_cargo_max_level_features" version = "0.1.0" @@ -5,4 +7,4 @@ publish = false [dependencies.tokio-trace] path = ".." -features = ["max_level_debug", "release_max_level_info"] \ No newline at end of file +features = ["max_level_debug", "release_max_level_info"]