Merged in feature/warmup (pull request #1887)
* unified warmup function Approved-by: Linus Flood
This commit is contained in:
16
apps/scandic-web/utils/logger/index.ts
Normal file
16
apps/scandic-web/utils/logger/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export function createLogger(loggerPrefix: string | (() => Promise<string>)) {
|
||||
const getLoggerPrefix: () => Promise<string> =
|
||||
typeof loggerPrefix === "string" ? async () => loggerPrefix : loggerPrefix
|
||||
|
||||
return {
|
||||
async debug(message: string, ...args: unknown[]): Promise<void> {
|
||||
console.debug(`[${await getLoggerPrefix()}] ${message}`, ...args)
|
||||
},
|
||||
async warn(message: string, ...args: unknown[]): Promise<void> {
|
||||
console.warn(`[${await getLoggerPrefix()}] Warning - ${message}`, ...args)
|
||||
},
|
||||
async error(message: string, ...args: unknown[]): Promise<void> {
|
||||
console.error(`[${await getLoggerPrefix()}] Error - ${message}`, ...args)
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user