diff --git a/src/backend/Logger.ts b/src/backend/Logger.ts index 3cb26270..19a72cc5 100644 --- a/src/backend/Logger.ts +++ b/src/backend/Logger.ts @@ -1,7 +1,6 @@ import {Config} from '../common/config/private/Config'; import {LogLevel} from '../common/config/private/PrivateConfig'; -export type logFN = (...args: (string | number | (() => string))[]) => void; const forcedDebug = process.env['NODE_ENV'] === 'debug'; @@ -11,7 +10,8 @@ if (forcedDebug === true) { ); } -export type LoggerArgs = (string | number | (() => string)) +// Match `console.log` inputs +export type LoggerArgs = Parameters[0] export type LoggerFunction = (...args: LoggerArgs[]) => void; export interface ILogger { diff --git a/src/backend/routes/LoggerRouter.ts b/src/backend/routes/LoggerRouter.ts index 896d9422..e58a48c1 100644 --- a/src/backend/routes/LoggerRouter.ts +++ b/src/backend/routes/LoggerRouter.ts @@ -1,5 +1,5 @@ import {Express, NextFunction, Request, Response} from 'express'; -import {logFN, Logger} from '../Logger'; +import {LoggerFunction, Logger} from '../Logger'; import {Config} from '../../common/config/private/Config'; declare global { @@ -16,7 +16,7 @@ declare global { * Adds logging to express */ export class LoggerRouter { - public static log(loggerFn: logFN, req: Request, res: Response): void { + public static log(loggerFn: LoggerFunction, req: Request, res: Response): void { if (req.logged === true) { return; }