Skip to content

Commit

Permalink
upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Nov 27, 2024
1 parent bff2840 commit ecf40ef
Show file tree
Hide file tree
Showing 4 changed files with 3,150 additions and 3,512 deletions.
2 changes: 1 addition & 1 deletion packages/db/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const takeFirstOrNull = <T extends any[]>(
return values[0]!;
};

export type Tx = typeof db;
export type Tx = Omit<typeof db, "$client">;

export const buildConflictUpdateColumns = <
T extends PgTable,
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dependencies": {
"@colors/colors": "^1.6.0",
"@opentelemetry/winston-transport": "^0.7.0",
"winston": "^3.14.2",
"winston": "^3.17.0",
"zod": "catalog:"
},
"devDependencies": {
Expand Down
21 changes: 14 additions & 7 deletions packages/logger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ function createLogger(level: string) {
winston.format.timestamp(),
winston.format.align(),
winston.format.printf((info) => {
const { timestamp, level, message, durationMs, ...other } = info;
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const { timestamp, level, message, durationMs, label, ...other } =
info as {
timestamp: string | undefined;
durationMs: number | undefined;
label: string | undefined;
level: string;
message: string;
};

const ts = timestamp?.slice(0, 19).replace("T", " ");
const duration = durationMs != null ? `(${durationMs}ms)` : "";
const hasLabel = info.label != null;
const appendLabel = info.label?.length < 5 ? " " : "";
const label = hasLabel ? `\t[${info.label}]${appendLabel} ` : "\t";
const hasLabel = label != null && label !== "";
const appendLabel = hasLabel && label.length < 5 ? " " : "";
const labelPrint = hasLabel ? `\t[${label}]${appendLabel} ` : "\t";

return NODE_ENV === "production"
? `${ts} [${level}]: ${label} ${message} ${duration} [${JSON.stringify(other)}]`
: `[${level}]: ${colors.gray(label)}${message} ${duration} [${JSON.stringify(other)}]`;
? `${ts} [${level}]: ${labelPrint} ${message} ${duration} [${JSON.stringify(other)}]`
: `[${level}]: ${colors.gray(labelPrint)}${message} ${duration} [${JSON.stringify(other)}]`;
}),
];

Expand Down
Loading

0 comments on commit ecf40ef

Please sign in to comment.