Files
calendar/packages/lib/logger.ts
T
Syed Ali ShahbazandGitHub c4a1382982 chore: add granular logging to the logger (#16734)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update turbo.json

* Update trpc-provider.tsx

* Update logger.ts

* update prisma index

* Update trpc.ts

* Update trpc-provider.tsx

* Update trpc.ts

* Update .env.example

* Update logger.ts
2024-09-20 09:06:37 +00:00

20 lines
757 B
TypeScript

import { Logger } from "tslog";
import { IS_PRODUCTION } from "./constants";
const logger = new Logger({
minLevel: parseInt(process.env.NEXT_PUBLIC_LOGGER_LEVEL ?? "4"),
maskValuesOfKeys: ["password", "passwordConfirmation", "credentials", "credential"],
prettyLogTimeZone: IS_PRODUCTION ? "UTC" : "local",
prettyErrorStackTemplate: " • {{fileName}}\t{{method}}\n\t{{filePathWithLine}}", // default
prettyErrorTemplate: "\n{{errorName}} {{errorMessage}}\nerror stack:\n{{errorStack}}", // default
prettyLogTemplate: "{{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}", // default with exclusion of `{{filePathWithLine}}`
stylePrettyLogs: true,
prettyLogStyles: {
name: "yellow",
dateIsoStr: "blue",
},
});
export default logger;