I grew a little bit tired of reading my long Informer logs so I decided
to create a customized Informer class that creates multiple logs based
on time. Please welcome the RotatingInformer.
The RotatingInformer works mostly like the ordinary Informer class but
there are some differences:
* The RotatingInformer works on files only. No stdout, stderr etc.
* When creating the RotatingInformer you specify a directory instead of
a file to log to. All log files will be created in this directory.
* You specify how often you want to rotate files by specifying the time
format should be used. For example, if you specify the format
"errors_%Y-%m-%d.log" you will get one log file each day (named
errors_2008-09-14.log, errors_2008-09-15.log and so on. If you specify
the format "errors_%Y-%m-%d %H %M.log" you will get a new log file every
minute.
* The RotatingInformer only creates files when it needs to. No activity
on the server means no log files.
Please let me know what you think. It only a first try, suggestions for
improvements are most welcome.
Thanks
/lasso
(oh...and I've never ever used git before. Please tell me if I did
something wrong with the attached file)
--
________________________________________
Lars Olsson
la...@lassoweb.se
http://www.lassoweb.se/
you should look into the logging gem, it does this and much much
more. might be less maintenance long term to wrap that in an informer
class.
cheers.
> --
> ________________________________________
> Lars Olsson
> la...@lassoweb.se
> http://www.lassoweb.se/
>
> >
> <rotatinginformer.tar.bz2>
a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama