fix(fastify-core,mcp-server): add logLevel to ServiceAppOptions and wire config.LOG_LEVEL so log verbosity is actually honoured at runtime
This commit is contained in:
parent
44800ed36b
commit
00b0555c97
@ -26,9 +26,20 @@ import type { ServiceAppOptions, FastifyApp } from './types.js';
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export async function createServiceApp(options: ServiceAppOptions): Promise<FastifyApp> {
|
export async function createServiceApp(options: ServiceAppOptions): Promise<FastifyApp> {
|
||||||
const { name, version, description, corsOrigin, logger = true, swagger, metrics } = options;
|
const {
|
||||||
|
name,
|
||||||
|
version,
|
||||||
|
description,
|
||||||
|
corsOrigin,
|
||||||
|
logger = true,
|
||||||
|
logLevel,
|
||||||
|
swagger,
|
||||||
|
metrics,
|
||||||
|
} = options;
|
||||||
|
|
||||||
const app = Fastify({ logger });
|
const app = Fastify({
|
||||||
|
logger: logger ? (logLevel ? { level: logLevel } : true) : false,
|
||||||
|
});
|
||||||
|
|
||||||
// CORS — deny all origins when CORS_ORIGIN is not explicitly set
|
// CORS — deny all origins when CORS_ORIGIN is not explicitly set
|
||||||
const origin = corsOrigin ? corsOrigin.split(',').map(o => o.trim()) : false;
|
const origin = corsOrigin ? corsOrigin.split(',').map(o => o.trim()) : false;
|
||||||
|
|||||||
@ -12,6 +12,7 @@ export interface ServiceAppOptions {
|
|||||||
description?: string;
|
description?: string;
|
||||||
corsOrigin?: string;
|
corsOrigin?: string;
|
||||||
logger?: boolean;
|
logger?: boolean;
|
||||||
|
logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
||||||
swagger?: SwaggerOptions;
|
swagger?: SwaggerOptions;
|
||||||
metrics?: boolean;
|
metrics?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ const app = await createServiceApp({
|
|||||||
description:
|
description:
|
||||||
'ByteLyst MCP Server — platform.telemetry.*, platform.diagnostics.*, extraction.*, support.*',
|
'ByteLyst MCP Server — platform.telemetry.*, platform.diagnostics.*, extraction.*, support.*',
|
||||||
corsOrigin: config.CORS_ORIGIN,
|
corsOrigin: config.CORS_ORIGIN,
|
||||||
|
logLevel: config.LOG_LEVEL,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Parse JWT on every request (best-effort)
|
// Parse JWT on every request (best-effort)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user