🧹 Pino transports API and capture console.log
All checks were successful
Deploy application / deploy (push) Successful in 26s
All checks were successful
Deploy application / deploy (push) Successful in 26s
This commit is contained in:
parent
71e70a2713
commit
efa9e785f2
@ -108,9 +108,7 @@ export class Sparebank1Impl implements Bank {
|
||||
const result = await Api.refreshToken(refreshToken)
|
||||
|
||||
if (result.status === "failure") {
|
||||
throw logger.error({
|
||||
err: new Error(`Failed to fetch refresh token: '${result.data}'`),
|
||||
})
|
||||
throw new Error(`Failed to fetch refresh token: '${result.data}'`)
|
||||
}
|
||||
const oAuthToken = result.data
|
||||
|
||||
|
@ -4,6 +4,14 @@ import { LOG_LEVEL } from "../config.ts"
|
||||
/**
|
||||
* / Returns a logging instance with the default log-level "info"
|
||||
*/
|
||||
export default pino({
|
||||
level: LOG_LEVEL,
|
||||
})
|
||||
const logger = pino(
|
||||
pino.destination({
|
||||
level: LOG_LEVEL,
|
||||
}),
|
||||
)
|
||||
|
||||
console.log = function (...args): void {
|
||||
logger.info(args, args?.[0])
|
||||
}
|
||||
|
||||
export default logger
|
||||
|
@ -16,8 +16,6 @@ import { CronJob } from "cron"
|
||||
import { createDirsIfMissing } from "@/fs.ts"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
// TODO Transports api for pino https://github.com/pinojs/pino/blob/HEAD/docs/transports.md
|
||||
// TODO if possible, capture other log messages and move them into pino
|
||||
// TODO move tsx to devDependency. Requires ts support for Node with support for @ alias
|
||||
// TODO verbatimSyntax in tsconfig, conflicts with jest
|
||||
// TODO multi module project. Main | DAL | Sparebank1 impl
|
||||
|
Loading…
x
Reference in New Issue
Block a user