Skip to content

Add Log Rotation feature#82

Merged
babarot merged 10 commits intomainfrom
babarot/log-enable-rotation
Feb 21, 2025
Merged

Add Log Rotation feature#82
babarot merged 10 commits intomainfrom
babarot/log-enable-rotation

Conversation

@babarot
Copy link
Copy Markdown
Owner

@babarot babarot commented Feb 21, 2025

This PR introduces log rotation capabilities and includes several architectural improvements to enhance logging and debugging functionality.

Major Changes

πŸ”„ Log Rotation Implementation

  • Added configurable log rotation with size-based triggers and backup management
  • Introduced new configuration options under logging section:
logging:
  enabled: true
  level: debug
  rotation:
    max_size: 10MB  # Maximum size before rotation
    max_files: 3    # Number of backup files to keep
  • Implemented thread-safe log rotation with proper file handling and atomic operations
  • Added support for human-readable size formats (e.g., "10MB", "1GB") using docker/go-units

πŸ—οΈ Architectural Improvements

  • Moved home_fallback config from Core to TrashConfig for better organization
  • Enhanced debug package independence:
    • Split debug functionality into separate files for better maintainability
    • Added distinct modes for viewing logs (full/live)
    • Improved error handling and reporting for log file operations

Migration Notes

If you're using the home_fallback setting, you'll need to update your config:

# Old
core:
 home_fallback: true

# New
core:
 trash:
   home_fallback: true

Acknowledgments

The log rotation implementation was inspired by #80 (thanks @kariudo!).

There should probably configurable support for log verbosity, theres a pretty large volume of logging for each run flowing through the charm log right now, since most people probably wont ever look at the log, logging debug by default (warn/error instead) is probably overkill and just going to slowly eat disk.

@babarot babarot added the kind/feature A feature request; new or enhanced behavior label Feb 21, 2025
@babarot babarot merged commit 5394ac6 into main Feb 21, 2025
5 checks passed
@babarot babarot deleted the babarot/log-enable-rotation branch February 21, 2025 16:37
@github-actions github-actions bot mentioned this pull request Feb 21, 2025
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 6, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [babarot/gomi](https://github.com/babarot/gomi) | minor | `v1.4.3` -> `v1.5.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>babarot/gomi (babarot/gomi)</summary>

### [`v1.5.1`](https://github.com/babarot/gomi/blob/HEAD/CHANGELOG.md#v151---2025-02-23)

[Compare Source](babarot/gomi@v1.5.0...v1.5.1)

##### New Features

-   Add Log Rotation feature by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#82

### [`v1.5.0`](https://github.com/babarot/gomi/blob/HEAD/CHANGELOG.md#v150---2025-02-21)

[Compare Source](babarot/gomi@v1.4.3...v1.5.0)

##### New Features

-   Add Permanent Deletion Feature with Confirmation Dialog   by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#79

##### Refactorings

-   Large-scale Code Refactoring for Better Architecture by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#81

##### Others

-   Create missing log path by [@&#8203;kariudo](https://github.com/kariudo) in babarot/gomi#80

</details>

---

### Configuration

πŸ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

β™» **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

πŸ”• **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODIuNCIsInVwZGF0ZWRJblZlciI6IjM5LjE4Mi40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature A feature request; new or enhanced behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant