@konplit-services/common 1.0.333 → 1.0.335
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,12 +4,17 @@ 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);
|
|
8
14
|
// Create a custom Morgan logging function
|
|
9
15
|
exports.useMorgan = (0, morgan_1.default)((tokens, req, res) => {
|
|
10
|
-
const clientIp = req.ip || req.socket.remoteAddress || "";
|
|
11
|
-
console.log("user ip log", clientIp);
|
|
12
16
|
return [
|
|
17
|
+
(0, dayjs_1.default)().tz("Africa/Lagos").format("YYYY-MM-DD HH:mm:ss.SSS"),
|
|
13
18
|
tokens["remote-addr"](req, res),
|
|
14
19
|
tokens.method(req, res),
|
|
15
20
|
tokens.url(req, res),
|