namirasoft-log 1.4.26 → 1.4.27

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.
@@ -3,6 +3,7 @@ import { Log } from "./Log";
3
3
  import { NamirasoftLogServer } from "./NamirasoftLogServer";
4
4
  export declare class StreamNamirasoftLog implements IStream {
5
5
  server: NamirasoftLogServer;
6
+ user_id?: string;
6
7
  log_group_id: string;
7
8
  getProductID: () => (string | null);
8
9
  getWorkspaceID: () => (string | null);
@@ -12,13 +12,17 @@ class StreamNamirasoftLog {
12
12
  if (process.env.NAMIRASOFT_STANDALNOE)
13
13
  return;
14
14
  let message = [...formated.pre, ...formated.messages, ...formated.post].join("\n");
15
- this.server.log.Create({
15
+ let body = {
16
16
  level: log.level.toString(),
17
17
  log_group_id: this.log_group_id,
18
18
  product_id: this.getProductID(),
19
19
  workspace_id: this.getWorkspaceID(),
20
20
  message
21
- });
21
+ };
22
+ if (this.user_id)
23
+ this.server.log._CreateFor(this.user_id, body);
24
+ else
25
+ this.server.log.Create(body);
22
26
  }
23
27
  }
24
28
  exports.StreamNamirasoftLog = StreamNamirasoftLog;
@@ -1 +1 @@
1
- {"version":3,"file":"StreamNamirasoftLog.js","sourceRoot":"","sources":["../src/StreamNamirasoftLog.ts"],"names":[],"mappings":";;;AAIA,MAAa,mBAAmB;IAM5B,YAAY,MAA2B,EAAE,YAAoB,EAAE,YAAmC,EAAE,cAAqC;QAErI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IACD,KAAK,CAAC,GAAQ,EAAE,QAA+D;QAE3E,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB;YACjC,OAAO;QACX,IAAI,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,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AAI,IAAI,CAAC,OAAO;YACZ,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;;YAE/C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACJ;AA/BD,kDA+BC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.26",
11
+ "version": "1.4.27",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -17,10 +17,10 @@
17
17
  "build": ""
18
18
  },
19
19
  "dependencies": {
20
- "namirasoft-core": "^1.4.70",
21
- "namirasoft-site": "^1.4.36",
20
+ "namirasoft-core": "^1.4.71",
21
+ "namirasoft-site": "^1.4.37",
22
22
  "namirasoft-node-cli": "^1.4.7",
23
- "namirasoft-account": "^1.4.71"
23
+ "namirasoft-account": "^1.4.72"
24
24
  },
25
25
  "bin": {
26
26
  "ns-log": "./dist/command/cli.js"
@@ -5,6 +5,7 @@ import { NamirasoftLogServer } from "./NamirasoftLogServer";
5
5
  export class StreamNamirasoftLog implements IStream
6
6
  {
7
7
  server: NamirasoftLogServer;
8
+ user_id?: string;
8
9
  log_group_id: string;
9
10
  getProductID: () => (string | null);
10
11
  getWorkspaceID: () => (string | null);
@@ -20,12 +21,16 @@ export class StreamNamirasoftLog implements IStream
20
21
  if (process.env.NAMIRASOFT_STANDALNOE)
21
22
  return;
22
23
  let message = [...formated.pre, ...formated.messages, ...formated.post].join("\n");
23
- this.server.log.Create({
24
+ let body = {
24
25
  level: log.level.toString(),
25
26
  log_group_id: this.log_group_id,
26
27
  product_id: this.getProductID(),
27
28
  workspace_id: this.getWorkspaceID(),
28
29
  message
29
- });
30
+ };
31
+ if (this.user_id)
32
+ this.server.log._CreateFor(this.user_id, body);
33
+ else
34
+ this.server.log.Create(body);
30
35
  }
31
36
  }