From 7cf7febc5c91046a9e634bfc9bcd549ee564b4d1 Mon Sep 17 00:00:00 2001 From: sarayourfriend Date: Fri, 29 Mar 2024 17:28:57 +1100 Subject: [PATCH] Remove duplicative logFN type --- src/backend/Logger.ts | 4 ++-- src/backend/routes/LoggerRouter.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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; }