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
//! # rslog
//!
//! A lightweight logging library for Rust built entirely using the standard library with zero external dependencies.
//!
//! ## Features
//!
//! - **Zero Dependencies**: Pure standard library implementation
//! - **Multiple Log Levels**: Debug, Info, Warn, Error, Critical
//! - **Multiple Output Targets**: Console and file output simultaneously
//! - **Async Writing**: Background thread for non-blocking file writes
//! - **Log Rotation**: Size-based and time-based rotation support
//! - **Multiple Output Formats**: Text, JSON, and custom patterns
//! - **Configurable**: Flexible configuration options
//!
//! ## Quick Start
//!
//! ```rust
//! use rslog::{Logger, LogLevel};
//!
//! // Get the logger instance
//! let logger = Logger::get_instance();
//!
//! // Log messages
//! logger.info("Application started");
//! logger.debug("Debug message");
//! logger.warn("Warning message");
//! logger.error("Error message");
//! logger.critical("Critical error");
//! ```
//!
//! ## Custom Configuration
//!
//! ```rust
//! use rslog::{Logger, LogLevel, ConfigBuilder, OutputFormat};
//!
//! let config = ConfigBuilder::new()
//! .log_dir("logs")
//! .file_prefix("app_")
//! .level(LogLevel::Info)
//! .output_format(OutputFormat::Json)
//! .build();
//!
//! Logger::init_with_config(config);
//! let logger = Logger::get_instance();
//! logger.info("Hello, world!");
//! ```
//!
//! ## Log Rotation
//!
//! ```rust
//! use rslog::{Logger, ConfigBuilder, RotationStrategy, RotatorConfig};
//!
//! let config = ConfigBuilder::new()
//! .rotation(RotatorConfig {
//! strategy: RotationStrategy::SizeBased(10 * 1024 * 1024), // 10MB
//! max_files: 5,
//! compress_old_files: false,
//! })
//! .build();
//!
//! Logger::init_with_config(config);
//! ```
pub use LogLevel;
pub use Logger;
pub use Config;
pub use ConfigBuilder;
pub use OutputFormat;
pub use ;
pub use ;
pub use ;