|
|
@ -10,7 +10,7 @@
|
|
|
|
//! ## Feature Set
|
|
|
|
//! ## Feature Set
|
|
|
|
//!
|
|
|
|
//!
|
|
|
|
//! - [x] Logging Levels
|
|
|
|
//! - [x] Logging Levels
|
|
|
|
//! - [x] Coloured Output
|
|
|
|
//! - [x] Datetime & Coloured Output
|
|
|
|
//! - [ ] Options for Datetime, Current Function, Line Number, Custom Colours, etc.
|
|
|
|
//! - [ ] Options for Datetime, Current Function, Line Number, Custom Colours, etc.
|
|
|
|
//! - [ ] Custom Formatting
|
|
|
|
//! - [ ] Custom Formatting
|
|
|
|
//! - [ ] File support
|
|
|
|
//! - [ ] File support
|
|
|
@ -19,19 +19,19 @@
|
|
|
|
//!
|
|
|
|
//!
|
|
|
|
//! ## Quick Start
|
|
|
|
//! ## Quick Start
|
|
|
|
//!
|
|
|
|
//!
|
|
|
|
//! ```rust
|
|
|
|
//! For the fastest setup possible, declarative macros are exposed that have a predefined format.
|
|
|
|
//! use rall::{SimpleLogger, Level};
|
|
|
|
//! This is to allow hassle-free and painless setup that will let you log instantly!
|
|
|
|
//!
|
|
|
|
//!
|
|
|
|
//! // Create Default SimpleLogger
|
|
|
|
//! ```rust
|
|
|
|
//! let mut logger = SimpleLogger::default();
|
|
|
|
//! use rall::{debug, error, fatal, info, trace, warn};
|
|
|
|
//!
|
|
|
|
//!
|
|
|
|
//! // Log Out To Standard Output
|
|
|
|
//! // Log Out To Standard Output
|
|
|
|
//! logger.log(Level::TRACE, "My Best Friend Hazel :D");
|
|
|
|
//! trace!("My Best Friend Hazel :D");
|
|
|
|
//! logger.log(Level::DEBUG, "My Best Friend Hazel :D");
|
|
|
|
//! debug!("My Best Friend Hazel :D");
|
|
|
|
//! logger.log(Level::INFO, "My Best Friend Hazel :D");
|
|
|
|
//! info!("My Best Friend Hazel :D");
|
|
|
|
//! logger.log(Level::WARN, "My Best Friend Hazel :D");
|
|
|
|
//! warn!("My Best Friend Hazel :D");
|
|
|
|
//! logger.log(Level::ERROR, "My Best Friend Hazel :D");
|
|
|
|
//! error!("My Best Friend Hazel :D");
|
|
|
|
//! logger.log(Level::FATAL, "My Best Friend Hazel :D");
|
|
|
|
//! fatal!("My Best Friend Hazel :D");
|
|
|
|
//! ```
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//!
|
|
|
|
#![cfg_attr(feature = "doc-images",
|
|
|
|
#![cfg_attr(feature = "doc-images",
|
|
|
@ -55,13 +55,76 @@ doc =::embed_doc_image::embed_image ! ("unix_logs", "images/unix_logs.png")))]
|
|
|
|
|
|
|
|
|
|
|
|
use std::fmt::{Display, Formatter};
|
|
|
|
use std::fmt::{Display, Formatter};
|
|
|
|
|
|
|
|
|
|
|
|
/// TODO
|
|
|
|
/// Represents all the possible logging levels:
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// **TRACE**,
|
|
|
|
|
|
|
|
/// **DEBUG**,
|
|
|
|
|
|
|
|
/// **INFO**,
|
|
|
|
|
|
|
|
/// **WARN**,
|
|
|
|
|
|
|
|
/// **ERROR**,
|
|
|
|
|
|
|
|
/// **FATAL**
|
|
|
|
pub enum Level {
|
|
|
|
pub enum Level {
|
|
|
|
|
|
|
|
/// # Usage
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// For fine-grained information, only within rare cases where full visibility of what is
|
|
|
|
|
|
|
|
/// happening in your application is needed.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Colour
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Blue
|
|
|
|
TRACE,
|
|
|
|
TRACE,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// # Usage
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Less granular when compared to [`TRACE`](Level::TRACE) but still more than what is needed
|
|
|
|
|
|
|
|
/// for normal use. This should be used for diagnosing issues and/or troubleshooting.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Colour
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Green
|
|
|
|
DEBUG,
|
|
|
|
DEBUG,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// # Usage
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Standard log level indicating that something has happened, all logs using [`INFO`](Level::INFO)
|
|
|
|
|
|
|
|
/// should be _purely informational_ and not require any further investigation.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Colour
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// White
|
|
|
|
INFO,
|
|
|
|
INFO,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// # Usage
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Indicates that something _unexpected_ has happened within the program. This could represent
|
|
|
|
|
|
|
|
/// many things such as a problem or a simple disturbance. This should be used when something
|
|
|
|
|
|
|
|
/// unexpected has happened BUT the code can still continue to work.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Colour
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Yellow
|
|
|
|
WARN,
|
|
|
|
WARN,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// # Usage
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Indicates that the program has hit an issue that is preventing one or more functionalities
|
|
|
|
|
|
|
|
/// from properly functioning. This should be used when the application is currently displaying
|
|
|
|
|
|
|
|
/// incorrect behaviour that _needs_ to get fixed.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Colour
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Dark Red
|
|
|
|
ERROR,
|
|
|
|
ERROR,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// # Usage
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Indicates that the program has entered a state in which it has lost _critical business
|
|
|
|
|
|
|
|
/// functionality_ and cannot be used in production anymore. This should be used when the
|
|
|
|
|
|
|
|
/// program is in **URGENT** need of attention and absolutely should not be in a live environment.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Colour
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Red
|
|
|
|
FATAL,
|
|
|
|
FATAL,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|