[−][src]Struct spirit_log::Cfg
A configuration fragment to set up logging.
By flattening this into the configuration structure, the program can load options for
configuring logging. It adds a new top-level array logging. Each item describes one logger,
with separate log levels and destination.
See the crate examples for the use.
Logger options
These are valid for all loggers:
level: The log level to use. Valid options areOFF,ERROR,WARN,INFO,DEBUGandTRACE.per-module: A map, setting log level overrides for specific modules (logging targets). This one is optional.type: Specifies the type of logger destination. Some of them allow specifying other options.clock: EitherLOCALorUTC. Defaults toLOCALif not present.time_format: Time format string. Defaults to%+(which is ISO 8601/RFC 3339). Note that the command line logger (one produced by-l) uses a more human-friendly format.format: The format to use. There are few presets (and a custom may come in future).message-only: The line contains only the message itself.short: This is the default.<timestamp> <level> <target> <message>. Padded to form columns.extended:`. Padded to form columns. full:<timestamp> <level> <thread-name> <file>:<line> <target> <message>. Padded to form columns.machine: Likefull, but columns are not padded by spaces, they are separated by a single\tcharacter, for more convenient processing by tools likecut.json: The fields offullare encoded into ajsonformat, for convenient processing of more modern tools like logstash.logstash:jsonformat with fields named and formatted according to Logback JSON encoder
The allowed types are:
stdout: The logs are sent to standard output. There are no additional options.stderr: The logs are sent to standard error output. There are no additional options.file: Logs are written to a file. The file is reopened every time a configuration is re-read (therefore every time the application getsSIGHUP), which makes it work with logrotate.filename: The path to the file where to put the logs.
network: The application connects to a given host and port over TCP and sends logs there.host: The hostname (or IP address) to connect to.port: The port to use.
syslog: Sends the logs to syslog. This ignores all the formatting and time options, as syslog handles this itself. This depends on theto-syslogfeature.
Implementations
impl Cfg[src]
pub fn init_extension<E: Extensible>() -> impl Extension<E>[src]
This provides an Extension to initialize logging.
It calls init and sets up a basic logger (WARN and more serious going to stderr).
This is seldom used directly (but can be), the LogInstaller makes sure it is called.
pub fn is_empty(&self) -> bool[src]
Checks if the logging configuration is empty.
Can be used for skipping serialization of the config array if empty.
Trait Implementations
impl Clone for Cfg[src]
impl Debug for Cfg[src]
impl Default for Cfg[src]
impl<'de> Deserialize<'de> for Cfg[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl Fragment for Cfg[src]
type Driver = TrivialDriver
The default driver to be used by the fragment. Read more
type Seed = ()
The intermediate product if the fragment supports two-stage creation of
Resources. If not, it can be set to (). Read more
type Resource = Dispatch
The actual product this Fragment creates.
type Installer = LogInstaller
The default installer to be used unless a transformation or the user doesn't provide one. Read more
fn make_seed(&self, _name: &str) -> Result<(), AnyError>[src]
fn make_resource(&self, _: &mut (), _name: &str) -> Result<Dispatch, AnyError>[src]
const RUN_BEFORE_CONFIG: bool[src]
fn create(
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Sync + Send>>[src]
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Sync + Send>>
fn init<B>(
builder: B,
&'static str
) -> Result<B, Box<dyn Error + 'static + Sync + Send>> where
B: Extensible<Ok = B>,
<B as Extensible>::Config: DeserializeOwned,
<B as Extensible>::Config: Send,
<B as Extensible>::Config: Sync,
<B as Extensible>::Config: 'static,
<B as Extensible>::Opts: StructOpt,
<B as Extensible>::Opts: Send,
<B as Extensible>::Opts: Sync,
<B as Extensible>::Opts: 'static, [src]
builder: B,
&'static str
) -> Result<B, Box<dyn Error + 'static + Sync + Send>> where
B: Extensible<Ok = B>,
<B as Extensible>::Config: DeserializeOwned,
<B as Extensible>::Config: Send,
<B as Extensible>::Config: Sync,
<B as Extensible>::Config: 'static,
<B as Extensible>::Opts: StructOpt,
<B as Extensible>::Opts: Send,
<B as Extensible>::Opts: Sync,
<B as Extensible>::Opts: 'static,
impl Serialize for Cfg[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructDoc for Cfg[src]
fn document() -> Documentation[src]
Auto Trait Implementations
impl RefUnwindSafe for Cfg
impl Send for Cfg
impl Sync for Cfg
impl Unpin for Cfg
impl UnwindSafe for Cfg
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> IntoResult<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,