This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mariocj89
Recipients lorb, mariocj89, raybb, vinay.sajip
Date 2021-03-26.13:59:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616767175.47.0.333265682754.issue41906@roundup.psfhosted.org>
In-reply-to
Content
Vinay would you consider a patch for logging where dictConfig allows taking objects directly in addition to the reference id?

That would allow the following:

```

def noErrorLogs(param):
    return 1 if param.levelno < 40 else 0

logconfig_dict = {
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "level": "DEBUG",
            "stream": "ext://sys.stdout",
            "filters": [noErrorLogs]
        }
    },
    "root": {"level": "DEBUG", "handlers": ["console"]},
    "version": 1,
}
dictConfig(logconfig_dict)
```

or alternatively passing them on declaration:

```
logconfig_dict = {
    'filters': {
        'myfilter': noErrorLogs,
    },
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "level": "DEBUG",
            "stream": "ext://sys.stdout",
            "filters": ["myfilter"]
        }
    },
    "root": {"level": "DEBUG", "handlers": ["console"]},
    "version": 1,
}
dictConfig(logconfig_dict)
```

I'm happy to put a patch together if that looks good to you.
History
Date User Action Args
2021-03-26 13:59:35mariocj89setrecipients: + mariocj89, vinay.sajip, lorb, raybb
2021-03-26 13:59:35mariocj89setmessageid: <1616767175.47.0.333265682754.issue41906@roundup.psfhosted.org>
2021-03-26 13:59:35mariocj89linkissue41906 messages
2021-03-26 13:59:35mariocj89create