diff --git a/.gitignore b/.gitignore index ea8c4bf..2f88dba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target +**/*.rs.bk +Cargo.lock \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5e749c6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] - 2025-09-30 + +### Added + +- Initial release of log4r +- Basic logging functionality with five log levels (Trace, Debug, Info, Warn, Error) +- Thread-safe logger implementation +- Simple API inspired by log4j +- Examples for basic and advanced usage \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index a70dad2..8b27943 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,15 @@ name = "log4r" version = "0.1.0" edition = "2024" +authors = ["log4r contributors"] +description = "A log4j-like logging framework for Rust" +license = "MIT" +repository = "https://git.kingecg.top/kingecg/log4r.git" +homepage = "https://git.kingecg.top/kingecg/log4r.git" +documentation = "https://docs.rs/log4r" +keywords = ["logging", "log4j", "log"] +categories = ["development-tools::debugging"] +readme = "README.md" [dependencies] -chrono = "0.4.42" +chrono = "0.4.42" \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..efe4d86 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 log4r contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..feb6769 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# log4r + +A log4j-like logging framework for Rust. + +## Overview + +`log4r` is a simple, extensible logging framework inspired by log4j. It provides different log levels and an easy-to-use API for Rust applications. + +## Features + +- Multiple log levels (Trace, Debug, Info, Warn, Error) +- Simple API similar to log4j +- Thread-safe logging +- Timestamped log entries +- Configurable log levels + +## Installation + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +log4r = "0.1" +``` + +## Example + +```rust +use log4r::{LogLevel, Logger}; + +fn main() { + // Initialize the logger with Debug level + Logger::init(LogLevel::Debug); + + // Test all log levels + log4r::trace!("This is a trace message - won't be printed"); + log4r::debug!("This is a debug message - will be printed"); + log4r::info!("This is an info message - will be printed"); + log4r::warn!("This is a warning message - will be printed"); + log4r::error!("This is an error message - will be printed"); +} +``` + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. \ No newline at end of file