1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Remove duplicative logFN type

This commit is contained in:
sarayourfriend 2024-03-29 17:28:57 +11:00
parent 086bc47a01
commit 7cf7febc5c
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,6 @@
import {Config} from '../common/config/private/Config'; import {Config} from '../common/config/private/Config';
import {LogLevel} from '../common/config/private/PrivateConfig'; import {LogLevel} from '../common/config/private/PrivateConfig';
export type logFN = (...args: (string | number | (() => string))[]) => void;
const forcedDebug = process.env['NODE_ENV'] === 'debug'; 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<Console["log"]>[0]
export type LoggerFunction = (...args: LoggerArgs[]) => void; export type LoggerFunction = (...args: LoggerArgs[]) => void;
export interface ILogger { export interface ILogger {

View File

@ -1,5 +1,5 @@
import {Express, NextFunction, Request, Response} from 'express'; import {Express, NextFunction, Request, Response} from 'express';
import {logFN, Logger} from '../Logger'; import {LoggerFunction, Logger} from '../Logger';
import {Config} from '../../common/config/private/Config'; import {Config} from '../../common/config/private/Config';
declare global { declare global {
@ -16,7 +16,7 @@ declare global {
* Adds logging to express * Adds logging to express
*/ */
export class LoggerRouter { 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) { if (req.logged === true) {
return; return;
} }