Re: logging: local functions ==> loss of lineno

2010-03-31 Thread Peter Otten
Hellmut Weber wrote: > Hi Peter and Jean-Michel, > thanks for all your hints and pieces of code. > > It took me a while to play around with what I got from you (and some > study of Vinay's module documentation. > > Now I have come up with a more complete solution I'm quite satisfied > with. And

Re: logging: local functions ==> loss of lineno

2010-03-30 Thread Hellmut Weber
Hi Peter and Jean-Michel, thanks for all your hints and pieces of code. It took me a while to play around with what I got from you (and some study of Vinay's module documentation. Now I have come up with a more complete solution I'm quite satisfied with. And I would be very glad to receive yo

Re: logging: local functions ==> loss of lineno

2010-03-24 Thread Vinay Sajip
On Mar 24, 9:34 am, Peter Otten <__pete...@web.de> wrote: > > You mean you'd have to monkey-patchlogging._findCaller() instead of > overridinglogging.Logger.findCaller()? > > I don't see a big advantage in that. > Only that you just have to replace a function, and not have to subclass Logger + ove

Re: logging: local functions ==> loss of lineno

2010-03-24 Thread Jean-Michel Pichavant
Peter Otten wrote: Vinay Sajip wrote: Sorry I'm a little late to this discussion. I could add a _findCaller function to the module (not part of the public API, but replaceable by someone who really needs to) which does the heavy lifting, and Logger.findCaller just calls it. Then those who ne

Re: logging: local functions ==> loss of lineno

2010-03-24 Thread Peter Otten
Vinay Sajip wrote: > Sorry I'm a little late to this discussion. I could add a _findCaller > function to the module (not part of the public API, but replaceable by > someone who really needs to) which does the heavy lifting, and > Logger.findCaller just calls it. Then those who need to can impleme

Re: logging: local functions ==> loss of lineno

2010-03-23 Thread Vinay Sajip
On Mar 20, 8:36 am, Peter Otten <__pete...@web.de> wrote: > Jean-Michel Pichavant wrote: > > You are still accessing the private attribute of the  modulelogging. > > Just reading it is a significantly more conservative approach than setting > it to an object with an unusual notion of equality ;) >

Re: logging: local functions ==> loss of lineno

2010-03-20 Thread Peter Otten
Jean-Michel Pichavant wrote: > You are still accessing the private attribute of the module logging. Just reading it is a significantly more conservative approach than setting it to an object with an unusual notion of equality ;) > My previous remark was misleading, in fact there's nothing you

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Jean-Michel Pichavant
Peter Otten wrote: Jean-Michel Pichavant wrote: Hellmut Weber wrote: Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Peter Otten
Jean-Michel Pichavant wrote: > Hellmut Weber wrote: >> Am 11.03.2010 12:14, schrieb Peter Otten: >>> Hellmut Weber wrote: >>> Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT when I have to w

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Jean-Michel Pichavant
Hellmut Weber wrote: Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT when I have to wrap the logger call in some other function, I always ge

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Peter Otten
Hellmut Weber wrote: > your hack is exactly what I was looking for. > It permits to configure my logging messages as I want, e.g. using > different colors for different classes of messages. > > I do not yet understand all details WHY it is working but suppose some > study of the logging module wi

Re: logging: local functions ==> loss of lineno

2010-03-18 Thread Hellmut Weber
Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT when I have to wrap the logger call in some other function, I always get file name and line numb

Re: logging: local functions ==> loss of lineno

2010-03-15 Thread Hellmut Weber
Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT when I have to wrap the logger call in some other function, I always get file name and line numb

Re: logging: local functions ==> loss of lineno

2010-03-11 Thread Peter Otten
Hellmut Weber wrote: > Logging works very well giving the filename and line number of the point > where it is called. As long as I use the loggers directly. > BUT when I have to wrap the logger call in some other function, I always > get file name and line number of the call of the logger inside t

Re: logging: local functions ==> loss of lineno

2010-03-11 Thread Jean-Michel Pichavant
Hellmut Weber wrote: Hi Vinay Sajip, I'm very glad discoverd your logging module ;-) (That's what I would have liked 25 years ago when I was working as a technical software developper!) Now I'm writing just some personal tools, I like python and want to use logging on a regular basis. Loggi

logging: local functions ==> loss of lineno

2010-03-10 Thread Hellmut Weber
Hi Vinay Sajip, I'm very glad discoverd your logging module ;-) (That's what I would have liked 25 years ago when I was working as a technical software developper!) Now I'm writing just some personal tools, I like python and want to use logging on a regular basis. Logging works very well giv