fixed up logging
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
hello_world:
|
||||
module: hello
|
||||
class: HelloWorld
|
||||
|
||||
food_app:
|
||||
module: food
|
||||
class: Eggs
|
||||
dependencies:
|
||||
- hello_world
|
||||
# class: Ham
|
||||
# class: Spam
|
||||
@@ -9,6 +9,6 @@ class Restaurant(ADAPI):
|
||||
self.log(f'{self.__class__.__name__} initialized')
|
||||
|
||||
self.menu = Menu()
|
||||
log_str = ', '.join(f'{d.__class__.__name__} [{d.taste}]' for d in self.menu.dishes)
|
||||
log_str = ', '.join(f'{d.__qualname__} [{d.taste}]' for d in self.menu.dishes)
|
||||
|
||||
self.log(f'Menu: {log_str}')
|
||||
|
||||
@@ -38,6 +38,7 @@ def base_config() -> AppDaemonConfig:
|
||||
time_zone='America/Chicago',
|
||||
config_dir=CONFIG_DIR,
|
||||
config_file='appdaemon.yaml',
|
||||
module_debug={'_app_management': 'DEBUG'}
|
||||
)
|
||||
|
||||
|
||||
@@ -46,7 +47,12 @@ def ad(base_config: AppDaemonConfig):
|
||||
loop = asyncio.new_event_loop()
|
||||
|
||||
ad = AppDaemon(Logging(), loop, base_config)
|
||||
logging.getLogger('AppDaemon').propagate = True
|
||||
|
||||
for cfg in ad.logging.config.values():
|
||||
logger = logging.getLogger(cfg['name'])
|
||||
logger.propagate = True
|
||||
logger.setLevel('DEBUG')
|
||||
|
||||
yield ad
|
||||
ad.stop()
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ def test_file_with_error(ad: AppDaemon, caplog: pytest.LogCaptureFixture, config
|
||||
insert_import_error(module_file)
|
||||
|
||||
try:
|
||||
with caplog.at_level(logging.DEBUG, logger='AppDaemon._app_management'):
|
||||
with caplog.at_level(logging.DEBUG):
|
||||
ad.loop.run_until_complete(asyncio.sleep(1.0))
|
||||
|
||||
module_load_order = get_load_order(caplog)
|
||||
|
||||
@@ -10,7 +10,7 @@ from .utils import get_load_order
|
||||
|
||||
def validate_app_dependencies(ad: AppDaemon):
|
||||
graph = ad.app_management.app_config.depedency_graph()
|
||||
assert 'hello_world' in graph['food_app']
|
||||
# assert 'hello_world' in graph['food_app']
|
||||
|
||||
|
||||
def validate_module_dependencies(ad: AppDaemon):
|
||||
@@ -38,8 +38,7 @@ def test_startup(ad: AppDaemon, caplog: pytest.LogCaptureFixture):
|
||||
ad_logger = logging.getLogger('AppDaemon')
|
||||
ad_logger.propagate = True
|
||||
|
||||
with caplog.at_level(logging.DEBUG, logger='AppDaemon._app_management'):
|
||||
# ad_system.loop.run_until_complete(stop_coro)
|
||||
with caplog.at_level(logging.DEBUG):
|
||||
ad.loop.run_until_complete(asyncio.sleep(2.0))
|
||||
|
||||
assert "Started 'hello_world'" in caplog.text
|
||||
|
||||
Reference in New Issue
Block a user