Lines Matching defs:level
2 // file at the top-level directory of this distribution and at
33 //! the log level to exclude messages with a lower priority.
167 //! metadata.level() <= Level::Info
172 //! println!("{} - {}", record.level(), record.args());
183 //! log level also needs to be adjusted via the [`set_max_level`] function. The
187 //! In the case of our example logger, we'll want to set the maximum log level
189 //! [`Trace`][level_link] level log messages. A logging implementation should
213 //! to adjust the maximum log level as well.
243 //! This level is configured separately for release and debug builds. The features are:
261 //! Libraries should avoid using the max level features because they're global and can't be changed
264 //! For example, a crate can disable trace level logs in debug builds and trace, debug, and info
265 //! level logs in release builds with the following configuration:
416 "attempted to convert a string that doesn't match an existing log level";
427 /// The "error" level.
434 /// The "warn" level.
438 /// The "info" level.
442 /// The "debug" level.
446 /// The "trace" level.
562 fn from_str(level: &str) -> Result<Level, Self::Err> {
566 .position(|&name| eq_ignore_ascii_case(name, level))
594 /// Returns the most verbose logging level.
632 /// An enum representing the available verbosity level filters of the logger.
635 /// to get and set the maximum log level with [`max_level()`] and [`set_max_level`].
643 /// A level lower than all log levels.
645 /// Corresponds to the `Error` log level.
647 /// Corresponds to the `Warn` log level.
649 /// Corresponds to the `Info` log level.
651 /// Corresponds to the `Debug` log level.
653 /// Corresponds to the `Trace` log level.
743 fn from_str(level: &str) -> Result<LevelFilter, Self::Err> {
747 .position(|&name| eq_ignore_ascii_case(name, level))
773 /// Returns the most verbose logging level filter.
838 /// Note that the [`level()`] and [`target()`] accessors are equivalent to
839 /// `self.metadata().level()` and `self.metadata().target()` respectively.
844 /// The following example shows a simple logger that displays the level,
861 /// record.level(),
872 /// [`level()`]: struct.Record.html#method.level
921 /// The verbosity level of the message.
923 pub fn level(&self) -> Level {
924 self.metadata.level()
983 level: self.metadata.level,
1009 /// .level(Level::Error)
1024 /// .level(Level::Error)
1082 /// Set [`Metadata::level`](struct.Metadata.html#method.level).
1084 pub fn level(&mut self, level: Level) -> &mut RecordBuilder<'a> {
1085 self.record.metadata.level = level;
1171 /// metadata.level() <= Level::Info
1176 /// println!("{} - {}", record.level(), record.args());
1186 level: Level,
1197 /// The verbosity level of the message.
1199 pub fn level(&self) -> Level {
1200 self.level
1222 /// .level(Level::Debug)
1236 /// - `level`: `Level::Info`
1242 level: Level::Info,
1248 /// Setter for [`level`](struct.Metadata.html#method.level).
1250 pub fn level(&mut self, arg: Level) -> &mut MetadataBuilder<'a> {
1251 self.metadata.level = arg;
1360 /// Sets the global maximum log level.
1364 /// Note that `Trace` is the maximum level, because it provides the maximum amount of detail in the emitted logs.
1366 pub fn set_max_level(level: LevelFilter) {
1367 MAX_LOG_LEVEL_FILTER.store(level as usize, Ordering::Relaxed)
1370 /// Returns the current maximum log level.
1373 /// this value and discard any message logged at a higher level. The maximum
1374 /// log level is set by the [`set_max_level`] function.
1443 /// metadata.level() <= Level::Info
1448 /// println!("{} - {}", record.level(), record.args());
1588 level: Level,
1601 .level(level)
1615 level: Level,
1622 .level(level)
1634 pub fn __private_api_enabled(level: Level, target: &str) -> bool {
1635 logger().enabled(&Metadata::builder().level(level).target(target).build())
1644 /// The statically resolved maximum log level.
1646 /// See the crate level documentation for information on how to configure this.
1650 /// should compare the level against this value.
1817 .level(Level::Debug)
1820 assert_eq!(metadata_test.level(), Level::Debug);
1829 .level(Level::Debug)
1832 assert_eq!(metadata_test.level(), Level::Debug);
1883 .level(Level::Error)
1886 assert_eq!(record_test.level(), Level::Error);
1943 // This test mostly operates on a type level, so failures will be compile errors