It seems to me that is somewhat of a design flaw.
Say I have a number of threads, each serving a client connection. Now when
the thread starts, I can say:
This processor would add the user id to the record. Now, in various places
within the thread, I can simply call the logbook log functions, with the
user id always being automatically injected.
The problem is getting the extra info formatted. The handler that I setup
at the application-level knows nothing of these specific extra fields of a
sub-component of the app, nor should it.
I am considering attaching a handler to the logger that only reformats the
def emit(self, record):
record.message = '....'
log = logbook.Logger(__name__)
However, that feels a bit hacky. Is there a better way to deal with this?