Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP2universalStack: node
loggingapireadability
Log the actual endpoint instead of passing the caller's name just to log it
When logging an error from a shared request helper, log the endpoint/URL it called rather than threading a caller method name in as an argument.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | async function get(endpoint, callerName) { |
| 2 | const res = await fetch(endpoint); |
| 3 | if (!res.ok) logger.error(`${callerName} failed`); |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | async function get(endpoint) { |
| 2 | const res = await fetch(endpoint); |
| 3 | if (!res.ok) logger.error(`Request to ${endpoint} failed`); |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)