Skip to content

Commit

Permalink
Merge branch 'main' into feat/support_fury2
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 20, 2023
2 parents 0517282 + d656b62 commit cf636eb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/xoscar/backends/indigen/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ def _start_sub_pool(
logging_conf = conf["logging_conf"] or {}
if isinstance(logging_conf, configparser.RawConfigParser):
logging.config.fileConfig(logging_conf)
elif logging_conf.get("dict"):
logging.config.dictConfig(logging_conf["dict"])
elif logging_conf.get("file"):
logging.config.fileConfig(logging_conf["file"])
elif logging_conf.get("level"):
Expand Down
31 changes: 31 additions & 0 deletions python/xoscar/backends/indigen/tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,36 @@ def get_pid(self):
assert len({await ref.get_pid() for ref in refs}) == 2


# equivalent to test-logging.conf
DICT_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"formatter": {
"format": "%(asctime)s %(name)-12s %(process)d %(levelname)-8s %(message)s",
},
},
"handlers": {
"stream_handler": {
"class": "logging.StreamHandler",
"formatter": "formatter",
"stream": "ext://sys.stderr",
},
},
"loggers": {
"": {
"level": "WARN",
"handlers": ["stream_handler"],
},
"xoscar.backends.indigen.tests": {
"level": "DEBUG",
"handlers": ["stream_handler"],
"propagate": False,
},
},
}


@pytest.mark.asyncio
@pytest.mark.parametrize(
"logging_conf",
Expand All @@ -855,6 +885,7 @@ def get_pid(self):
},
{"level": logging.DEBUG},
{"level": logging.DEBUG, "format": "%(asctime)s %(message)s"},
{"dict": DICT_CONFIG},
],
)
async def test_logging_config(logging_conf):
Expand Down

0 comments on commit cf636eb

Please sign in to comment.