← Back to team overview

ufl team mailing list archive

Re: [HG UFL] Fix printing without newline on '...' without using print. Found nice

 

On Mon, Mar 9, 2009 at 10:17 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> On Mon, Mar 09, 2009 at 08:54:07PM +0100, Martin Sandve Alnæs wrote:
>> Ok for now, but modifying the standard library behaviour isn't a very
>> nice thing to do :)
>>
>> Martin
>
> I tried changing only the method for the UFL StreamHandler instance
> but that didn't work.

Don't bother now. Anyway, the point of using the Python logging system
is that we can attach _multiple_ StreamHandlers to the UFL logger,
e.g., for merging with SFC/FFC logs and dumping logs to file, so
modifying the default stream handler isn't the right thing to do.

>
> If I do
>
>  self._handler.emit = emit
>
> I get
>
>  File "/usr/lib/python2.5/logging/__init__.py", line 655, in handle
>    self.emit(record)
>  TypeError: emit() takes exactly 2 arguments (1 given)

I didn't understand this on a first glance. Have you tried defining
emit(self, arg) outside of the Logger class?

Martin


Follow ups

References