New submission from Henrique <coura.henri...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue39142>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to