From 018102b4e24839c946eebfa7ce2b5a6e00fc59d6 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Wed, 28 Oct 2020 22:28:49 -0400 Subject: [PATCH] Update asyncio daemon to use Resource provider --- docs/tutorials/asyncio-daemon.rst | 14 +++++++------- .../asyncio-daemon/monitoringdaemon/__main__.py | 2 +- .../asyncio-daemon/monitoringdaemon/containers.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/tutorials/asyncio-daemon.rst b/docs/tutorials/asyncio-daemon.rst index bb5413e5..71aeecf7 100644 --- a/docs/tutorials/asyncio-daemon.rst +++ b/docs/tutorials/asyncio-daemon.rst @@ -226,7 +226,7 @@ Put next lines into the ``containers.py`` file: config = providers.Configuration() - configure_logging = providers.Callable( + logging = providers.Resource( logging.basicConfig, stream=sys.stdout, level=config.log.level, @@ -270,7 +270,7 @@ Put next lines into the ``__main__.py`` file: if __name__ == '__main__': container = Container() container.config.from_yaml('config.yml') - container.configure_logging() + container.init_resources() main() @@ -421,7 +421,7 @@ Edit ``containers.py``: config = providers.Configuration() - configure_logging = providers.Callable( + logging = providers.Resource( logging.basicConfig, stream=sys.stdout, level=config.log.level, @@ -461,7 +461,7 @@ Edit ``__main__.py``: if __name__ == '__main__': container = Container() container.config.from_yaml('config.yml') - container.configure_logging() + container.init_resources() container.wire(modules=[sys.modules[__name__]]) main() @@ -562,7 +562,7 @@ Edit ``containers.py``: config = providers.Configuration() - configure_logging = providers.Callable( + logging = providers.Resource( logging.basicConfig, stream=sys.stdout, level=config.log.level, @@ -667,7 +667,7 @@ Edit ``containers.py``: config = providers.Configuration() - configure_logging = providers.Callable( + logging = providers.Resource( logging.basicConfig, stream=sys.stdout, level=config.log.level, @@ -766,7 +766,7 @@ Edit ``containers.py``: config = providers.Configuration() - configure_logging = providers.Callable( + logging = providers.Resource( logging.basicConfig, stream=sys.stdout, level=config.log.level, diff --git a/examples/miniapps/asyncio-daemon/monitoringdaemon/__main__.py b/examples/miniapps/asyncio-daemon/monitoringdaemon/__main__.py index c0341357..fe43d1ac 100644 --- a/examples/miniapps/asyncio-daemon/monitoringdaemon/__main__.py +++ b/examples/miniapps/asyncio-daemon/monitoringdaemon/__main__.py @@ -15,7 +15,7 @@ def main(dispatcher: Dispatcher = Provide[Container.dispatcher]) -> None: if __name__ == '__main__': container = Container() container.config.from_yaml('config.yml') - container.configure_logging() + container.init_resources() container.wire(modules=[sys.modules[__name__]]) main() diff --git a/examples/miniapps/asyncio-daemon/monitoringdaemon/containers.py b/examples/miniapps/asyncio-daemon/monitoringdaemon/containers.py index cc134f7b..cfcb3be5 100644 --- a/examples/miniapps/asyncio-daemon/monitoringdaemon/containers.py +++ b/examples/miniapps/asyncio-daemon/monitoringdaemon/containers.py @@ -12,7 +12,7 @@ class Container(containers.DeclarativeContainer): config = providers.Configuration() - configure_logging = providers.Callable( + logging = providers.Resource( logging.basicConfig, stream=sys.stdout, level=config.log.level,