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).
frontend ruleP2project specificStack: react
loggingclient-serverreact
Use browser logging in client components, not the server logger
In code that runs in the browser, log via console rather than a server-side logger utility that may not behave correctly client-side.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetsx
| 1 | 'use client'; |
| 2 | // Logger is intended for server-side logging |
| 3 | Logger.error('Cannot play: earning call is null'); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | 'use client'; |
| 2 | console.error('Cannot play: earning call is null'); |
Explanation (EN)
Objašnjenje (HR)