@@ -4,7 +4,7 @@ import type {
44  FastifyListenOptions , 
55  FastifyServerOptions , 
66  FastifyInstance , 
7- }  from  'fastify' 
7+ }  from  'fastify/fastify ' 
88
99import  {  coerceRootPath  }  from  '@redwoodjs/fastify-web/dist/helpers' 
1010
@@ -89,7 +89,6 @@ export function resolveOptions(
8989    fastifyServerOptions : options . fastifyServerOptions  ??  { 
9090      requestTimeout :
9191        DEFAULT_CREATE_SERVER_OPTIONS . fastifyServerOptions . requestTimeout , 
92-       logger : options . logger  ??  DEFAULT_CREATE_SERVER_OPTIONS . logger , 
9392      bodyLimit : DEFAULT_CREATE_SERVER_OPTIONS . fastifyServerOptions . bodyLimit , 
9493    } , 
9594    configureApiServer :
@@ -102,7 +101,20 @@ export function resolveOptions(
102101  // Merge fastifyServerOptions. 
103102  resolvedOptions . fastifyServerOptions . requestTimeout  ??= 
104103    DEFAULT_CREATE_SERVER_OPTIONS . fastifyServerOptions . requestTimeout 
105-   resolvedOptions . fastifyServerOptions . logger  =  options . logger 
104+ 
105+   // Fastify v5: Custom logger instances use 'loggerInstance', config uses 'logger' 
106+   const  isCustomLoggerInstance  = 
107+     options . logger  && 
108+     typeof  options . logger  ===  'object'  && 
109+     'info'  in  options . logger 
110+ 
111+   if  ( isCustomLoggerInstance )  { 
112+     ; ( resolvedOptions . fastifyServerOptions  as  any ) . loggerInstance  = 
113+       options . logger 
114+   }  else  { 
115+     resolvedOptions . fastifyServerOptions . logger  = 
116+       options . logger  ??  DEFAULT_CREATE_SERVER_OPTIONS . logger 
117+   } 
106118
107119  if  ( options . parseArgs )  { 
108120    const  {  values }  =  parseArgs ( { 
0 commit comments