Compare commits

..

2 Commits

Author SHA1 Message Date
71343d6742 update packagelock
All checks were successful
Run unit tests / test (pull_request) Successful in 1m23s
Compile the repository / compile (pull_request) Successful in 59s
2023-11-18 16:42:40 +01:00
3f6e558d39 make logger silent during unit tests, add logging const for more concise requestId/guildid handling 2023-11-18 16:42:27 +01:00
2 changed files with 12120 additions and 12116 deletions

View File

@ -1,5 +1,8 @@
import { createLogger, format, transports } from "winston" import { createLogger, format, transports } from "winston"
import { config } from "./configuration" import { config } from "./configuration"
import { v4 } from "uuid"
export function newRequestId() { return v4() }
export const noGuildId = 'NoGuildId'
const printFn = format.printf(({ guildId, level, message, errorCode, requestId, timestamp: logTimestamp }: { [k: string]: string }) => { const printFn = format.printf(({ guildId, level, message, errorCode, requestId, timestamp: logTimestamp }: { [k: string]: string }) => {
@ -13,7 +16,8 @@ const logFormat = format.combine(
const consoleTransports = [ const consoleTransports = [
new transports.Console({ new transports.Console({
format: logFormat format: logFormat,
silent: process.env.NODE_ENV === 'testing'
}) })
] ]
export const logger = createLogger({ export const logger = createLogger({