Skip to content

Commit

Permalink
fix: log timestamps in ISO8601 for production
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk committed Mar 13, 2024
1 parent d1ddb4d commit 13adf1f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions packages/api/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { format, transports, Logform } from "winston";
export const getLogger = (environment: string, logLevel: string): LoggerService => {
let defaultLogLevel = "debug";
const loggerFormatters: Logform.Format[] = [
format.timestamp({
format: "DD/MM/YYYY HH:mm:ss.SSS",
}),
environment === "production"
? format.timestamp()
: format.timestamp({
format: "DD/MM/YYYY HH:mm:ss.SSS",
}),
format.ms(),
utilities.format.nestLike("API", {}),
];
Expand Down
8 changes: 5 additions & 3 deletions packages/data-fetcher/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ const { NODE_ENV, LOG_LEVEL } = process.env;

let defaultLogLevel = "debug";
const loggerFormatters: Logform.Format[] = [
format.timestamp({
format: "DD/MM/YYYY HH:mm:ss.SSS",
}),
NODE_ENV === "production"
? format.timestamp()
: format.timestamp({
format: "DD/MM/YYYY HH:mm:ss.SSS",
}),
format.ms(),
utilities.format.nestLike("DataFetcher", {}),
];
Expand Down
8 changes: 5 additions & 3 deletions packages/worker/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ const { NODE_ENV, LOG_LEVEL } = process.env;

let defaultLogLevel = "debug";
const loggerFormatters: Logform.Format[] = [
format.timestamp({
format: "DD/MM/YYYY HH:mm:ss.SSS",
}),
NODE_ENV === "production"
? format.timestamp()
: format.timestamp({
format: "DD/MM/YYYY HH:mm:ss.SSS",
}),
format.ms(),
utilities.format.nestLike("Worker", {}),
];
Expand Down

0 comments on commit 13adf1f

Please sign in to comment.