Opened 3 years ago

Last modified 3 years ago

#5425 defect new

Twisted provided ILogObserver implementations do not declare that they implement ILogObserver

Reported by: robertc Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description (last modified by exarkun)

This means they cannot be passed through application.addComponent to customise the log observer used in a tac file; and they also provide a poor example for folk writing their own observers (e.g. the one I wrote for python-oops-twisted has an emit method which seemed idiomatic, but that emit method while it meets the contract for ILogObserver does not and can not declare that it implements it).

If the twisted internal code were idiomatic here (e.g. implements __call__ and had an implements(ILogObserver) declaration) we would have saved a bunch of developer time wondering wtf things were not working as expected.

Change History (3)

comment:1 Changed 3 years ago by exarkun

  • Description modified (diff)

comment:2 Changed 3 years ago by exarkun

  • Summary changed from Twisted provided ILogObserver implementations do not implement ILogObserver to Twisted provided ILogObserver implementations do not declare that they implement ILogObserver

comment:3 Changed 3 years ago by exarkun

The ILogObserver docstring says:

Given that most log observers are actually bound methods, it's okay to not
explicitly declare provision of this interface.

Considering an implements declaration is mostly just more documentation, I wonder how it would help if this existing API documentation does not.

Note: See TracTickets for help on using tickets.