vauxite-org / typescript-logging

TypeScript Logging library for both TypeScript and JavaScript
Apache License 2.0
95 stars 23 forks source link

How is log rotation handled? #42

Open samirm opened 4 years ago

samirm commented 4 years ago

This library claims to be a "log4j like" logger, but I'm not seeing any options for logfile configurations, especially for rotations.

Is this actually supported?

Thanks.

mreuvers commented 4 years ago

Hi there,

No that is currently not supported. Originally this was developed for browser only, and then later on also enabled for node. It sounds like you'd like to see something like that to work for node right?

I personally don't see much benefit in supporting an enormous amount of log options, but log rotation is useful. What do you think?

samirm commented 4 years ago

Ahhh, that makes a lot more sense. And yes I was looking for a solution that would support logging to file with some configuration controlling the number of files and window of time it would keep them. Not looking for many more options than this and what is already supported by the AbstractLogger.

mreuvers commented 4 years ago

Fair enough. I think this would be a nice enhancement.

I have to give it some thought where/when to do this though. Still gotta make one patch release shortly (another issue logged yesterday), but yours is going to be quite some work though.

I hope you're not in a rush at least? As I unfortunately have other work to do as well.

samirm commented 4 years ago

No rush at all, feel free to take as much time as you'd like. Not trying to discourage you, but I ended up switching to log4js as it already has this feature.

mreuvers commented 4 years ago

That's no problem, still I will consider adding this later.

sudeepd commented 4 years ago

I can offer to add a file logger, if you point me to the code area where this needs to go, and general guidance. I find your library useful, tried it in the node project, i need the file logging capability, and I am willing to add it

mreuvers commented 4 years ago

Thank you for the kind offer. But for now don't spend your time on this, as the current version is going to be released as a final 1.0.0 version soon.

However the next major version will be a large rewrite of the current, and node file logging (and rotation) is expected to be dealt with then as well.

For the current version if you need it, I'd recommend to implement your own custom logger (use one of the abstract logger classes as base).