namirasoft-log 1.3.9 → 1.3.11

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,11 +1,11 @@
1
1
  export declare enum LogLevel {
2
- "Trace" = 0,
3
- "Verbose" = 1,
4
- "Debug" = 2,
5
- "Info" = 3,
6
- "Success" = 4,
7
- "Warning" = 5,
8
- "Error" = 6,
9
- "Critical" = 7,
10
- "Fatal" = 8
2
+ Trace = "Trace",
3
+ Verbose = "Verbose",
4
+ Debug = "Debug",
5
+ Info = "Info",
6
+ Success = "Success",
7
+ Warning = "Warning",
8
+ Error = "Error",
9
+ Critical = "Critical",
10
+ Fatal = "Fatal"
11
11
  }
package/dist/LogLevel.js CHANGED
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogLevel = void 0;
4
4
  var LogLevel;
5
5
  (function (LogLevel) {
6
- LogLevel[LogLevel["Trace"] = 0] = "Trace";
7
- LogLevel[LogLevel["Verbose"] = 1] = "Verbose";
8
- LogLevel[LogLevel["Debug"] = 2] = "Debug";
9
- LogLevel[LogLevel["Info"] = 3] = "Info";
10
- LogLevel[LogLevel["Success"] = 4] = "Success";
11
- LogLevel[LogLevel["Warning"] = 5] = "Warning";
12
- LogLevel[LogLevel["Error"] = 6] = "Error";
13
- LogLevel[LogLevel["Critical"] = 7] = "Critical";
14
- LogLevel[LogLevel["Fatal"] = 8] = "Fatal";
6
+ LogLevel["Trace"] = "Trace";
7
+ LogLevel["Verbose"] = "Verbose";
8
+ LogLevel["Debug"] = "Debug";
9
+ LogLevel["Info"] = "Info";
10
+ LogLevel["Success"] = "Success";
11
+ LogLevel["Warning"] = "Warning";
12
+ LogLevel["Error"] = "Error";
13
+ LogLevel["Critical"] = "Critical";
14
+ LogLevel["Fatal"] = "Fatal";
15
15
  })(LogLevel || (exports.LogLevel = LogLevel = {}));
16
16
  //# sourceMappingURL=LogLevel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogLevel.js","sourceRoot":"","sources":["../src/LogLevel.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAWX;AAXD,WAAY,QAAQ;IAEhB,yCAAO,CAAA;IACP,6CAAS,CAAA;IACT,yCAAO,CAAA;IACP,uCAAM,CAAA;IACN,6CAAS,CAAA;IACT,6CAAS,CAAA;IACT,yCAAO,CAAA;IACP,+CAAU,CAAA;IACV,yCAAO,CAAA;AACX,CAAC,EAXW,QAAQ,wBAAR,QAAQ,QAWnB"}
1
+ {"version":3,"file":"LogLevel.js","sourceRoot":"","sources":["../src/LogLevel.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAWX;AAXD,WAAY,QAAQ;IAEhB,2BAAe,CAAA;IACf,+BAAmB,CAAA;IACnB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,2BAAe,CAAA;IACf,iCAAqB,CAAA;IACrB,2BAAe,CAAA;AACnB,CAAC,EAXW,QAAQ,wBAAR,QAAQ,QAWnB"}
@@ -5,31 +5,29 @@ const namirasoft_core_1 = require("namirasoft-core");
5
5
  const LogLevel_1 = require("./LogLevel");
6
6
  class StreamConsole {
7
7
  write(log, formated) {
8
- let writter = (data) => {
8
+ let getFormatted = (data) => {
9
9
  if (log.level == LogLevel_1.LogLevel.Trace)
10
- namirasoft_core_1.ConsoleOperation.trace(data);
11
- else if (log.level == LogLevel_1.LogLevel.Verbose)
12
- namirasoft_core_1.ConsoleOperation.log(data);
13
- else if (log.level == LogLevel_1.LogLevel.Debug)
14
- namirasoft_core_1.ConsoleOperation.debug(data);
15
- else if (log.level == LogLevel_1.LogLevel.Info)
16
- namirasoft_core_1.ConsoleOperation.info(data);
17
- else if (log.level == LogLevel_1.LogLevel.Success)
18
- namirasoft_core_1.ConsoleOperation.success(data);
19
- else if (log.level == LogLevel_1.LogLevel.Warning)
20
- namirasoft_core_1.ConsoleOperation.warning(data);
21
- else if (log.level == LogLevel_1.LogLevel.Error)
22
- namirasoft_core_1.ConsoleOperation.error(data);
23
- else if (log.level == LogLevel_1.LogLevel.Critical)
24
- namirasoft_core_1.ConsoleOperation.error(data);
25
- else if (log.level == LogLevel_1.LogLevel.Fatal)
26
- namirasoft_core_1.ConsoleOperation.error(data);
27
- else
28
- namirasoft_core_1.ConsoleOperation.log(data);
10
+ return namirasoft_core_1.ConsoleOperation.trace(data);
11
+ if (log.level == LogLevel_1.LogLevel.Verbose)
12
+ return namirasoft_core_1.ConsoleOperation.log(data);
13
+ if (log.level == LogLevel_1.LogLevel.Debug)
14
+ return namirasoft_core_1.ConsoleOperation.debug(data);
15
+ if (log.level == LogLevel_1.LogLevel.Info)
16
+ return namirasoft_core_1.ConsoleOperation.info(data);
17
+ if (log.level == LogLevel_1.LogLevel.Success)
18
+ return namirasoft_core_1.ConsoleOperation.success(data);
19
+ if (log.level == LogLevel_1.LogLevel.Warning)
20
+ return namirasoft_core_1.ConsoleOperation.warning(data);
21
+ if (log.level == LogLevel_1.LogLevel.Error)
22
+ return namirasoft_core_1.ConsoleOperation.error(data);
23
+ if (log.level == LogLevel_1.LogLevel.Critical)
24
+ return namirasoft_core_1.ConsoleOperation.error(data);
25
+ if (log.level == LogLevel_1.LogLevel.Fatal)
26
+ return namirasoft_core_1.ConsoleOperation.error(data);
27
+ return namirasoft_core_1.ConsoleOperation.log(data);
29
28
  };
30
- formated.pre.forEach(f => namirasoft_core_1.ConsoleOperation.log(f));
31
- formated.messages.forEach(f => writter(f));
32
- formated.post.forEach(f => namirasoft_core_1.ConsoleOperation.log(f));
29
+ let lines = [...formated.pre.map(f => namirasoft_core_1.ConsoleOperation.formatLogColor(f)), ...formated.messages.map(f => getFormatted(f)), ...formated.post.map(f => namirasoft_core_1.ConsoleOperation.log(f))];
30
+ console.log(lines.join("\n"));
33
31
  }
34
32
  }
35
33
  exports.StreamConsole = StreamConsole;
@@ -1 +1 @@
1
- {"version":3,"file":"StreamConsole.js","sourceRoot":"","sources":["../src/StreamCons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7B,OAAO,kCAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,GAAG,CAAC,KAAK,IAAI,mBAAQ,CAAC,KAAK;gBAC3B,OAAO,kCAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,GAAG,CAAC,KAAK,IAAI,mBAAQ,CAAC,QAAQ;gBAC9B,OAAO,kCAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,GAAG,CAAC,KAAK,IAAI,mBAAQ,CAAC,KAAK;gBAC3B,OAAO,kCAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,OAAO,kCAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAA;QACD,IAAI,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,kCAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,kCAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9K,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;CACJ;AA7BD,sCA6BC"}
@@ -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;aAC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,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACrF,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.9",
11
+ "version": "1.3.11",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
package/src/LogLevel.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export enum LogLevel
2
2
  {
3
- "Trace",
4
- "Verbose",
5
- "Debug",
6
- "Info",
7
- "Success",
8
- "Warning",
9
- "Error",
10
- "Critical",
11
- "Fatal"
12
- }
3
+ Trace = "Trace",
4
+ Verbose = "Verbose",
5
+ Debug = "Debug",
6
+ Info = "Info",
7
+ Success = "Success",
8
+ Warning = "Warning",
9
+ Error = "Error",
10
+ Critical = "Critical",
11
+ Fatal = "Fatal"
12
+ }
@@ -7,31 +7,29 @@ export class StreamConsole implements IStream
7
7
  {
8
8
  write(log: Log, formated: { pre: string[], messages: string[], post: string[] }): void
9
9
  {
10
- let writter = (data: string) =>
10
+ let getFormatted = (data: string) =>
11
11
  {
12
12
  if (log.level == LogLevel.Trace)
13
- ConsoleOperation.trace(data);
14
- else if (log.level == LogLevel.Verbose)
15
- ConsoleOperation.log(data);
16
- else if (log.level == LogLevel.Debug)
17
- ConsoleOperation.debug(data);
18
- else if (log.level == LogLevel.Info)
19
- ConsoleOperation.info(data);
20
- else if (log.level == LogLevel.Success)
21
- ConsoleOperation.success(data);
22
- else if (log.level == LogLevel.Warning)
23
- ConsoleOperation.warning(data);
24
- else if (log.level == LogLevel.Error)
25
- ConsoleOperation.error(data);
26
- else if (log.level == LogLevel.Critical)
27
- ConsoleOperation.error(data);
28
- else if (log.level == LogLevel.Fatal)
29
- ConsoleOperation.error(data);
30
- else
31
- ConsoleOperation.log(data);
13
+ return ConsoleOperation.trace(data);
14
+ if (log.level == LogLevel.Verbose)
15
+ return ConsoleOperation.log(data);
16
+ if (log.level == LogLevel.Debug)
17
+ return ConsoleOperation.debug(data);
18
+ if (log.level == LogLevel.Info)
19
+ return ConsoleOperation.info(data);
20
+ if (log.level == LogLevel.Success)
21
+ return ConsoleOperation.success(data);
22
+ if (log.level == LogLevel.Warning)
23
+ return ConsoleOperation.warning(data);
24
+ if (log.level == LogLevel.Error)
25
+ return ConsoleOperation.error(data);
26
+ if (log.level == LogLevel.Critical)
27
+ return ConsoleOperation.error(data);
28
+ if (log.level == LogLevel.Fatal)
29
+ return ConsoleOperation.error(data);
30
+ return ConsoleOperation.log(data);
32
31
  }
33
- formated.pre.forEach(f => ConsoleOperation.log(f));
34
- formated.messages.forEach(f => writter(f));
35
- formated.post.forEach(f => ConsoleOperation.log(f));
32
+ let lines = [...formated.pre.map(f => ConsoleOperation.formatLogColor(f)), ...formated.messages.map(f => getFormatted(f)), ...formated.post.map(f => ConsoleOperation.log(f))]
33
+ console.log(lines.join("\n"));
36
34
  }
37
35
  }
@@ -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);