Skip to content

fix(type): replace hardcoded log method with generic ones from Logger.levels - #2636

Open
Rignchen wants to merge 4 commits into
winstonjs:masterfrom
Rignchen:bugfix/typescript-log-methods
Open

fix(type): replace hardcoded log method with generic ones from Logger.levels#2636
Rignchen wants to merge 4 commits into
winstonjs:masterfrom
Rignchen:bugfix/typescript-log-methods

Conversation

@Rignchen

Copy link
Copy Markdown

Replace the hardcoded LeveledLogMethod properties on Logger (error, warn, help, data, info, debug, prompt, http, verbose, input, silly, emerg, alert, crit, warning, notice) with a mapped type derived from the keys of the logger's levels object, mirroring what lib/winston/create-logger.js already does at runtime through (Object.keys(opts.levels).forEach(...))

I normally don't use AI, but since this wasn't hard, just time consuming I did ask claude AI, to make it, then just reviewed and corrected what it did, if you want me to I can re-do it by hand (it would most likely have some differences as claude said to have seen things in the documentation that I didn't see)

@Rignchen
Rignchen force-pushed the bugfix/typescript-log-methods branch 3 times, most recently from 82da695 to 5d6b1a3 Compare July 23, 2026 22:13
….levels

Replace the hardcoded LeveledLogMethod properties on Logger (error, warn,
help, data, info, debug, prompt, http, verbose, input, silly, emerg, alert,
crit, warning, notice) with a mapped type derived from the keys of the
logger's levels object, mirroring what lib/winston/create-logger.js already
does at runtime through (Object.keys(opts.levels).forEach(...)).
@Rignchen
Rignchen marked this pull request as draft July 23, 2026 22:31
@Rignchen

Copy link
Copy Markdown
Author

I'm separating what Claude did and what I did in different commits for more clarity (I'm not bringing the massive comments of nothing he added back though)

@Rignchen
Rignchen force-pushed the bugfix/typescript-log-methods branch from 5d6b1a3 to b4fae54 Compare July 23, 2026 22:36
@Rignchen
Rignchen marked this pull request as ready for review July 23, 2026 22:37
@Rignchen
Rignchen force-pushed the bugfix/typescript-log-methods branch 2 times, most recently from b7b5deb to a37b955 Compare July 25, 2026 23:56
@Rignchen
Rignchen force-pushed the bugfix/typescript-log-methods branch from a37b955 to 5f65b06 Compare July 26, 2026 00:33
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