Skip to content

Conversation

mayhem
Copy link
Member

@mayhem mayhem commented Jun 18, 2025

Right now all output about scanning a subsonic collection goes to stdout, which is worthless for a web app like lb-local. Naming the logger and adding a new logging level that this output goes to allows third parties to tap into better logging facilities in troi.

@mayhem mayhem requested a review from amCap1712 June 18, 2025 10:08
Copy link

github-actions bot commented Jun 18, 2025

Test Results

  4 files  ±0    4 suites  ±0   4s ⏱️ ±0s
 50 tests ±0   50 ✅ ±0  0 💤 ±0  0 ❌ ±0 
200 runs  ±0  200 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 0fcc5a3. ± Comparison against base commit 7a1a98d.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 18, 2025

Package Line Rate Complexity Health
. 33% 0
content_resolver 0% 0
content_resolver.formats 6% 0
content_resolver.model 0% 0
external 39% 0
listenbrainz 46% 0
musicbrainz 72% 0
patches 27% 0
patches.lb_radio_classes 0% 0
tools 20% 0
. 33% 0
content_resolver 0% 0
content_resolver.formats 6% 0
content_resolver.model 0% 0
external 39% 0
listenbrainz 46% 0
musicbrainz 72% 0
patches 27% 0
patches.lb_radio_classes 0% 0
tools 20% 0
. 33% 0
content_resolver 0% 0
content_resolver.formats 6% 0
content_resolver.model 0% 0
external 39% 0
listenbrainz 46% 0
musicbrainz 72% 0
patches 27% 0
patches.lb_radio_classes 0% 0
tools 20% 0
. 33% 0
content_resolver 0% 0
content_resolver.formats 6% 0
content_resolver.model 0% 0
external 39% 0
listenbrainz 46% 0
musicbrainz 72% 0
patches 27% 0
patches.lb_radio_classes 0% 0
tools 20% 0
Summary 21% (4283 / 20130) 0

logging.addLevelName(APP_LOG_LEVEL_NUM, "NOTICE")

def applog(message, *args, **kwargs):
if logger.isEnabledFor(APP_LOG_LEVEL_NUM):
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you should need the manual isEnabledFor, the logger module will check it internally. Also for the next line, why not use log?

Copy link
Member Author

Choose a reason for hiding this comment

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

log throws argument conversion errors, so sticking with _log, which works.

@mayhem mayhem merged commit 0166131 into main Jun 18, 2025
6 checks passed
@mayhem mayhem deleted the add-logging-name branch June 18, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants