mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-01-31 03:36:41 +03:00
Update asyncio daemon to use Resource provider
This commit is contained in:
parent
d3ec1ef532
commit
018102b4e2
|
@ -226,7 +226,7 @@ Put next lines into the ``containers.py`` file:
|
||||||
|
|
||||||
config = providers.Configuration()
|
config = providers.Configuration()
|
||||||
|
|
||||||
configure_logging = providers.Callable(
|
logging = providers.Resource(
|
||||||
logging.basicConfig,
|
logging.basicConfig,
|
||||||
stream=sys.stdout,
|
stream=sys.stdout,
|
||||||
level=config.log.level,
|
level=config.log.level,
|
||||||
|
@ -270,7 +270,7 @@ Put next lines into the ``__main__.py`` file:
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
container = Container()
|
container = Container()
|
||||||
container.config.from_yaml('config.yml')
|
container.config.from_yaml('config.yml')
|
||||||
container.configure_logging()
|
container.init_resources()
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ Edit ``containers.py``:
|
||||||
|
|
||||||
config = providers.Configuration()
|
config = providers.Configuration()
|
||||||
|
|
||||||
configure_logging = providers.Callable(
|
logging = providers.Resource(
|
||||||
logging.basicConfig,
|
logging.basicConfig,
|
||||||
stream=sys.stdout,
|
stream=sys.stdout,
|
||||||
level=config.log.level,
|
level=config.log.level,
|
||||||
|
@ -461,7 +461,7 @@ Edit ``__main__.py``:
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
container = Container()
|
container = Container()
|
||||||
container.config.from_yaml('config.yml')
|
container.config.from_yaml('config.yml')
|
||||||
container.configure_logging()
|
container.init_resources()
|
||||||
container.wire(modules=[sys.modules[__name__]])
|
container.wire(modules=[sys.modules[__name__]])
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -562,7 +562,7 @@ Edit ``containers.py``:
|
||||||
|
|
||||||
config = providers.Configuration()
|
config = providers.Configuration()
|
||||||
|
|
||||||
configure_logging = providers.Callable(
|
logging = providers.Resource(
|
||||||
logging.basicConfig,
|
logging.basicConfig,
|
||||||
stream=sys.stdout,
|
stream=sys.stdout,
|
||||||
level=config.log.level,
|
level=config.log.level,
|
||||||
|
@ -667,7 +667,7 @@ Edit ``containers.py``:
|
||||||
|
|
||||||
config = providers.Configuration()
|
config = providers.Configuration()
|
||||||
|
|
||||||
configure_logging = providers.Callable(
|
logging = providers.Resource(
|
||||||
logging.basicConfig,
|
logging.basicConfig,
|
||||||
stream=sys.stdout,
|
stream=sys.stdout,
|
||||||
level=config.log.level,
|
level=config.log.level,
|
||||||
|
@ -766,7 +766,7 @@ Edit ``containers.py``:
|
||||||
|
|
||||||
config = providers.Configuration()
|
config = providers.Configuration()
|
||||||
|
|
||||||
configure_logging = providers.Callable(
|
logging = providers.Resource(
|
||||||
logging.basicConfig,
|
logging.basicConfig,
|
||||||
stream=sys.stdout,
|
stream=sys.stdout,
|
||||||
level=config.log.level,
|
level=config.log.level,
|
||||||
|
|
|
@ -15,7 +15,7 @@ def main(dispatcher: Dispatcher = Provide[Container.dispatcher]) -> None:
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
container = Container()
|
container = Container()
|
||||||
container.config.from_yaml('config.yml')
|
container.config.from_yaml('config.yml')
|
||||||
container.configure_logging()
|
container.init_resources()
|
||||||
container.wire(modules=[sys.modules[__name__]])
|
container.wire(modules=[sys.modules[__name__]])
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Container(containers.DeclarativeContainer):
|
||||||
|
|
||||||
config = providers.Configuration()
|
config = providers.Configuration()
|
||||||
|
|
||||||
configure_logging = providers.Callable(
|
logging = providers.Resource(
|
||||||
logging.basicConfig,
|
logging.basicConfig,
|
||||||
stream=sys.stdout,
|
stream=sys.stdout,
|
||||||
level=config.log.level,
|
level=config.log.level,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user