Skip to content

Include function name in log messages#536

Merged
timtreis merged 3 commits intomainfrom
enhancement/issue468-logger-function-context
Feb 27, 2026
Merged

Include function name in log messages#536
timtreis merged 3 commits intomainfrom
enhancement/issue468-logger-function-context

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented Feb 27, 2026

Summary

  • Log messages now show the public function name that triggered them (render_shapes, render_points, render_images, render_labels, show) instead of internal helper names.
  • Uses a contextvars.ContextVar set at each entry point, read by a logging.Filter on the RichHandler. This means even deeply nested helpers (e.g. _rasterize_if_necessary, _set_color_source_vec) report the correct user-facing origin.

Before

INFO     Rasterizing image for faster rendering.
INFO     Using 'datashader' backend with 'sum' as reduction method...
WARNING  Converting copy of 'cat' column to categorical dtype...

After

INFO     render_images: Rasterizing image for faster rendering.
INFO     render_shapes: Using 'datashader' backend with 'sum' as reduction method...
WARNING  render_labels: Converting copy of 'cat' column to categorical dtype...

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.83%. Comparing base (d7dc3f0) to head (ea9866e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #536      +/-   ##
==========================================
+ Coverage   83.74%   83.83%   +0.09%     
==========================================
  Files           8        8              
  Lines        2553     2568      +15     
==========================================
+ Hits         2138     2153      +15     
  Misses        415      415              
Files with missing lines Coverage Δ
src/spatialdata_plot/_logging.py 93.47% <100.00%> (+1.81%) ⬆️
src/spatialdata_plot/pl/basic.py 91.57% <100.00%> (+0.02%) ⬆️
src/spatialdata_plot/pl/render.py 88.80% <100.00%> (+0.08%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

timtreis and others added 2 commits February 27, 2026 19:34
Instead of exposing internal helper names like _rasterize_if_necessary,
log messages now show the user-facing origin (render_shapes, render_points,
render_images, render_labels).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Helpers called from show() before _render_* dispatch (e.g. _get_valid_cs)
now report "show:" as their origin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@timtreis timtreis marked this pull request as ready for review February 27, 2026 21:29
@timtreis timtreis merged commit 1f66375 into main Feb 27, 2026
6 checks passed
@timtreis timtreis deleted the enhancement/issue468-logger-function-context branch February 27, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants