1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! # Logfather
//!
//! A simple, lightweight, and easy-to-use logging system. It allows for detailed log messages, configurable output levels, and supports both file and terminal output.
//!
//! ## Features
//! - Easy to set up and use
//! - Supports logging to both the terminal and log files
//! - Customizable log message format
//! - Configurable log levels (Info, Debug, Warning, Error, Critical, and Diagnostic)
//! - Configurable level display including colors, highlights, and styles
//! - Optional result (prepend `r_`) macros for managed errors
//! - Thread-safe
//!
//! ## Getting Started
//! To start using Logfather, add the following to your `Cargo.toml`:
//! ```toml
//! [dependencies]
//! logfather = "0.2.6"
//! - Check out [crates.io](https://crates.io/crates/logfather)
//! ```
//! - Minimum supported Rust version: `1.61.0`
//!
//! ## Usage
//! Macros:
//! - <b>Trace:</b> `trace!()` or `r_trace!()`
//! - <b>Debug:</b> `debug!()` or `r_debug!()`
//! - <b>Info:</b> `info!()` or `r_info!()`
//! - <b>Warning:</b> `warn!()`, `warning!()`, `r_warn!()`, or `r_warning!()`
//! - <b>Error:</b> `error!()` or `r_error!()`
//! - <b>Critical:</b> `critical!()`, `crit!()`, `r_critical!()`, or `r_crit!()`
//! - <b>Diagnostic:</b> `diagnostic!()`, `diag!()`, `r_diagnostic!()`, or `r_diag!()`
//!
//! Quick setup for outputting to terminal:
//! ```rust
//!
//! use logfather::*;
//!
//! let mut logger = Logger::new(); //Terminal output is enabled by default
//! error!("This is an error message");
//! ```
//!
//!
//! Setting up for only file output with specific error levels to be written:
//! ```rust
//!
//! use logfather::*;
//!
//! let mut logger = Logger::new();
//! logger.terminal(false); // Disable terminal output
//! logger.file(true); // Enable file output
//! logger.path("log.txt"); // Set the path for file logging
//! logger.level(Level::Error); // Set the minimum level
//!
//! info!("This is an info message"); // Will not be written to file
//! debug!("This is a debug message"); // Will not be written to file
//! warning!("This is a warning message"); // Will not be written to file
//!
//! error!("This is an error message"); // Will be written to file
//! critical!("This is a critical message"); // Will be written to file
//! ```
//! Set up for both terminal and file output capturing every level except warning
//! ```rust
//!
//! use logfather::*;
//!
//! // Supports the builder pattern
//! let mut logger = Logger::new() // Terminal output is enabled by default
//! .file(true) // Enable file output
//! .path("log.txt") // Set the path for file logging
//! .ignore(Level::Warning); // Set the specific level to ignore
//!
//! debug!("This is a debug message");
//! warning!("This is a warning message"); // Will be ignored
//! critical!("This is a critical message");
//! ```
//! Handle erroneous values gracefully with the `r_` prepended macros
//!
//! ```rust
//! use logfather::*;
//!
//! let mut logger = Logger::new();
//! match r_info!("This will return a Result<(), LogfatherError>") {
//! Ok(_) => println!("Successfully logged output"),
//! Err(e) => println!("Error logging output: {e}"),
//! }
//! ```
//! `Debug` and `Diagnostic` levels are Debug build only and will not be compiled in release builds
//! ```rust
//!
//! use logfather::*;
//!
//! debug!("This is a debug message");
//! diag!("This is a diagnostic message");
//! diagnostic!("This will not output for release builds");
//! ```
pub use Style;
pub use Logger;
pub use Level;
pub use TimeZone;
pub use LogfatherError;
pub use LogfatherResult;
pub use log;
pub use result_log;
;