27 lines
709 B
TypeScript
27 lines
709 B
TypeScript
|
|
/**
|
||
|
|
* Server-side logger. In development, delegates to console. In production,
|
||
|
|
* silences debug noise but keeps warnings and errors visible in server
|
||
|
|
* stdout/stderr. Sentry is not initialized in this process — if you need
|
||
|
|
* server-side Sentry coverage, initialize @sentry/node in server.ts.
|
||
|
|
*/
|
||
|
|
|
||
|
|
const isDev = process.env.NODE_ENV !== "production";
|
||
|
|
|
||
|
|
function log(...args: unknown[]): void {
|
||
|
|
if (isDev) console.log(...args);
|
||
|
|
}
|
||
|
|
|
||
|
|
function info(...args: unknown[]): void {
|
||
|
|
if (isDev) console.info(...args);
|
||
|
|
}
|
||
|
|
|
||
|
|
function warn(...args: unknown[]): void {
|
||
|
|
console.warn(...args);
|
||
|
|
}
|
||
|
|
|
||
|
|
function error(...args: unknown[]): void {
|
||
|
|
console.error(...args);
|
||
|
|
}
|
||
|
|
|
||
|
|
export const logger = { log, info, warn, error };
|