-
Notifications
You must be signed in to change notification settings - Fork 0
2.3 Logging System
inactinique edited this page Feb 9, 2026
·
9 revisions
ClioDeck uses a centralized logging system that automatically filters logs based on environment (development vs production).
| Environment | console.log | console.info | console.warn | console.error |
|---|---|---|---|---|
| Development | Shown | Shown | Shown | Shown |
| Production | Filtered | Filtered | Shown | Shown |
In production, only console.warn and console.error are displayed to reduce console noise.
# macOS / Linux
CLIODESK_DEBUG=1 /path/to/ClioDeck.app/Contents/MacOS/ClioDeck
# Windows
set CLIODESK_DEBUG=1
"C:\Program Files\ClioDeck\ClioDeck.exe"# Available levels: debug, info, warn, error
CLIODESK_LOG_LEVEL=debug /path/to/ClioDeckDEBUG=1 /path/to/ClioDeckBy default, Electron DevTools are disabled in production.
To enable them, use the same environment variables:
# macOS / Linux
CLIODESK_DEBUG=1 /path/to/ClioDeck.app/Contents/MacOS/ClioDeck
# Windows
set CLIODESK_DEBUG=1
"C:\Program Files\ClioDeck\ClioDeck.exe"This enables both:
- Debug logs (
console.log,console.info) - Electron DevTools
For new development, use the centralized logger instead of console.log:
import { logger } from '@shared/logger';
// With explicit context
logger.debug('MyService', 'Debug message', { data });
logger.info('MyService', 'Important information');
logger.warn('MyService', 'Warning');
logger.error('MyService', 'Error', error);
// Or create a contextual logger
const log = logger.createContextLogger('MyService');
log.debug('Debug message');
log.info('Information');
log.warn('Warning');
log.error('Error', error);- Consistent format with emojis and context:
[MyService] Message - Automatic respect of configured log levels
- Typed methods for TypeScript
src/shared/
├── logger.ts # Centralized logger with levels
└── console-filter.ts # Automatic console.* filter in production
The console filter is automatically imported at application startup:
- Main process:
src/main/index.ts - Renderer process:
src/renderer/src/main.tsx
Environment is automatically detected via:
process.env.NODE_ENV === 'production'process.env.ELECTRON_IS_PACKAGED === 'true'
import { restoreConsole, rawConsole } from '@shared/console-filter';
// Restore all console.*
restoreConsole();
// Or use rawConsole to bypass filter
rawConsole.log('This message will always be displayed');import { getFilterStatus } from '@shared/console-filter';
const status = getFilterStatus();
console.log(status);
// { isProduction: true, isDebugEnabled: false, isFiltering: true }