mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-21 16:01:35 +08:00
refactor(Logger): enhance logging with environment variable support - Updated LoggerService to utilize environment variables for filtering logs by level and module in development mode. - Modified the logging level handling to use constants from the logger configuration. - Enhanced documentation to include details on using environment variables for log filtering in both English and Chinese documentation files. - Cleaned up unused type definitions related to logging.
29 lines
582 B
TypeScript
29 lines
582 B
TypeScript
export type LogSourceWithContext = {
|
|
process: 'main' | 'renderer'
|
|
window?: string // only for renderer process
|
|
module?: string
|
|
context?: Record<string, any>
|
|
}
|
|
|
|
export type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'verbose' | 'silly' | 'none'
|
|
|
|
export const LEVEL = {
|
|
ERROR: 'error',
|
|
WARN: 'warn',
|
|
INFO: 'info',
|
|
DEBUG: 'debug',
|
|
VERBOSE: 'verbose',
|
|
SILLY: 'silly',
|
|
NONE: 'none'
|
|
} satisfies Record<string, LogLevel>
|
|
|
|
export const LEVEL_MAP: Record<LogLevel, number> = {
|
|
error: 10,
|
|
warn: 8,
|
|
info: 6,
|
|
debug: 4,
|
|
verbose: 2,
|
|
silly: 0,
|
|
none: -1
|
|
}
|