Commit Graph

9 Commits

Author SHA1 Message Date
kingecg 36b2fe9f34 ```
feat(logger): add maxCount configuration option for file appender

Add support for maxCount parameter in file appender configuration.
The maxCount option allows users to specify the maximum number of
backup files to keep when log rotation is enabled.

The new configuration option defaults to 1 if not specified in the
appender options and is passed to the FileAppender struct during
initialization.
```

Co-authored-by: Copilot <copilot@github.com>
2026-07-11 08:54:19 +08:00
kingecg cdea9d86ed ```
feat(file): add thread safety and improve log rolling functionality

- Add sync.Mutex to FileAppender for thread-safe operations
- Implement proper mutex locking in start() goroutine to prevent
  race conditions during file operations
- Return boolean from checkAndRoll() method to indicate if rolling occurred
- Add MaxCount field to limit number of archived log files
- Implement cleanup of old log files exceeding MaxCount limit
- Add proper error handling for file rename operations
- Track current file size using WriteString return values

refactor(format): update formatting functions with better type safety

- Change isFormatString parameter

Co-authored-by: Copilot <copilot@github.com>
2026-07-09 21:47:03 +08:00
kingecg 107b8f3050 add doc 2025-06-06 19:38:01 +08:00
程广 b5ea719c56 file appender添加滚动设置,appender添加formatter设置 2025-06-06 11:07:04 +08:00
kingecg 6d89afc6e3 fix dead loop 2024-09-21 14:25:45 +08:00
kingecg 20e440f79d 增加close file code 2023-12-13 23:07:32 +08:00
kingecg a6aaaa7495 getlogger返回指针,file 改为通过协程写文件 2023-12-13 23:05:42 +08:00
程广 bde229321f refactor 2023-11-29 10:16:56 +08:00
程广 97ba3d3215 add file appender 2023-11-28 18:31:45 +08:00