@konplit-services/common 1.0.334 → 1.0.336

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,11 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.useMorgan = void 0;
7
+ const dayjs_1 = __importDefault(require("dayjs"));
8
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
9
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
7
10
  const morgan_1 = __importDefault(require("morgan"));
11
+ // Configure Day.js with plugins
12
+ dayjs_1.default.extend(utc_1.default);
13
+ dayjs_1.default.extend(timezone_1.default);
14
+ console.log("Current Time in UTC:", (0, dayjs_1.default)().utc().format()); // Debugging line
15
+ console.log("Current Time in Lagos:", (0, dayjs_1.default)().tz("Africa/Lagos").format()); // Debugging line
8
16
  // Create a custom Morgan logging function
9
17
  exports.useMorgan = (0, morgan_1.default)((tokens, req, res) => {
18
+ const timestamp = (0, dayjs_1.default)()
19
+ .tz("Africa/Lagos")
20
+ .format("YYYY-MM-DD HH:mm:ss.SSS");
10
21
  return [
11
- tokens.date(req, res, "clf"),
22
+ timestamp,
12
23
  tokens["remote-addr"](req, res),
13
24
  tokens.method(req, res),
14
25
  tokens.url(req, res),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.334",
3
+ "version": "1.0.336",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",