logger
logger copied to clipboard
The feature to automatically split log files based on policy?
Hi amazing developers,
This package is great, but the file output specifications seem a bit weak. What is needed, especially when it comes to file output, is the ability to create a separate file and move the write destination when a certain number of lines or size is reached.
This split policy is then supposed to be passed by the user in the form of a Configuration
object.
It is not possible with the current specification to pass the file object directly to the constructor, but I think it is feasible enough to add a constructor with a name like fromConfig
.
Or does this idea not fit the design philosophy of this package?
Thank you.
You are talking about log rotation?
Personally I would let a separate piece of software do that for me like logrotate. But I guess you could write a custom LogOutput
class too. I'm won't change any existing classes for this. But I'm more than happy to accept a new LogOutput
class!
Yes it's about log rotation! I'm not a native English speaker, so this is the first time I know the name in English for this mechanism haha, thanks :)
It's true that this would be better to create a new class that extends LogOutput
rather than adding it to an existing class. I will first create a prototype and test it when I have time 👍
@myConsciousness Do you have some results?
https://github.com/ueki-tomohiro/rotation_log/tree/main/packages/rotation_log/lib/src
Hi @antonshkurenko ,
I was very busy and I couldn't touch it yet, but as @dgurudot suggested an interesting repository it's easy to implement.
However, I felt the implementation of the repository @dgurudot referred us is a bit difficult to use in many cases. If it's to be implemented in this repository, it should be more generic :)