Lines Matching defs:default

14 //! By default, `env_logger` writes logs to `stderr`, but can be configured to
25 //! error!("this is printed by default");
37 //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
42 //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
49 //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
57 //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
66 //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
76 //! [2017-11-09T02:12:24Z ERROR my_app] this is printed by default
88 //! Log levels are controlled on a per-module basis, and **by default all
183 //! Records logged during `cargo test` will not be captured by the test harness by default.
213 //! * `auto` (default) will attempt to print style characters, but don't force the issue.
219 //! ## Tweaking the default format
221 //! Parts of the default format can be excluded from the log output using the [`Builder`].
230 //! ### Stability of the default format
232 //! The default format won't optimise for long-term stability, and explicitly makes no
259 //! If these variables aren't present, the default value to use can be tweaked with the [`Env`] type.
266 //! env_logger::Builder::from_env(Env::default().default_filter_or("warn")).init();
300 /// The default name for the environment variable to read filters from.
303 /// The default name for the environment variable to read style preferences from.
310 /// By default, the `Env` will read the following environment variables:
325 default: Option<Cow<'a, str>>,
335 /// default global logger.
356 /// to provide the logging directives and also set the default log level filter.
412 Default::default()
454 /// This function allows a builder to be configured with default parameters,
505 /// Initializes the log builder from the environment using default variable names.
507 /// This method is a convenient way to call `from_env(Env::default())` without
509 /// [default environment variables].
513 /// Initialise a logger using the default environment variables:
522 /// [default environment variables]: struct.Env.html#default-environment-variables
524 Self::from_env(Env::default())
527 /// Applies the configuration from the environment using default variable names.
529 /// This method is a convenient way to call `parse_env(Env::default())` without
531 /// [default environment variables].
536 /// default environment variables:
548 /// [default environment variables]: struct.Env.html#default-environment-variables
550 self.parse_env(Env::default())
560 /// to format and output without intermediate heap allocations. The default
587 /// Use the default format.
591 self.format = Default::default();
595 /// Whether or not to write the level in the default format.
601 /// Whether or not to write the module path in the default format.
607 /// Whether or not to write the target in the default format.
723 /// Env logger can log to either stdout, stderr or a custom pipe. The default is stderr.
869 /// Creates the logger from the environment using default variable names.
871 /// This method is a convenient way to call `from_env(Env::default())` without
873 /// [default environment variables].
877 /// Creates a logger using the default environment variables:
885 /// [default environment variables]: struct.Env.html#default-environment-variables
974 /// Get a default set of environment variables.
976 Self::default()
991 /// If the variable is not set, the default value will be used.
992 pub fn filter_or<E, V>(mut self, filter_env: E, default: V) -> Self
997 self.filter = Var::new_with_default(filter_env, default);
1002 /// Use the default environment variable to read the filter from.
1004 /// If the variable is not set, the default value will be used.
1005 pub fn default_filter_or<V>(mut self, default: V) -> Self
1009 self.filter = Var::new_with_default(DEFAULT_FILTER_ENV, default);
1030 /// If the variable is not set, the default value will be used.
1031 pub fn write_style_or<E, V>(mut self, write_style_env: E, default: V) -> Self
1036 self.write_style = Var::new_with_default(write_style_env, default);
1041 /// Use the default environment variable to read the style from.
1043 /// If the variable is not set, the default value will be used.
1044 pub fn default_write_style_or<V>(mut self, default: V) -> Self
1048 self.write_style = Var::new_with_default(DEFAULT_WRITE_STYLE_ENV, default);
1065 default: None,
1069 fn new_with_default<E, V>(name: E, default: V) -> Self
1076 default: Some(default.into()),
1083 .or_else(|| self.default.to_owned().map(|v| v.into_owned()))
1092 Env::default().filter(filter_env.into())
1097 fn default() -> Self {
1141 try_init_from_env(Env::default())
1225 /// Create a new builder with the default environment variables.
1257 let env = Env::new().filter_or("env_get_filter_reads_from_var_if_set", "from default");
1268 "from default",
1271 assert_eq!(Some("from default".to_owned()), env.get_filter());
1279 Env::new().write_style_or("env_get_write_style_reads_from_var_if_set", "from default");
1290 "from default",
1293 assert_eq!(Some("from default".to_owned()), env.get_write_style());