Enum carboncopy::Level[][src]

pub enum Level {
    TRACE,
    DEBUG,
    INFO,
    WARN,
    ERROR,
    FATAL,
}

An enum used to specify the severity level of a log message. Several examples of corresponding scenarios will be provided for each enum variant. The examples are only to be used as a guide and not a hard rule.

Variants

TRACE

Indicates an extremely verbose information which only rarely needs to be activated or perused for detective work (forensics, audits). Activating this level for a sustained period could degrade performance.

Examples:

  • The request method, URL, full request body, and full response body of a REST API call to a payment processor.
  • An entire form submission.
  • Complete step-by-step of a program flow (such as entering and exiting a loop or function).
DEBUG

Indicates an information that helps with debugging, usually containing the value of variables after a significant event triggered by a user activity has just happened.

Examples:

  • The updated shipping cost or total price in a shopping cart after an item has been added to it.
  • The updated account balance after some money has been transferred into/out of it.
  • Error codes returned to users.
INFO

Indicates a useful information that doesn’t qualify as an error.

Examples:

  • Notice that an application has just started.
  • The IP address and port number that a web service is bound to.
  • Notice that a connection with an external service has just been established successfully.
WARN

Indicates a non-desired situation that doesn’t qualify as an error.

Examples:

  • A deprecated function or REST API endpoint is invoked or consumed.
  • Recovery from a panic which could have been prevented by a simple conditional logic.
  • Notice of malicious user activities such as SQL injection attempts or absurdly high number of requests per second.
ERROR

Indicates a serious error that the application can still recover from. An example of such error is when an application which relies on a database failed to connect to it after a single try, but one or more retries will be attempted later.

FATAL

Indicates that a severe error that causes a program to terminate has just happened. An example of such error is when an application which heavily relies on an external service (say, a database) can’t connect to it after many retries. There is no point in continuing execution as the application won’t be able to do much of anything. The process usually must exit after logging the message.

Trait Implementations

impl Clone for Level[src]

impl Copy for Level[src]

impl Debug for Level[src]

impl Display for Level[src]

impl Eq for Level[src]

impl Hash for Level[src]

impl Ord for Level[src]

impl PartialEq<Level> for Level[src]

impl PartialOrd<Level> for Level[src]

impl Serialize for Level[src]

impl StructuralEq for Level[src]

impl StructuralPartialEq for Level[src]

Auto Trait Implementations

impl RefUnwindSafe for Level

impl Send for Level

impl Sync for Level

impl Unpin for Level

impl UnwindSafe for Level

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.