[New-bugs-announce] [issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple
Henrique
report at bugs.python.org
Fri Dec 27 15:33:12 EST 2019
New submission from Henrique <coura.henrique at gmail.com>:
While passing
{
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {"format": "%(levelname)s %(asctime)s %(module)s %(message)s"}
},
"handlers": {
"stackdriver": {
"class": "google.cloud.logging.handlers.CloudLoggingHandler",
"client": client,
"resource": resource,
},
},
"root": {"level": "INFO", "handlers": ["stackdriver"]},
}
to logging.config.dictConfig it will convert resource, which is a namedtuple to ConvertingTuple, this will make google.cloud.logging.handlers.CloudLoggingHandler break down the line.
I am having to create a wrapper class like
class Bla:
resource = logging.resource.Resource(
type="cloud_run_revision",
labels={},
)
def _to_dict(self):
return self.resource._to_dict()
to go around this
----------
messages: 358914
nosy: hcoura
priority: normal
severity: normal
status: open
title: logging.config.dictConfig will convert namedtuple to ConvertingTuple
type: crash
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39142>
_______________________________________
More information about the New-bugs-announce
mailing list