namirasoft-log 1.3.8 → 1.3.10

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.
@@ -1,9 +1,13 @@
1
1
  import { IStream } from "./IStream";
2
2
  import { Log } from "./Log";
3
+ import { NamirasoftLogServer } from "./NamirasoftLogServer";
3
4
  export declare class StreamNamirasoftLog implements IStream {
4
- token: string;
5
- constructor(token: string);
6
- write(_: Log, __: {
5
+ server: NamirasoftLogServer;
6
+ log_group_id: string;
7
+ product_id: (string | null);
8
+ project_id: (string | null);
9
+ constructor(server: NamirasoftLogServer, log_group_id: string, product_id: (string | null), project_id: (string | null));
10
+ write(log: Log, formated: {
7
11
  pre: string[];
8
12
  messages: string[];
9
13
  post: string[];
@@ -2,10 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StreamNamirasoftLog = void 0;
4
4
  class StreamNamirasoftLog {
5
- constructor(token) {
6
- this.token = token;
5
+ constructor(server, log_group_id, product_id, project_id) {
6
+ this.server = server;
7
+ this.log_group_id = log_group_id;
8
+ this.product_id = product_id;
9
+ this.project_id = project_id;
7
10
  }
8
- write(_, __) {
11
+ write(log, formated) {
12
+ let message = [...formated.pre, ...formated.messages, ...formated.post].join("\n");
13
+ this.server.log.Create({
14
+ level: log.level.toString(),
15
+ log_group_id: this.log_group_id,
16
+ product_id: this.product_id,
17
+ project_id: this.project_id,
18
+ message,
19
+ stack: ""
20
+ });
9
21
  }
10
22
  }
11
23
  exports.StreamNamirasoftLog = StreamNamirasoftLog;
@@ -1 +1 @@
1
- {"version":3,"file":"StreamNamirasoftLog.js","sourceRoot":"","sources":["../src/StreamNamirasoftLog.ts"],"names":[],"mappings":";;;AAGA,MAAa,mBAAmB;IAG5B,YAAY,KAAa;QAErB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,CAAM,EAAE,EAAyD;IAEvE,CAAC;CACJ;AAVD,kDAUC"}
1
+ {"version":3,"file":"StreamNamirasoftLog.js","sourceRoot":"","sources":["../src/StreamNamirasoftLog.ts"],"names":[],"mappings":";;;AAIA,MAAa,mBAAmB;IAM5B,YAAY,MAA2B,EAAE,YAAoB,EAAE,UAA2B,EAAE,UAA2B;QAEnH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,GAAQ,EAAE,QAA+D;QAE3E,IAAI,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;YACnB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO;YACP,KAAK,EAAE,EAAE;SACZ,CAAC,CAAC;IACP,CAAC;CACJ;AAzBD,kDAyBC"}
@@ -17,6 +17,14 @@ const namirasoft_account_1 = require("namirasoft-account");
17
17
  class LogCreateCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
18
  constructor(argv) {
19
19
  super(argv, [], [
20
+ {
21
+ name: "log_group_id",
22
+ short: "",
23
+ description: "Provides the value of 'log_group_id' in body",
24
+ optional: true,
25
+ args: ["log_group_id"],
26
+ defaults: [""]
27
+ },
20
28
  {
21
29
  name: "product_id",
22
30
  short: "",
@@ -33,14 +41,6 @@ class LogCreateCommand extends namirasoft_node_cli_1.BaseFinalCommand {
33
41
  args: ["project_id"],
34
42
  defaults: [""]
35
43
  },
36
- {
37
- name: "log_group_id",
38
- short: "",
39
- description: "Provides the value of 'log_group_id' in body",
40
- optional: true,
41
- args: ["log_group_id"],
42
- defaults: [""]
43
- },
44
44
  {
45
45
  name: "level",
46
46
  short: "",
@@ -77,9 +77,9 @@ class LogCreateCommand extends namirasoft_node_cli_1.BaseFinalCommand {
77
77
  manager.setValue(token, false);
78
78
  let server = new NamirasoftLogServer_1.NamirasoftLogServer(manager, e => this.app.logger.error(e.message));
79
79
  let ans = yield server.log.Create({
80
+ log_group_id: this.option_values.log_group_id,
80
81
  product_id: this.option_values.product_id,
81
82
  project_id: this.option_values.project_id,
82
- log_group_id: this.option_values.log_group_id,
83
83
  level: this.option_values.level,
84
84
  message: this.option_values.message,
85
85
  stack: this.option_values.stack
@@ -1 +1 @@
1
- {"version":3,"file":"LogCreateCommand.js","sourceRoot":"","sources":["../../src/command/LogCreateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAqBA,6DAAuD;AACvD,qDAAiD;AACjD,gEAA6D;AAC7D,2DAAkD;AAElD,MAAa,gBAAiB,SAAQ,sCAAgB;IAElD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;YACZ;gBACI,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,4CAA4C;gBACzD,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,CAAC,YAAY,CAAC;gBACpB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,4CAA4C;gBACzD,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,CAAC,YAAY,CAAC;gBACpB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,8CAA8C;gBAC3D,QAAQ,EAAE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ACrF,IAAI,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;gBAC9B,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY;gBAC7C,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU;gBACzC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU;gBACzC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;gBAC/B,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;gBACnC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;aAClC,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AA1ED,4CA0EC;AAAA,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export type LogRowInput = {
2
+ log_group_id: (string | null);
2
3
  product_id: (string | null);
3
4
  project_id: (string | null);
4
- log_group_id: (string | null);
5
5
  level: (string | null);
6
6
  message: (string | null);
7
7
  stack: (string | null);
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.3.8",
11
+ "version": "1.3.10",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -1,14 +1,30 @@
1
1
  import { IStream } from "./IStream";
2
2
  import { Log } from "./Log";
3
+ import { NamirasoftLogServer } from "./NamirasoftLogServer";
3
4
 
4
5
  export class StreamNamirasoftLog implements IStream
5
6
  {
6
- token: string;
7
- constructor(token: string)
7
+ server: NamirasoftLogServer;
8
+ log_group_id: string;
9
+ product_id: (string | null);
10
+ project_id: (string | null);
11
+ constructor(server: NamirasoftLogServer, log_group_id: string, product_id: (string | null), project_id: (string | null))
8
12
  {
9
- this.token = token;
13
+ this.server = server;
14
+ this.log_group_id = log_group_id;
15
+ this.product_id = product_id;
16
+ this.project_id = project_id;
10
17
  }
11
- write(_: Log, __: { pre: string[], messages: string[], post: string[] }): void
18
+ write(log: Log, formated: { pre: string[], messages: string[], post: string[] }): void
12
19
  {
20
+ let message = [...formated.pre, ...formated.messages, ...formated.post].join("\n");
21
+ this.server.log.Create({
22
+ level: log.level.toString(),
23
+ log_group_id: this.log_group_id,
24
+ product_id: this.product_id,
25
+ project_id: this.project_id,
26
+ message,
27
+ stack: ""
28
+ });
13
29
  }
14
30
  }
@@ -29,6 +29,14 @@ export class LogCreateCommand extends BaseFinalCommand
29
29
  constructor(argv: string[])
30
30
  {
31
31
  super(argv, [], [
32
+ {
33
+ name: "log_group_id",
34
+ short: "",
35
+ description: "Provides the value of 'log_group_id' in body",
36
+ optional: true,
37
+ args: ["log_group_id"],
38
+ defaults: [""]
39
+ },
32
40
  {
33
41
  name: "product_id",
34
42
  short: "",
@@ -45,14 +53,6 @@ export class LogCreateCommand extends BaseFinalCommand
45
53
  args: ["project_id"],
46
54
  defaults: [""]
47
55
  },
48
- {
49
- name: "log_group_id",
50
- short: "",
51
- description: "Provides the value of 'log_group_id' in body",
52
- optional: true,
53
- args: ["log_group_id"],
54
- defaults: [""]
55
- },
56
56
  {
57
57
  name: "level",
58
58
  short: "",
@@ -89,9 +89,9 @@ export class LogCreateCommand extends BaseFinalCommand
89
89
  manager.setValue(token, false);
90
90
  let server = new NamirasoftLogServer(manager, e => this.app.logger.error(e.message));
91
91
  let ans = await server.log.Create({
92
+ log_group_id: this.option_values.log_group_id,
92
93
  product_id: this.option_values.product_id,
93
94
  project_id: this.option_values.project_id,
94
- log_group_id: this.option_values.log_group_id,
95
95
  level: this.option_values.level,
96
96
  message: this.option_values.message,
97
97
  stack: this.option_values.stack
@@ -21,9 +21,9 @@
21
21
 
22
22
  export type LogRowInput =
23
23
  {
24
+ log_group_id: (string | null);
24
25
  product_id: (string | null);
25
26
  project_id: (string | null);
26
- log_group_id: (string | null);
27
27
  level: (string | null);
28
28
  message: (string | null);
29
29
  stack: (string | null);