11/**
2- * Simple logger for development mode
2+ * Simple logger for development mode and testing
33 * In production, errors are sent to Sentry instead
44 */
5-
6- const isDev = import . meta . env . DEV
5+ import { isDev , isTest } from '@lib/config'
6+ const shouldLog = isDev ( ) || isTest ( )
77
88export const logger = {
99 /**
@@ -12,7 +12,7 @@ export const logger = {
1212 * In production: Silent (errors go to Sentry via errorHandler)
1313 */
1414 error ( message : string , error ?: unknown ) : void {
15- if ( isDev ) {
15+ if ( shouldLog ) {
1616 console . error ( `❌ ${ message } ` , error || '' )
1717 }
1818 } ,
@@ -22,7 +22,7 @@ export const logger = {
2222 * Only outputs in development mode
2323 */
2424 warn ( message : string , data ?: unknown ) : void {
25- if ( isDev ) {
25+ if ( shouldLog ) {
2626 console . warn ( `⚠️ ${ message } ` , data || '' )
2727 }
2828 } ,
@@ -32,7 +32,7 @@ export const logger = {
3232 * Only outputs in development mode
3333 */
3434 info ( message : string , data ?: unknown ) : void {
35- if ( isDev ) {
35+ if ( shouldLog ) {
3636 console . info ( `ℹ️ ${ message } ` , data || '' )
3737 }
3838 } ,
@@ -42,7 +42,7 @@ export const logger = {
4242 * Only outputs in development mode
4343 */
4444 debug ( message : string , data ?: unknown ) : void {
45- if ( isDev ) {
45+ if ( shouldLog ) {
4646 console . debug ( `🐛 ${ message } ` , data || '' )
4747 }
4848 } ,
@@ -52,7 +52,7 @@ export const logger = {
5252 * Only outputs in development mode
5353 */
5454 success ( message : string , data ?: unknown ) : void {
55- if ( isDev ) {
55+ if ( shouldLog ) {
5656 console . log ( `✅ ${ message } ` , data || '' )
5757 }
5858 } ,
0 commit comments