Skip to content

Commit

Permalink
Merge pull request #855 from gemini-testing/sp.fixLogger
Browse files Browse the repository at this point in the history
chore(deps): replace date-fns with strftime to reduce the size of dep…
  • Loading branch information
sipayRT authored Mar 7, 2024
2 parents 4647dff + bb14c9f commit 210c285
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
32 changes: 14 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"browserify": "13.3.0",
"chalk": "2.4.2",
"clear-require": "1.0.1",
"date-fns": "2.29.3",
"debug": "2.6.9",
"devtools": "8.21.0",
"expect-webdriverio": "3.5.3",
Expand All @@ -70,6 +69,7 @@
"png-validator": "1.1.0",
"sharp": "0.32.6",
"sizzle": "2.3.6",
"strftime": "0.10.2",
"strip-ansi": "6.0.1",
"temp": "0.8.3",
"uglifyify": "3.0.4",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/logger.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use strict";

const { format } = require("date-fns");
const format = require("strftime");

const withTimestampPrefix =
logFnName =>
(...args) => {
const timestamp = format(new Date(), "HH:mm:ss OO");
const timestamp = format("%H:%M:%S %z");
console[logFnName](`[${timestamp}]`, ...args);
};

Expand Down
2 changes: 1 addition & 1 deletion test/src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("utils/logger", () => {
it("should start with timestamp message", () => {
logger[logFnName]("message", "another message");

assert.calledOnceWith(console[logFnName], "[14:21:04 GMT+3]", "message", "another message");
assert.calledOnceWith(console[logFnName], "[14:21:04 +0300]", "message", "another message");
});
});
});
Expand Down

0 comments on commit 210c285

Please sign in to comment.