Update documentation to reflect implemented changes

- Clarify that size-based rotation is already implemented
- Update line numbers to match actual code location (line 407)
- Mark patch as reference since changes are already applied
- Remove misleading "recommended enhancement" language

Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-29 06:46:30 +00:00
parent b2444dee9a
commit 0d31071e18
2 changed files with 12 additions and 36 deletions

View File

@@ -15,23 +15,7 @@ RustDesk uses `flexi_logger` for logging with automatic log rotation. Logs are w
### Current Rotation Policy
The logging system (implemented in `libs/hbb_common/src/lib.rs`) currently uses:
```rust
.rotate(
Criterion::Age(Age::Day), // Rotate daily
Naming::Timestamps,
Cleanup::KeepLogFiles(31), // Keep last 31 days
)
```
**Limitation**: Individual log files have no size limit. If a single day's activity generates excessive logs, the file could grow very large and consume significant disk space.
## Recommended Enhancement
### Size-Based Rotation
To prevent individual log files from growing unbounded, add size-based rotation:
The logging system (implemented in `libs/hbb_common/src/lib.rs`) uses size-based rotation:
```rust
.rotate(
@@ -51,11 +35,11 @@ To prevent individual log files from growing unbounded, add size-based rotation:
### Implementation
The change needs to be made in the `hbb_common` library:
The implementation is in the `hbb_common` library:
**File**: `libs/hbb_common/src/lib.rs`
**Function**: `init_log()`
**Line**: ~405
**Line**: ~407
```diff
- Criterion::Age(Age::Day),

View File

@@ -1,32 +1,24 @@
# Patches for hbb_common
This directory contains patches that should be applied to the `hbb_common` library submodule.
This directory contains patches for reference. The changes described have already been applied to the `hbb_common` submodule in this PR.
## hbb_common-log-rotation.patch
**Status**: ✅ Already applied in this PR (submodule commit 0c401fd)
**Purpose**: Add size-based log rotation to prevent excessive disk usage
**Apply to**: `libs/hbb_common` submodule
**Target repository**: https://github.com/rustdesk/hbb_common
### How to apply
### Reference Information
#### Option 1: Apply in hbb_common repository
This patch file is provided for:
- Documentation of the exact changes made
- Reference for maintainers
- Potential cherry-picking to other branches if needed
```bash
cd /path/to/hbb_common
git apply /path/to/rustdesk/docs/patches/hbb_common-log-rotation.patch
git commit -m "Add size-based log rotation to prevent excessive disk usage"
```
#### Option 2: Apply in rustdesk repository submodule
```bash
cd libs/hbb_common
git apply ../../docs/patches/hbb_common-log-rotation.patch
git commit -m "Add size-based log rotation to prevent excessive disk usage"
# Note: This creates a local commit in the submodule
```
The changes have already been implemented in the submodule updated by this PR.
### What it does