@spinajs/log 2.0.180 → 2.0.182

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.
Files changed (45) hide show
  1. package/lib/cjs/bootstrap.d.ts +4 -4
  2. package/lib/cjs/bootstrap.js +55 -55
  3. package/lib/cjs/bootstrap.js.map +1 -1
  4. package/lib/cjs/index.d.ts +4 -4
  5. package/lib/cjs/index.js +20 -20
  6. package/lib/cjs/log.d.ts +29 -29
  7. package/lib/cjs/log.js +161 -161
  8. package/lib/cjs/log.js.map +1 -1
  9. package/lib/cjs/schemas/log.configuration.d.ts +87 -87
  10. package/lib/cjs/schemas/log.configuration.js +100 -100
  11. package/lib/cjs/targets/BlackHoleTarget.d.ts +7 -7
  12. package/lib/cjs/targets/BlackHoleTarget.js +24 -24
  13. package/lib/cjs/targets/BlackHoleTarget.js.map +1 -1
  14. package/lib/cjs/targets/ColoredConsoleTarget.d.ts +50 -50
  15. package/lib/cjs/targets/ColoredConsoleTarget.js +70 -70
  16. package/lib/cjs/targets/ColoredConsoleTarget.js.map +1 -1
  17. package/lib/cjs/targets/FileTarget.d.ts +29 -29
  18. package/lib/cjs/targets/FileTarget.js +263 -263
  19. package/lib/cjs/targets/FileTarget.js.map +1 -1
  20. package/lib/cjs/targets/index.d.ts +3 -3
  21. package/lib/cjs/targets/index.js +19 -19
  22. package/lib/mjs/bootstrap.d.ts +4 -4
  23. package/lib/mjs/bootstrap.js +49 -49
  24. package/lib/mjs/bootstrap.js.map +1 -1
  25. package/lib/mjs/index.d.ts +4 -4
  26. package/lib/mjs/index.js +4 -4
  27. package/lib/mjs/log.d.ts +29 -29
  28. package/lib/mjs/log.js +155 -155
  29. package/lib/mjs/log.js.map +1 -1
  30. package/lib/mjs/schemas/log.configuration.d.ts +87 -87
  31. package/lib/mjs/schemas/log.configuration.js +98 -98
  32. package/lib/mjs/targets/BlackHoleTarget.d.ts +7 -7
  33. package/lib/mjs/targets/BlackHoleTarget.js +21 -21
  34. package/lib/mjs/targets/BlackHoleTarget.js.map +1 -1
  35. package/lib/mjs/targets/ColoredConsoleTarget.d.ts +50 -50
  36. package/lib/mjs/targets/ColoredConsoleTarget.js +64 -64
  37. package/lib/mjs/targets/ColoredConsoleTarget.js.map +1 -1
  38. package/lib/mjs/targets/FileTarget.d.ts +29 -29
  39. package/lib/mjs/targets/FileTarget.js +234 -234
  40. package/lib/mjs/targets/FileTarget.js.map +1 -1
  41. package/lib/mjs/targets/index.d.ts +3 -3
  42. package/lib/mjs/targets/index.js +3 -3
  43. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  44. package/lib/tsconfig.mjs.tsbuildinfo +1 -1
  45. package/package.json +6 -6
@@ -1,71 +1,71 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ColoredConsoleTarget = exports.DEFAULT_THEME = void 0;
13
- const log_common_1 = require("@spinajs/log-common");
14
- const di_1 = require("@spinajs/di");
15
- const index_js_1 = require("./../index.js");
16
- const chalk_1 = __importDefault(require("chalk"));
17
- const configuration_1 = require("@spinajs/configuration");
18
- exports.DEFAULT_THEME = {
19
- security: ["red", "bgBrightWhite"],
20
- fatal: "red",
21
- error: "brightRed",
22
- warn: "yellow",
23
- success: "green",
24
- info: "white",
25
- debug: "gray",
26
- trace: "gray",
27
- };
28
- let ColoredConsoleTarget = class ColoredConsoleTarget extends log_common_1.LogTarget {
29
- constructor() {
30
- super(...arguments);
31
- this.theme = [];
32
- this.StdConsoleCallbackMap = {
33
- [index_js_1.LogLevel.Error]: console.error,
34
- [index_js_1.LogLevel.Fatal]: console.error,
35
- [index_js_1.LogLevel.Security]: console.error,
36
- [index_js_1.LogLevel.Info]: console.log,
37
- [index_js_1.LogLevel.Success]: console.log,
38
- [index_js_1.LogLevel.Trace]: console.debug,
39
- [index_js_1.LogLevel.Debug]: console.debug,
40
- [index_js_1.LogLevel.Warn]: console.warn,
41
- };
42
- }
43
- async resolve() {
44
- this.theme[index_js_1.LogLevel.Trace] = chalk_1.default.gray;
45
- this.theme[index_js_1.LogLevel.Debug] = chalk_1.default.gray;
46
- this.theme[index_js_1.LogLevel.Info] = chalk_1.default.white;
47
- this.theme[index_js_1.LogLevel.Success] = chalk_1.default.white.bgGreen;
48
- this.theme[index_js_1.LogLevel.Warn] = chalk_1.default.yellow;
49
- this.theme[index_js_1.LogLevel.Error] = chalk_1.default.red;
50
- this.theme[index_js_1.LogLevel.Fatal] = chalk_1.default.white.bgRed;
51
- this.theme[index_js_1.LogLevel.Security] = chalk_1.default.yellow.bgRed;
52
- super.resolve();
53
- }
54
- async write(data) {
55
- if (!this.Options.enabled) {
56
- return;
57
- }
58
- this.StdConsoleCallbackMap[data.Level](
59
- /**
60
- * we are safe to call, disable eslint
61
- */
62
- /* eslint-disable */
63
- this.theme[data.Level]((0, configuration_1.format)(data.Variables, this.Options.layout)));
64
- }
65
- };
66
- ColoredConsoleTarget = __decorate([
67
- (0, di_1.Singleton)(),
68
- (0, di_1.Injectable)("ConsoleTarget")
69
- ], ColoredConsoleTarget);
70
- exports.ColoredConsoleTarget = ColoredConsoleTarget;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ColoredConsoleTarget = exports.DEFAULT_THEME = void 0;
13
+ const log_common_1 = require("@spinajs/log-common");
14
+ const di_1 = require("@spinajs/di");
15
+ const index_js_1 = require("./../index.js");
16
+ const chalk_1 = __importDefault(require("chalk"));
17
+ const configuration_1 = require("@spinajs/configuration");
18
+ exports.DEFAULT_THEME = {
19
+ security: ["red", "bgBrightWhite"],
20
+ fatal: "red",
21
+ error: "brightRed",
22
+ warn: "yellow",
23
+ success: "green",
24
+ info: "white",
25
+ debug: "gray",
26
+ trace: "gray",
27
+ };
28
+ let ColoredConsoleTarget = class ColoredConsoleTarget extends log_common_1.LogTarget {
29
+ constructor() {
30
+ super(...arguments);
31
+ this.theme = [];
32
+ this.StdConsoleCallbackMap = {
33
+ [index_js_1.LogLevel.Error]: console.error,
34
+ [index_js_1.LogLevel.Fatal]: console.error,
35
+ [index_js_1.LogLevel.Security]: console.error,
36
+ [index_js_1.LogLevel.Info]: console.log,
37
+ [index_js_1.LogLevel.Success]: console.log,
38
+ [index_js_1.LogLevel.Trace]: console.debug,
39
+ [index_js_1.LogLevel.Debug]: console.debug,
40
+ [index_js_1.LogLevel.Warn]: console.warn,
41
+ };
42
+ }
43
+ async resolve() {
44
+ this.theme[index_js_1.LogLevel.Trace] = chalk_1.default.gray;
45
+ this.theme[index_js_1.LogLevel.Debug] = chalk_1.default.gray;
46
+ this.theme[index_js_1.LogLevel.Info] = chalk_1.default.white;
47
+ this.theme[index_js_1.LogLevel.Success] = chalk_1.default.white.bgGreen;
48
+ this.theme[index_js_1.LogLevel.Warn] = chalk_1.default.yellow;
49
+ this.theme[index_js_1.LogLevel.Error] = chalk_1.default.red;
50
+ this.theme[index_js_1.LogLevel.Fatal] = chalk_1.default.white.bgRed;
51
+ this.theme[index_js_1.LogLevel.Security] = chalk_1.default.yellow.bgRed;
52
+ super.resolve();
53
+ }
54
+ async write(data) {
55
+ if (!this.Options.enabled) {
56
+ return;
57
+ }
58
+ this.StdConsoleCallbackMap[data.Level](
59
+ /**
60
+ * we are safe to call, disable eslint
61
+ */
62
+ /* eslint-disable */
63
+ this.theme[data.Level]((0, configuration_1.format)(data.Variables, this.Options.layout)));
64
+ }
65
+ };
66
+ exports.ColoredConsoleTarget = ColoredConsoleTarget;
67
+ exports.ColoredConsoleTarget = ColoredConsoleTarget = __decorate([
68
+ (0, di_1.Singleton)(),
69
+ (0, di_1.Injectable)("ConsoleTarget")
70
+ ], ColoredConsoleTarget);
71
71
  //# sourceMappingURL=ColoredConsoleTarget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColoredConsoleTarget.js","sourceRoot":"","sources":["../../../src/targets/ColoredConsoleTarget.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAI6B;AAC7B,oCAAoD;AACpD,4CAAyC;AACzC,kDAA0B;AAC1B,0DAAgD;AAEnC,QAAA,aAAa,GAAG;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC;IAClC,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;CACd,CAAC;AAIK,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,sBAAuC;IAA1E;;QACK,UAAK,GAAU,EAAE,CAAC;QAElB,0BAAqB,GAAG;YAChC,CAAC,mBAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAA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,IAAe;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzB,OAAO;SACR;QAED,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC;QACpC;;WAEG;QACH,oBAAoB;QACnB,IAAI,CAAC,KAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAC7B,IAAA,sBAAM,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAC5C,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AA7CY,oDAAoB;+BAApB,oBAAoB;IAFhC,IAAA,cAAS,GAAE;IACX,IAAA,eAAU,EAAC,eAAe,CAAC;GACf,oBAAoB,CA6ChC"}
@@ -1,30 +1,30 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import fs from "fs";
4
- import { IInstanceCheck } from "@spinajs/di";
5
- import { IFileTargetOptions, Log, ILogEntry, LogTarget } from "@spinajs/log-common";
6
- declare enum FileTargetStatus {
7
- WRITTING = 0,
8
- PENDING = 1,
9
- IDLE = 2
10
- }
11
- export declare class FileTarget extends LogTarget<IFileTargetOptions> implements IInstanceCheck {
12
- protected Log: Log;
13
- LogDirPath: string;
14
- ArchiveDirPath: string;
15
- protected WriteStream: fs.WriteStream;
16
- protected Buffer: string[];
17
- protected WriteBuffer: string[];
18
- protected ArchiveTimer: NodeJS.Timer;
19
- protected FlushTimer: NodeJS.Timer;
20
- protected Status: FileTargetStatus;
21
- protected ArchiveStatus: FileTargetStatus;
22
- __checkInstance__(creationOptions: IFileTargetOptions[]): boolean;
23
- resolve(): void;
24
- protected flush(): void;
25
- dispose(): Promise<void>;
26
- write(data: ILogEntry): Promise<void>;
27
- protected archive(): void;
28
- }
29
- export {};
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import fs from "fs";
4
+ import { IInstanceCheck } from "@spinajs/di";
5
+ import { IFileTargetOptions, Log, ILogEntry, LogTarget } from "@spinajs/log-common";
6
+ declare enum FileTargetStatus {
7
+ WRITTING = 0,
8
+ PENDING = 1,
9
+ IDLE = 2
10
+ }
11
+ export declare class FileTarget extends LogTarget<IFileTargetOptions> implements IInstanceCheck {
12
+ protected Log: Log;
13
+ LogDirPath: string;
14
+ ArchiveDirPath: string;
15
+ protected WriteStream: fs.WriteStream;
16
+ protected Buffer: string[];
17
+ protected WriteBuffer: string[];
18
+ protected ArchiveTimer: NodeJS.Timer;
19
+ protected FlushTimer: NodeJS.Timer;
20
+ protected Status: FileTargetStatus;
21
+ protected ArchiveStatus: FileTargetStatus;
22
+ __checkInstance__(creationOptions: IFileTargetOptions[]): boolean;
23
+ resolve(): void;
24
+ protected flush(): void;
25
+ dispose(): Promise<void>;
26
+ write(data: ILogEntry): Promise<void>;
27
+ protected archive(): void;
28
+ }
29
+ export {};
30
30
  //# sourceMappingURL=FileTarget.d.ts.map