cal/packages/lib/logger.ts
Benny Joo 63416d4f33
chore: update `tslog` from 3.2.1 to 4.9.2 (#11717)
Co-authored-by: zomars <zomars@me.com>
2023-10-17 19:00:48 +00:00

20 lines
743 B
TypeScript

import { Logger } from "tslog";
import { IS_PRODUCTION } from "./constants";
const logger = new Logger({
minLevel: !!process.env.NEXT_PUBLIC_DEBUG ? 2 : 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;