Struct logger::format::Format
[−]
[src]
pub struct Format(pub Vec<FormatUnit>);
A formatting style for the Logger, consisting of multiple
FormatUnits concatenated into one line.
Methods
impl Format
fn new(s: &str, colors: Vec<FormatColor>, attrs: Vec<FormatAttr>) -> Option<Format>
Create a Format from a format string, which can contain the fields
{method}, {uri}, {status}, and {response-time}.
Returns None if the format string syntax is incorrect.
Colors and attributes can also be added to the format string within @ delimiters,
by specifying them in a space-delimited list within square brackets ([bold italic]).
They can be made dependent on the request/response by passing FunctionColor and
FunctionAttrs in as the colors and attrs vecs; these colors/attributes will
be used sequentially when there is a [C] or [A] marker, respectively ([bold C]).
For example: @[bold C]{status}@ will be formatted based upon
the first FormatColor constant or function in the colors vector,
yielding a bold and colored response status.
Available colors are:
blackbluebrightblackbrightbluebrightcyanbrightgreenbrightmagentabrightredbrightwhitebrightyellowcyangreenmagentaredwhiteyellow
Available attributes are:
bolddimitalicunderlineblinkstandoutreversesecure