borsa / nextjs-app /src /lib /logger.ts
veteroner's picture
feat: live position monitoring with charts + trading system production ready
656ac31
/**
* Lightweight logger that suppresses debug/warn/info in production.
* console.error always fires (important for monitoring).
*/
const isDev = process.env.NODE_ENV !== 'production'
export const logger = {
/** Always logs — use for genuine errors */
error: (...args: unknown[]) => console.error(...args),
/** Only logs in development or when LOG_REQUESTS=1 */
warn: (...args: unknown[]) => {
if (isDev) console.warn(...args)
},
/** Only logs in development */
info: (...args: unknown[]) => {
if (isDev) console.log(...args)
},
/** Only logs in development */
debug: (...args: unknown[]) => {
if (isDev) console.log(...args)
},
}