Util to generate Logger with consistent naming schema #5574
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#5574
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type of feature request
Other
Description of the feature you're suggesting
After a slightly detailed discussion in #coding on the main server, it came to the conclusion that unified namespaces for loggers of 3rd party cogs would be cool. It was proposed that a function could be added to the utils folder that takes the cog name and the repo name as its arguments, with an optional sub_module argument and returns the
Loggerobject with a namespace as follows:red.RepoName.CogName[.SubModule].This new addition is useful in ways like having consistency in all logger names for all 3rd party cogs (that use this), core devs could force a certain namespace format, devs won't have to worry about their logs being silenced if they use the wrong namespace and this would strip the namespace to a specified char limit so that it doesn't look weird on consoles with extra large names.
Anything else?
This would also merely be an addition and would not change or break any existing functionality in red.
I would like other's opinions on this and would be happy to PR this addition if agreed to.
If this will be done you should take this opportunity to ensure a clean logger namespace.
something akin to the following:
To expand on
In addition to the code block above, due to to potential for having very large logger names (Audio cog for example), a character limiter should be added to
https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/logging.py#L189
This would ensure a consistent length of logger names printed on the console (while keeping the logger names in the logging file untouched)
if this is approved,
https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/docs/guide_cog_creators.rst#recommendations-for-cog-creators
should be updated to direct cog creators to use this util method to ensure consistency in the logging namespace
This would likely make more sense to go into https://github.com/Cog-Creators/Red-Common, at least the
get_loggersection - but the second part should still be done in Red as Red is the lib that controls the log formatting.Offene Diskussion bzw. Feature-Wunsch mit geringem Nutzen im Verhältnis zum Aufwand (oder Nischenfall), der seit Langem ohne Ergebnis offen ist. Ich schließe das Issue; bei konkretem Bedarf kann es gern wieder geöffnet werden.
Generated by Claude Code