namirasoft-log 1.3.10 → 1.3.12
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/LogLevel.d.ts +9 -9
- package/dist/LogLevel.js +9 -9
- package/dist/LogLevel.js.map +1 -1
- package/dist/StreamConsole.js +21 -23
- package/dist/StreamConsole.js.map +1 -1
- package/package.json +1 -1
- package/src/LogLevel.ts +10 -10
- package/src/StreamConsole.ts +21 -23
package/dist/LogLevel.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare enum LogLevel {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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[
|
|
7
|
-
LogLevel[
|
|
8
|
-
LogLevel[
|
|
9
|
-
LogLevel[
|
|
10
|
-
LogLevel[
|
|
11
|
-
LogLevel[
|
|
12
|
-
LogLevel[
|
|
13
|
-
LogLevel[
|
|
14
|
-
LogLevel[
|
|
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
|
package/dist/LogLevel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogLevel.js","sourceRoot":"","sources":["../src/LogLevel.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAWX;AAXD,WAAY,QAAQ;IAEhB,
|
|
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"}
|
package/dist/StreamConsole.js
CHANGED
|
@@ -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
|
|
8
|
+
let getFormatted = (data) => {
|
|
9
9
|
if (log.level == LogLevel_1.LogLevel.Trace)
|
|
10
|
-
namirasoft_core_1.ConsoleOperation.trace(data);
|
|
11
|
-
|
|
12
|
-
namirasoft_core_1.ConsoleOperation.log(data);
|
|
13
|
-
|
|
14
|
-
namirasoft_core_1.ConsoleOperation.debug(data);
|
|
15
|
-
|
|
16
|
-
namirasoft_core_1.ConsoleOperation.info(data);
|
|
17
|
-
|
|
18
|
-
namirasoft_core_1.ConsoleOperation.success(data);
|
|
19
|
-
|
|
20
|
-
namirasoft_core_1.ConsoleOperation.warning(data);
|
|
21
|
-
|
|
22
|
-
namirasoft_core_1.ConsoleOperation.error(data);
|
|
23
|
-
|
|
24
|
-
namirasoft_core_1.ConsoleOperation.error(data);
|
|
25
|
-
|
|
26
|
-
namirasoft_core_1.ConsoleOperation.error(data);
|
|
27
|
-
|
|
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.
|
|
31
|
-
|
|
32
|
-
formated.post.forEach(f => namirasoft_core_1.ConsoleOperation.log(f));
|
|
29
|
+
let lines = [...formated.pre.map(namirasoft_core_1.ConsoleOperation.formatLogColor), ...formated.messages.map(getFormatted), ...formated.post.map(namirasoft_core_1.ConsoleOperation.formatLogColor)];
|
|
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/StreamConsole.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAGnD,yCAAsC;AAEtC,MAAa,aAAa;IAEtB,KAAK,CAAC,GAAQ,EAAE,QAA+D;QAE3E,IAAI,
|
|
1
|
+
{"version":3,"file":"StreamConsole.js","sourceRoot":"","sources":["../src/StreamConsole.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAGnD,yCAAsC;AAEtC,MAAa,aAAa;IAEtB,KAAK,CAAC,GAAQ,EAAE,QAA+D;QAE3E,IAAI,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;YAEhC,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,OAAO;gBAC7B,OAAO,kCAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtC,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,IAAI;gBAC1B,OAAO,kCAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvC,IAAI,GAAG,CAAC,KAAK,IAAI,mBAAQ,CAAC,OAAO;gBAC7B,OAAO,kCAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,GAAG,CAAC,KAAK,IAAI,mBAAQ,CAAC,OAAO;gBAC7B,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,kCAAgB,CAAC,cAAc,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,kCAAgB,CAAC,cAAc,CAAC,CAAC,CAAA;QACjK,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;CACJ;AA7BD,sCA6BC"}
|
package/package.json
CHANGED
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
|
+
}
|
package/src/StreamConsole.ts
CHANGED
|
@@ -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
|
|
10
|
+
let getFormatted = (data: string) =>
|
|
11
11
|
{
|
|
12
12
|
if (log.level == LogLevel.Trace)
|
|
13
|
-
ConsoleOperation.trace(data);
|
|
14
|
-
|
|
15
|
-
ConsoleOperation.log(data);
|
|
16
|
-
|
|
17
|
-
ConsoleOperation.debug(data);
|
|
18
|
-
|
|
19
|
-
ConsoleOperation.info(data);
|
|
20
|
-
|
|
21
|
-
ConsoleOperation.success(data);
|
|
22
|
-
|
|
23
|
-
ConsoleOperation.warning(data);
|
|
24
|
-
|
|
25
|
-
ConsoleOperation.error(data);
|
|
26
|
-
|
|
27
|
-
ConsoleOperation.error(data);
|
|
28
|
-
|
|
29
|
-
ConsoleOperation.error(data);
|
|
30
|
-
|
|
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.
|
|
34
|
-
|
|
35
|
-
formated.post.forEach(f => ConsoleOperation.log(f));
|
|
32
|
+
let lines = [...formated.pre.map(ConsoleOperation.formatLogColor), ...formated.messages.map(getFormatted), ...formated.post.map(ConsoleOperation.formatLogColor)]
|
|
33
|
+
console.log(lines.join("\n"));
|
|
36
34
|
}
|
|
37
35
|
}
|