ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #00973
Re: [HG UFL] Fix printing without newline on '...' without using print. Found nice
On Mon, Mar 09, 2009 at 10:27:19PM +0100, Martin Sandve Alnæs wrote:
> 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?
Yes, same thing.
I found a solution. Instead of just
instance.foo = foo
one needs to do
instance.foo = new.instancemethod(foo, instance, instance.__class__)
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References