Skip to content

PUBHandler prepends loglevel, module and line to log message #1253

Open
@Blindfreddy

Description

@Blindfreddy

I have successfully implemented a PUBHandler, however, for all loglevels except info the subscriber seems to receive a message bytestring which has prepended the loglevel as a string, the originating module name and the line in the module.

Examples:
INFO - seems fine
2019-01-14 23:38:49,764 INFO TS_T1: starting cycle...

DEBUG - loglevel, module name and line prepended to the log message
2019-01-14 23:38:49,765 DEBUG **DEBUG sensor.py:191** - TS_T1: take_reading...

ERROR- same as debug plus appends "- None"
2019-01-14 23:42:48,936 ERROR **ERROR foundation.py:489** - TS_T1: starting cycle...done. **- None**
CRITICAL - same as debug
2019-01-14 23:38:49,770 CRITICAL **CRITICAL foundation.py:489** - TS_T1: starting cycle...done.

It can be filtered with message.split(b" - ")[-1:][0].decode('utf-8') but that seems awkward. Is there a way to suppress this at the source, or am I perhaps not understanding the way PUBHandler emits logrecords fully ?

Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions