Skip to content
Snippets Groups Projects
Commit 9bde5d0e authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Splice '.line' into logger name for debug log

Now the log is sent to
`flamenco_worker.commands.blender_render.line.(task_id=xxx, command_idx=0)`
instead of
`flamenco_worker.commands.blender_render.(task_id=xxx, command_idx=0).line`

This makes configuration of log levels easier.
parent 9978f280
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,8 @@ scene.render.filepath = "%(tmpdir)s/preview.jpg" ...@@ -45,6 +45,8 @@ scene.render.filepath = "%(tmpdir)s/preview.jpg"
bpy.ops.render.render(write_still=True) bpy.ops.render.render(write_still=True)
""" """
log = logging.getLogger(__name__)
def command_executor(cmdname): def command_executor(cmdname):
"""Class decorator, registers a command executor.""" """Class decorator, registers a command executor."""
...@@ -90,7 +92,7 @@ class AbstractCommand(metaclass=abc.ABCMeta): ...@@ -90,7 +92,7 @@ class AbstractCommand(metaclass=abc.ABCMeta):
self.command_name, self.command_name,
self.task_id, self.task_id,
self.command_idx) self.command_idx)
self._log = logging.getLogger('%s.%s' % (__name__, self.identifier)) self._log = log.getChild(self.identifier)
async def run(self, settings: dict) -> bool: async def run(self, settings: dict) -> bool:
"""Runs the command, parsing output and sending it back to the worker. """Runs the command, parsing output and sending it back to the worker.
...@@ -458,7 +460,7 @@ class AbstractSubprocessCommand(AbstractCommand): ...@@ -458,7 +460,7 @@ class AbstractSubprocessCommand(AbstractCommand):
self._log.info('Executing %s', cmd_to_log) self._log.info('Executing %s', cmd_to_log)
await self.worker.register_log('Executing %s', cmd_to_log) await self.worker.register_log('Executing %s', cmd_to_log)
line_logger = self._log.getChild('line') line_logger = log.getChild(f'line.{self.identifier}')
self.proc = await asyncio.create_subprocess_exec( self.proc = await asyncio.create_subprocess_exec(
*args, *args,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment