Skip to content

Show module path when logging tasks - #42

Merged
codingjoe merged 1 commit into
codingjoe:mainfrom
kfdm:log-task-name
Sep 5, 2026
Merged

Show module path when logging tasks#42
codingjoe merged 1 commit into
codingjoe:mainfrom
kfdm:log-task-name

Conversation

@kfdm

@kfdm kfdm commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

In addition to logging the ID, the module_path can also be useful while debugging to know what is being run at a glance.

I figured the code example was faster to write and easier to understand than opening a regular issue to ask first, so let me know if this looks ok, or if you would like me to change the format a bit.

@codingjoe codingjoe left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Howdy, fancy seeing you here :)

Good idea. I honestly wish the TaskResult had a better __repr__ method. That would make logging simpler.

How about we slightly invert the order:

Task "foo.bar.baz" with result "asdf-asdf-asdf" succeeded.

or

Task "asdf-asfd-asfd@foo.bar.baz" succeeded.

@codingjoe codingjoe added the enhancement New feature or request label Sep 2, 2026
In addition to logging the ID, the module_path can also be useful
while debugging to know what is being run at a glance.
@kfdm

kfdm commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

%s&%s feels like it fits a bit better with the way the rest of the messages are written, so I've gone with that for now. What do you think?

INFO: 2026-09-04 15:29:48,178 - pid=61125 - Starting worker process WorkerProcess-14
INFO: 2026-09-04 15:29:53,105 - pid=61112 - Executing task '01a06b1c-0343-734a-b7e2-84cc3e2ddd1c@foobar.tasks.test_task'
INFO: 2026-09-04 15:29:53,110 - pid=61112 - Task '01a06b1c-0343-734a-b7e2-84cc3e2ddd1c@foobar.tasks.test_task' succeeded
INFO: 2026-09-04 15:30:03,818 - pid=61120 - Executing task '01a06b1c-2d14-7579-8ef3-97d8911d29ef@foobar.tasks.test_error'
ERROR: 2026-09-04 15:30:03,820 - pid=61120 - Task '01a06b1c-2d14-7579-8ef3-97d8911d29ef@foobar.tasks.test_error' failed
Traceback (most recent call last):
...
Exception: error


@codingjoe
codingjoe merged commit 814435e into codingjoe:main Sep 5, 2026
4 checks passed
@kfdm
kfdm deleted the log-task-name branch September 5, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants