[Python-Dev] Proposed changes to provide compression support for rotated log files (original) (raw)
Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Dec 15 19:56:26 CET 2011
- Previous message: [Python-Dev] Proposed changes to provide compression support for rotated log files
- Next message: [Python-Dev] French sprint this week-end
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Terry Reedy <tjreedy udel.edu> writes:
It appears you are adding two methods to do the same thing. One is to subclass and override one or two functions. The other is to define one or two custom functions and attach as attributes. Both seem equally easy. (Actually, subclassing takes one line less.) Are both really needed?
That's why I asked for comments. Subclassing can be avoided if the callable attributes are used, which is a win, for example, if you have both timed and non-timed rotating handlers: you can use the same callables in each case, whereas with subclassing you would have to subclass both the timed and non-timed handler classes. Also, in scenarios where one might want to use alternative compression formats based on an application's configuration, there would be less work because one wouldn't need to create multiple subclasses.
So for most cases the strategy would be to use the callable attributes, and if they were inappropriate for some reason, they could subclass and override the methods. I've factored out the two methods from the existing implementation because at the moment, it's hard to subclass without copying the whole doRollover method (as in the ActiveState example).
Regards,
Vinay Sajip
- Previous message: [Python-Dev] Proposed changes to provide compression support for rotated log files
- Next message: [Python-Dev] French sprint this week-end
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]