@@ -118,7 +118,7 @@ export class PluginManager {
118118 this . logger ?. debug ( `Trying to import as module: ${ pluginPath } ` ) ;
119119 pluginPackage = await import ( pluginPath ) ;
120120 } catch ( err ) {
121- this . logger ?. debug ( `Module import failed, trying require: ${ pluginPath } ` , err ) ;
121+ this . logger ?. debug ( { error : err } , `Module import failed, trying require: ${ pluginPath } ` ) ;
122122 // Using dynamic import with a constructed path to avoid require()
123123 // This is a workaround for the ESLint rule @typescript -eslint/no-require-imports
124124 pluginPackage = await import ( `${ pluginPath } ` ) ;
@@ -153,7 +153,7 @@ export class PluginManager {
153153 if ( error instanceof PluginDuplicateError ) {
154154 throw error ;
155155 }
156- this . logger ?. error ( `Error loading plugin from ${ pluginPath } :` , error ) ;
156+ this . logger ?. error ( { error } , `Error loading plugin from ${ pluginPath } :` ) ;
157157 throw new PluginLoadError ( path . basename ( pluginPath ) , error ) ;
158158 }
159159 }
@@ -210,7 +210,7 @@ export class PluginManager {
210210 this . logger ?. debug ( `Found main file: ${ mainPath } ` ) ;
211211 await this . loadPlugin ( mainPath ) ;
212212 } catch ( accessErr ) {
213- this . logger ?. debug ( `Main file not found: ${ mainPath } , error:` , accessErr ) ;
213+ this . logger ?. debug ( { error : accessErr } , `Main file not found: ${ mainPath } , error:` ) ;
214214
215215 // If preferred file not found, try alternative
216216 const altExtension = pluginExtension === 'ts' ? 'js' : 'ts' ;
@@ -236,7 +236,7 @@ export class PluginManager {
236236 await this . loadPlugin ( pluginPath ) ;
237237 }
238238 } catch ( error ) {
239- this . logger ?. error ( `Error discovering plugins at ${ pluginPath } :` , error ) ;
239+ this . logger ?. error ( { error } , `Error discovering plugins at ${ pluginPath } :` ) ;
240240 }
241241 }
242242
@@ -331,7 +331,7 @@ export class PluginManager {
331331 this . logger ?. warn ( `Global setting group ID '${ group . id } ' already exists (Existing Name: "${ existingGroup . name } "). Plugin's attempt to define a group with this ID (Plugin's proposed Name: "${ group . name } ") will use the existing group. Plugin-specific metadata for this group ID (name, description, icon, sort_order) is ignored.` ) ;
332332 }
333333 } catch ( error ) {
334- this . logger ?. error ( `Error processing plugin-defined group '${ group . id } ' (Plugin's proposed Name: "${ group . name } "):` , error ) ;
334+ this . logger ?. error ( { error } , `Error processing plugin-defined group '${ group . id } ' (Plugin's proposed Name: "${ group . name } "):` ) ;
335335 }
336336 }
337337
@@ -342,7 +342,7 @@ export class PluginManager {
342342 const coreSettings = await GlobalSettingsService . getAll ( ) ;
343343 coreSettings . forEach ( cs => initializedKeys . add ( cs . key ) ) ;
344344 } catch ( error ) {
345- this . logger ?. error ( 'Failed to get all core settings for precedence check:' , error ) ;
345+ this . logger ?. error ( { error } , 'Failed to get all core settings for precedence check:' ) ;
346346 // If this fails, we might risk overwriting, but proceed with caution.
347347 }
348348
@@ -362,7 +362,7 @@ export class PluginManager {
362362 initializedKeys . add ( definition . key ) ; // Add to set after successful initialization
363363 this . logger ?. info ( `Initialized global setting '${ definition . key } ' from plugin '${ pluginId } '.` ) ;
364364 } catch ( error ) {
365- this . logger ?. error ( `Failed to initialize global setting '${ definition . key } ' from plugin '${ pluginId } ':` , error ) ;
365+ this . logger ?. error ( { error } , `Failed to initialize global setting '${ definition . key } ' from plugin '${ pluginId } ':` ) ;
366366 }
367367 }
368368 this . logger ?. info ( 'Plugin global settings initialization complete.' ) ;
@@ -402,7 +402,7 @@ export class PluginManager {
402402 } catch ( error ) {
403403 // Log individual plugin initialization errors but continue with others.
404404 const typedError = error as Error ;
405- this . logger ?. error ( `Failed to initialize plugin ${ plugin . meta . id } : ${ typedError . message } ` , typedError . stack ) ;
405+ this . logger ?. error ( { error : typedError , stack : typedError . stack } , `Failed to initialize plugin ${ plugin . meta . id } : ${ typedError . message } ` ) ;
406406 // Optionally, re-throw: throw new PluginInitializeError(plugin.meta.id, error);
407407 }
408408 }
@@ -440,7 +440,7 @@ export class PluginManager {
440440 }
441441 } catch ( error ) {
442442 const typedError = error as Error ;
443- this . logger ?. error ( `Failed to re-initialize plugin ${ plugin . meta . id } : ${ typedError . message } ` , typedError . stack ) ;
443+ this . logger ?. error ( { error : typedError , stack : typedError . stack } , `Failed to re-initialize plugin ${ plugin . meta . id } : ${ typedError . message } ` ) ;
444444 // Continue with other plugins even if one fails
445445 }
446446 }
@@ -459,7 +459,7 @@ export class PluginManager {
459459 const pluginLogger = this . logger ?. child ( { pluginId : plugin . meta . id } ) || this . app ! . log . child ( { pluginId : plugin . meta . id } ) ;
460460 await plugin . shutdown ( pluginLogger ) ;
461461 } catch ( error ) {
462- this . logger ?. error ( `Error shutting down plugin ${ plugin . meta . id } :` , error ) ;
462+ this . logger ?. error ( { error } , `Error shutting down plugin ${ plugin . meta . id } :` ) ;
463463 }
464464 }
465465 }
0 commit comments