From 7c93a2030c3ec177612d7794f36afaabea9a68f1 Mon Sep 17 00:00:00 2001 From: kingecg Date: Tue, 30 Sep 2025 00:14:16 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(init):=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 .gitignore 忽略 target 目录、*.rs.bk 文件和 Cargo.lock - 创建 CHANGELOG.md 并记录初始版本 0.1.0 的变更信息 - 在 Cargo.toml 中完善包元数据,包括作者、描述、许可证等信息 - 添加 MIT 许可证文件 LICENSE - 编写 README.md,介绍项目概览、特性、安装方式和使用示例 ``` --- .gitignore | 2 ++ CHANGELOG.md | 16 ++++++++++++++++ Cargo.toml | 11 ++++++++++- LICENSE | 21 +++++++++++++++++++++ README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md 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