@@ -19,7 +19,7 @@ import {
1919 removeDaemonRegistryEntry ,
2020 cleanupWorkspaceDaemonFiles ,
2121} from './daemon/daemon-registry.ts' ;
22- import { log , setLogFile , setLogLevel , type LogLevel } from './utils/logger.ts' ;
22+ import { log , normalizeLogLevel , setLogFile , setLogLevel } from './utils/logger.ts' ;
2323import { version } from './version.ts' ;
2424import {
2525 DAEMON_IDLE_TIMEOUT_ENV_KEY ,
@@ -102,29 +102,12 @@ function ensureLogDir(logPath: string): void {
102102 }
103103}
104104
105- function resolveLogLevel ( ) : LogLevel | null {
106- const raw = process . env . XCODEBUILDMCP_DAEMON_LOG_LEVEL ?. trim ( ) . toLowerCase ( ) ;
105+ function resolveLogLevel ( ) : ReturnType < typeof normalizeLogLevel > {
106+ const raw = process . env . XCODEBUILDMCP_DAEMON_LOG_LEVEL ;
107107 if ( ! raw ) {
108108 return null ;
109109 }
110-
111- const knownLevels : LogLevel [ ] = [
112- 'none' ,
113- 'emergency' ,
114- 'alert' ,
115- 'critical' ,
116- 'error' ,
117- 'warning' ,
118- 'notice' ,
119- 'info' ,
120- 'debug' ,
121- ] ;
122-
123- if ( knownLevels . includes ( raw as LogLevel ) ) {
124- return raw as LogLevel ;
125- }
126-
127- return null ;
110+ return normalizeLogLevel ( raw ) ;
128111}
129112
130113async function main ( ) : Promise < void > {
@@ -315,7 +298,7 @@ async function main(): Promise<void> {
315298
316299 // Force exit if server doesn't close in time
317300 setTimeout ( ( ) => {
318- log ( 'warning ' , '[Daemon] Forced shutdown after timeout' ) ;
301+ log ( 'warn ' , '[Daemon] Forced shutdown after timeout' ) ;
319302 cleanupWorkspaceDaemonFiles ( workspaceKey ) ;
320303 void flushAndCloseSentry ( 1000 ) . finally ( ( ) => {
321304 process . exit ( 1 ) ;
@@ -408,7 +391,7 @@ async function main(): Promise<void> {
408391 setImmediate ( ( ) => {
409392 void enrichSentryMetadata ( ) . catch ( ( error ) => {
410393 const message = error instanceof Error ? error . message : String ( error ) ;
411- log ( 'warning ' , `[Daemon] Failed to enrich Sentry metadata: ${ message } ` ) ;
394+ log ( 'warn ' , `[Daemon] Failed to enrich Sentry metadata: ${ message } ` ) ;
412395 } ) ;
413396 } ) ;
414397 } ) ;
0 commit comments