Add log rotation system with lumberjack #20
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces logging enhancements for better logging management.
lumberjack
library is integrated for log rotation. This ensures that the application's logs are rotated periodically, preventing excessive disk space usage, and facilitating easier log analysis.Additionally, the PR introduces several new command-line flags that allow for fine-grained control over the logging behavior of the application.
The new flags include:
These flags allow users to control where logs are stored, the maximum size of individual log files, how long log files are retained, how many backup log files are kept, and whether or not to compress old log files.
An example command might look like:
Future work
Going forward, we may consider integrating an additional logging library such as
logrus
to provide more granular control over log levels or verbosity.Additionally,
logrus
supports structured logging, which means that logs can be outputted in a machine-readable format (like JSON). This is particularly useful when the logs are to be processed by other software for log analysis and visualization.We could potentially incorporate these flags (
LogConsoleJsonFlag
,LogDirJsonFlag
,LogVerbosityFlag
,LogConsoleVerbosityFlag
,LogDirPathFlag
,LogDirVerbosityFlag
) withlogrus
, further enhancing the flexibility and control we have over our logging strategy.