@factorypure/logger 1.0.2 → 1.0.4

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AsyncLocalStorage } from "async_hooks";
2
2
  import { CloudWatchLogs } from "../node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/CloudWatchLogs";
3
- import Notify from "../node_modules/fpnotifications-client/dist/index";
3
+ import Notify from "../node_modules/@factorypure/notify/dist/index";
4
4
  import { NextFunction, Request, Response } from "express";
5
5
  declare class LogStream {
6
6
  #private;
@@ -31,7 +31,10 @@ type LoggerOptions = {
31
31
  notifyClient?: Notify;
32
32
  fatalErrorSlackChannel: string;
33
33
  };
34
- export declare const attachRequestId: (asyncLocalStorage: AsyncLocalStorage<any>) => (req: Request, _res: Response, next: NextFunction) => void;
34
+ export declare const attachRequestId: (asyncLocalStorage: AsyncLocalStorage<any>, user: {
35
+ id: number;
36
+ email: string;
37
+ }) => (req: Request, _res: Response, next: NextFunction) => void;
35
38
  export declare const logCrashes: () => void;
36
39
  export declare const reportCrashes: (logger: LogStream) => void;
37
40
  export {};
package/dist/index.js CHANGED
@@ -142,11 +142,11 @@ export default class LoggerClient {
142
142
  }
143
143
  }
144
144
  }
145
- export const attachRequestId = (asyncLocalStorage) => {
145
+ export const attachRequestId = (asyncLocalStorage, user) => {
146
146
  return (req, _res, next) => {
147
147
  const availableCharacters = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0987654321";
148
- let id = "";
149
- while (id.length < 20) {
148
+ let id = `userId-${user.id}:userEmail-${user.email}:`;
149
+ while (id.length < 10) {
150
150
  id +=
151
151
  availableCharacters[Math.floor(Math.random() * availableCharacters.length)];
152
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorypure/logger",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,9 +18,9 @@
18
18
  "devDependencies": {
19
19
  "@aws-sdk/client-cloudwatch-logs": "^3.665.0",
20
20
  "@aws-sdk/types": "^3.664.0",
21
+ "@factorypure/notify": "^1.0.4",
21
22
  "@types/express": "^5.0.0",
22
23
  "@types/node": "^20.16.10",
23
- "@factorypure/notify": "^1.0.2",
24
24
  "typescript": "^5.6.2"
25
25
  }
26
26
  }