diff --git a/src/lib.rs b/src/lib.rs index 4ae7e58..54f5d70 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,7 @@ //! ## Feature Set //! //! - [x] Logging Levels -//! - [x] Coloured Output +//! - [x] Datetime & Coloured Output //! - [ ] Options for Datetime, Current Function, Line Number, Custom Colours, etc. //! - [ ] Custom Formatting //! - [ ] File support @@ -19,19 +19,19 @@ //! //! ## Quick Start //! -//! ```rust -//! use rall::{SimpleLogger, Level}; +//! For the fastest setup possible, declarative macros are exposed that have a predefined format. +//! This is to allow hassle-free and painless setup that will let you log instantly! //! -//! // Create Default SimpleLogger -//! let mut logger = SimpleLogger::default(); +//! ```rust +//! use rall::{debug, error, fatal, info, trace, warn}; //! //! // Log Out To Standard Output -//! logger.log(Level::TRACE, "My Best Friend Hazel :D"); -//! logger.log(Level::DEBUG, "My Best Friend Hazel :D"); -//! logger.log(Level::INFO, "My Best Friend Hazel :D"); -//! logger.log(Level::WARN, "My Best Friend Hazel :D"); -//! logger.log(Level::ERROR, "My Best Friend Hazel :D"); -//! logger.log(Level::FATAL, "My Best Friend Hazel :D"); +//! trace!("My Best Friend Hazel :D"); +//! debug!("My Best Friend Hazel :D"); +//! info!("My Best Friend Hazel :D"); +//! warn!("My Best Friend Hazel :D"); +//! error!("My Best Friend Hazel :D"); +//! fatal!("My Best Friend Hazel :D"); //! ``` //! #![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}; -/// TODO +/// Represents all the possible logging levels: +/// +/// **TRACE**, +/// **DEBUG**, +/// **INFO**, +/// **WARN**, +/// **ERROR**, +/// **FATAL** 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, + + /// # 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, + + /// # 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, + + /// # 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, + + /// # 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, + + /// # 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, }