zeddy-logger 1.0.4 → 1.0.5

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 (111) hide show
  1. package/README.md +12 -104
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/index.cjs +5 -0
  4. package/dist/index.d.cts +3 -0
  5. package/dist/index.d.mts +3 -0
  6. package/dist/index.mjs +4 -0
  7. package/dist/logger-base.cjs +20 -0
  8. package/dist/logger-base.d.cts +22 -0
  9. package/dist/logger-base.d.cts.map +1 -0
  10. package/dist/logger-base.d.mts +22 -0
  11. package/dist/logger-base.d.mts.map +1 -0
  12. package/dist/logger-base.mjs +20 -0
  13. package/dist/logger-base.mjs.map +1 -0
  14. package/dist/outputs/console-output.cjs +23 -0
  15. package/dist/outputs/console-output.d.cts +22 -0
  16. package/dist/outputs/console-output.d.cts.map +1 -0
  17. package/dist/outputs/console-output.d.mts +22 -0
  18. package/dist/outputs/console-output.d.mts.map +1 -0
  19. package/dist/outputs/console-output.mjs +23 -0
  20. package/dist/outputs/console-output.mjs.map +1 -0
  21. package/dist/outputs/file-output.cjs +34 -0
  22. package/dist/outputs/file-output.d.cts +17 -0
  23. package/dist/outputs/file-output.d.cts.map +1 -0
  24. package/dist/outputs/file-output.d.mts +17 -0
  25. package/dist/outputs/file-output.d.mts.map +1 -0
  26. package/dist/outputs/file-output.mjs +33 -0
  27. package/dist/outputs/file-output.mjs.map +1 -0
  28. package/dist/outputs/json-output.cjs +25 -0
  29. package/dist/outputs/json-output.d.cts +15 -0
  30. package/dist/outputs/json-output.d.cts.map +1 -0
  31. package/dist/outputs/json-output.d.mts +15 -0
  32. package/dist/outputs/json-output.d.mts.map +1 -0
  33. package/dist/outputs/json-output.mjs +24 -0
  34. package/dist/outputs/json-output.mjs.map +1 -0
  35. package/dist/outputs.cjs +7 -0
  36. package/dist/outputs.d.cts +4 -0
  37. package/dist/outputs.d.mts +4 -0
  38. package/dist/outputs.mjs +5 -0
  39. package/dist/standard-logger.cjs +57 -0
  40. package/dist/standard-logger.d.cts +14 -0
  41. package/dist/standard-logger.d.cts.map +1 -0
  42. package/dist/standard-logger.d.mts +14 -0
  43. package/dist/standard-logger.d.mts.map +1 -0
  44. package/dist/standard-logger.mjs +58 -0
  45. package/dist/standard-logger.mjs.map +1 -0
  46. package/package.json +28 -33
  47. package/.prettierrc +0 -14
  48. package/LICENSE +0 -24
  49. package/dist/cjs/index.d.ts +0 -4
  50. package/dist/cjs/index.d.ts.map +0 -1
  51. package/dist/cjs/index.js +0 -8
  52. package/dist/cjs/index.js.map +0 -1
  53. package/dist/cjs/logger-base.d.ts +0 -19
  54. package/dist/cjs/logger-base.d.ts.map +0 -1
  55. package/dist/cjs/logger-base.js +0 -35
  56. package/dist/cjs/logger-base.js.map +0 -1
  57. package/dist/cjs/outputs/console-output.d.ts +0 -18
  58. package/dist/cjs/outputs/console-output.d.ts.map +0 -1
  59. package/dist/cjs/outputs/console-output.js +0 -42
  60. package/dist/cjs/outputs/console-output.js.map +0 -1
  61. package/dist/cjs/outputs/file-output.d.ts +0 -13
  62. package/dist/cjs/outputs/file-output.d.ts.map +0 -1
  63. package/dist/cjs/outputs/file-output.js +0 -70
  64. package/dist/cjs/outputs/file-output.js.map +0 -1
  65. package/dist/cjs/outputs/json-output.d.ts +0 -11
  66. package/dist/cjs/outputs/json-output.d.ts.map +0 -1
  67. package/dist/cjs/outputs/json-output.js +0 -56
  68. package/dist/cjs/outputs/json-output.js.map +0 -1
  69. package/dist/cjs/outputs/outputs.d.ts +0 -5
  70. package/dist/cjs/outputs/outputs.d.ts.map +0 -1
  71. package/dist/cjs/outputs/outputs.js +0 -10
  72. package/dist/cjs/outputs/outputs.js.map +0 -1
  73. package/dist/cjs/package.json +0 -1
  74. package/dist/cjs/standard-logger.d.ts +0 -27
  75. package/dist/cjs/standard-logger.d.ts.map +0 -1
  76. package/dist/cjs/standard-logger.js +0 -29
  77. package/dist/cjs/standard-logger.js.map +0 -1
  78. package/dist/esm/index.d.ts +0 -4
  79. package/dist/esm/index.d.ts.map +0 -1
  80. package/dist/esm/index.js +0 -4
  81. package/dist/esm/index.js.map +0 -1
  82. package/dist/esm/logger-base.d.ts +0 -19
  83. package/dist/esm/logger-base.d.ts.map +0 -1
  84. package/dist/esm/logger-base.js +0 -21
  85. package/dist/esm/logger-base.js.map +0 -1
  86. package/dist/esm/outputs/console-output.d.ts +0 -18
  87. package/dist/esm/outputs/console-output.d.ts.map +0 -1
  88. package/dist/esm/outputs/console-output.js +0 -26
  89. package/dist/esm/outputs/console-output.js.map +0 -1
  90. package/dist/esm/outputs/file-output.d.ts +0 -13
  91. package/dist/esm/outputs/file-output.d.ts.map +0 -1
  92. package/dist/esm/outputs/file-output.js +0 -34
  93. package/dist/esm/outputs/file-output.js.map +0 -1
  94. package/dist/esm/outputs/json-output.d.ts +0 -11
  95. package/dist/esm/outputs/json-output.d.ts.map +0 -1
  96. package/dist/esm/outputs/json-output.js +0 -21
  97. package/dist/esm/outputs/json-output.js.map +0 -1
  98. package/dist/esm/outputs/outputs.d.ts +0 -5
  99. package/dist/esm/outputs/outputs.d.ts.map +0 -1
  100. package/dist/esm/outputs/outputs.js +0 -5
  101. package/dist/esm/outputs/outputs.js.map +0 -1
  102. package/dist/esm/package.json +0 -1
  103. package/dist/esm/standard-logger.d.ts +0 -27
  104. package/dist/esm/standard-logger.d.ts.map +0 -1
  105. package/dist/esm/standard-logger.js +0 -25
  106. package/dist/esm/standard-logger.js.map +0 -1
  107. package/examples/logger.ts +0 -19
  108. package/examples/main.ts +0 -8
  109. package/tsconfig.base.json +0 -105
  110. package/tsconfig.cjs.json +0 -8
  111. package/tsconfig.esm.json +0 -8
@@ -0,0 +1,57 @@
1
+ const require_logger_base = require('./logger-base.cjs');
2
+
3
+ //#region src/standard-logger.ts
4
+ const LogLevel = {
5
+ info: {
6
+ name: "log-level",
7
+ value: "info"
8
+ },
9
+ debug: {
10
+ name: "log-level",
11
+ value: "debug"
12
+ },
13
+ warning: {
14
+ name: "log-level",
15
+ value: "warning"
16
+ },
17
+ error: {
18
+ name: "log-level",
19
+ value: "error"
20
+ }
21
+ };
22
+ var StandardLogger = class extends require_logger_base.LoggerBase {
23
+ constructor(logOutputs) {
24
+ super(logOutputs);
25
+ }
26
+ info(message, data) {
27
+ this.log({
28
+ tags: [LogLevel.info],
29
+ data,
30
+ message
31
+ });
32
+ }
33
+ debug(message, data) {
34
+ this.log({
35
+ tags: [LogLevel.debug],
36
+ data,
37
+ message
38
+ });
39
+ }
40
+ warning(message, data) {
41
+ this.log({
42
+ tags: [LogLevel.warning],
43
+ data,
44
+ message
45
+ });
46
+ }
47
+ error(message, data) {
48
+ this.log({
49
+ tags: [LogLevel.error],
50
+ data,
51
+ message
52
+ });
53
+ }
54
+ };
55
+
56
+ //#endregion
57
+ exports.StandardLogger = StandardLogger;
@@ -0,0 +1,14 @@
1
+ import { LogOutput, LoggerBase } from "./logger-base.cjs";
2
+
3
+ //#region src/standard-logger.d.ts
4
+
5
+ declare class StandardLogger extends LoggerBase {
6
+ constructor(logOutputs: LogOutput[]);
7
+ info(message: string, data?: any): void;
8
+ debug(message: string, data?: any): void;
9
+ warning(message: string, data?: any): void;
10
+ error(message: string, data?: any): void;
11
+ }
12
+ //#endregion
13
+ export { StandardLogger };
14
+ //# sourceMappingURL=standard-logger.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-logger.d.cts","names":[],"sources":["../src/standard-logger.ts"],"sourcesContent":[],"mappings":";;;;cASa,cAAA,SAAuB,UAAA;0BACV"}
@@ -0,0 +1,14 @@
1
+ import { LogOutput, LoggerBase } from "./logger-base.mjs";
2
+
3
+ //#region src/standard-logger.d.ts
4
+
5
+ declare class StandardLogger extends LoggerBase {
6
+ constructor(logOutputs: LogOutput[]);
7
+ info(message: string, data?: any): void;
8
+ debug(message: string, data?: any): void;
9
+ warning(message: string, data?: any): void;
10
+ error(message: string, data?: any): void;
11
+ }
12
+ //#endregion
13
+ export { StandardLogger };
14
+ //# sourceMappingURL=standard-logger.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-logger.d.mts","names":[],"sources":["../src/standard-logger.ts"],"sourcesContent":[],"mappings":";;;;cASa,cAAA,SAAuB,UAAA;0BACV"}
@@ -0,0 +1,58 @@
1
+ import { LoggerBase } from "./logger-base.mjs";
2
+
3
+ //#region src/standard-logger.ts
4
+ const LogLevel = {
5
+ info: {
6
+ name: "log-level",
7
+ value: "info"
8
+ },
9
+ debug: {
10
+ name: "log-level",
11
+ value: "debug"
12
+ },
13
+ warning: {
14
+ name: "log-level",
15
+ value: "warning"
16
+ },
17
+ error: {
18
+ name: "log-level",
19
+ value: "error"
20
+ }
21
+ };
22
+ var StandardLogger = class extends LoggerBase {
23
+ constructor(logOutputs) {
24
+ super(logOutputs);
25
+ }
26
+ info(message, data) {
27
+ this.log({
28
+ tags: [LogLevel.info],
29
+ data,
30
+ message
31
+ });
32
+ }
33
+ debug(message, data) {
34
+ this.log({
35
+ tags: [LogLevel.debug],
36
+ data,
37
+ message
38
+ });
39
+ }
40
+ warning(message, data) {
41
+ this.log({
42
+ tags: [LogLevel.warning],
43
+ data,
44
+ message
45
+ });
46
+ }
47
+ error(message, data) {
48
+ this.log({
49
+ tags: [LogLevel.error],
50
+ data,
51
+ message
52
+ });
53
+ }
54
+ };
55
+
56
+ //#endregion
57
+ export { StandardLogger };
58
+ //# sourceMappingURL=standard-logger.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-logger.mjs","names":[],"sources":["../src/standard-logger.ts"],"sourcesContent":["import {LoggerBase, type LogOutput} from './logger-base';\n\nexport const LogLevel = {\n info: {name: 'log-level', value: 'info'},\n debug: {name: 'log-level', value: 'debug'},\n warning: {name: 'log-level', value: 'warning'},\n error: {name: 'log-level', value: 'error'},\n};\n\nexport class StandardLogger extends LoggerBase {\n constructor(logOutputs: LogOutput[]) {\n super(logOutputs);\n }\n\n public info(message: string, data?: any) {\n void this.log({tags: [LogLevel.info], data, message});\n }\n\n public debug(message: string, data?: any) {\n void this.log({tags: [LogLevel.debug], data, message});\n }\n\n public warning(message: string, data?: any) {\n void this.log({tags: [LogLevel.warning], data, message});\n }\n\n public error(message: string, data?: any) {\n void this.log({tags: [LogLevel.error], data, message});\n }\n}\n"],"mappings":";;;AAEA,MAAa,WAAW;CACtB,MAAM;EAAC,MAAM;EAAa,OAAO;EAAO;CACxC,OAAO;EAAC,MAAM;EAAa,OAAO;EAAQ;CAC1C,SAAS;EAAC,MAAM;EAAa,OAAO;EAAU;CAC9C,OAAO;EAAC,MAAM;EAAa,OAAO;EAAQ;CAC3C;AAED,IAAa,iBAAb,cAAoC,WAAW;CAC7C,YAAY,YAAyB;AACnC,QAAM,WAAW;;CAGnB,AAAO,KAAK,SAAiB,MAAY;AACvC,EAAK,KAAK,IAAI;GAAC,MAAM,CAAC,SAAS,KAAK;GAAE;GAAM;GAAQ,CAAC;;CAGvD,AAAO,MAAM,SAAiB,MAAY;AACxC,EAAK,KAAK,IAAI;GAAC,MAAM,CAAC,SAAS,MAAM;GAAE;GAAM;GAAQ,CAAC;;CAGxD,AAAO,QAAQ,SAAiB,MAAY;AAC1C,EAAK,KAAK,IAAI;GAAC,MAAM,CAAC,SAAS,QAAQ;GAAE;GAAM;GAAQ,CAAC;;CAG1D,AAAO,MAAM,SAAiB,MAAY;AACxC,EAAK,KAAK,IAAI;GAAC,MAAM,CAAC,SAAS,MAAM;GAAE;GAAM;GAAQ,CAAC"}
package/package.json CHANGED
@@ -1,56 +1,51 @@
1
1
  {
2
2
  "name": "zeddy-logger",
3
- "version": "1.0.4",
3
+ "type": "module",
4
+ "version": "1.0.5",
4
5
  "description": "Logging library for Node",
5
6
  "author": "Zlatibor Veljković",
6
7
  "license": "The Unlicense",
8
+ "homepage": "https://github.com/zveljkovic/zeddy-logging",
7
9
  "repository": {
8
10
  "type": "git",
9
11
  "url": "git+https://github.com/zveljkovic/zeddy-logging.git"
10
12
  },
11
- "homepage": "https://github.com/zveljkovic/zeddy-logging",
12
13
  "keywords": [
13
14
  "logging",
14
15
  "zeddy"
15
16
  ],
16
- "scripts": {
17
- "example": "node-dev --respawn examples\\main.ts",
18
- "test": "echo \"Error: no test specified\" && exit 1",
19
- "build": "tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json & node fixup.js",
20
- "publish:local": "npm pack --pack-destination",
21
- "prepare": "npm run build",
22
- "prepublishOnly": "",
23
- "preversion": "",
24
- "version": "git add -A src",
25
- "postversion": "git push && git push --tags"
17
+ "bugs": {
18
+ "url": "https://github.com/zveljkovic/zeddy-logging/issues"
26
19
  },
27
- "main": "dist/cjs/index.js",
28
- "module": "dist/esm/index.js",
29
20
  "exports": {
30
21
  ".": {
31
- "types": "./dist/esm/index.d.ts",
32
- "import": "./dist/esm/index.js",
33
- "require": "./dist/cjs/index.js",
34
- "default": "./dist/esm/index.js"
22
+ "require": "./dist/index.cjs",
23
+ "import": "./dist/index.mjs"
35
24
  },
36
25
  "./outputs": {
37
- "types": "./dist/esm/outputs/outputs.d.ts",
38
- "import": "./dist/esm/outputs/outputs.js",
39
- "require": "./dist/cjs/outputs/outputs.js",
40
- "default": "./dist/esm/outputs/outputs.js"
41
- }
26
+ "require": "./dist/outputs.cjs",
27
+ "import": "./dist/outputs.mjs"
28
+ },
29
+ "./package.json": "./package.json"
42
30
  },
43
- "typesVersions": {
44
- "*": {
45
- "outputs": [
46
- "./dist/esm/outputs/outputs"
47
- ]
48
- }
31
+ "main": "./dist/index.cjs",
32
+ "module": "./dist/index.mjs",
33
+ "types": "./dist/index.d.cts",
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "scripts": {
38
+ "build": "tsdown",
39
+ "dev": "tsdown --watch",
40
+ "test": "vitest",
41
+ "typecheck": "tsc --noEmit",
42
+ "prepublishOnly": "npm run build"
49
43
  },
50
44
  "devDependencies": {
51
- "node-dev": "^7.4.3",
52
- "prettier": "^2.7.1",
53
- "ts-node": "^10.9.1",
54
- "typescript": "^4.8.3"
45
+ "@types/node": "^25.0.3",
46
+ "bumpp": "^10.3.2",
47
+ "tsdown": "^0.18.1",
48
+ "typescript": "^5.9.3",
49
+ "vitest": "^4.0.16"
55
50
  }
56
51
  }
package/.prettierrc DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "tabWidth": 2,
4
- "useTabs": false,
5
- "semi": true,
6
- "quoteProps": "as-needed",
7
- "jsxSingleQuote": false,
8
- "singleQuote": true,
9
- "trailingComma": "all",
10
- "bracketSpacing": false,
11
- "arrowParens": "always",
12
- "proseWrap": "preserve",
13
- "endOfLine": "auto"
14
- }
package/LICENSE DELETED
@@ -1,24 +0,0 @@
1
- This is free and unencumbered software released into the public domain.
2
-
3
- Anyone is free to copy, modify, publish, use, compile, sell, or
4
- distribute this software, either in source code form or as a compiled
5
- binary, for any purpose, commercial or non-commercial, and by any
6
- means.
7
-
8
- In jurisdictions that recognize copyright laws, the author or authors
9
- of this software dedicate any and all copyright interest in the
10
- software to the public domain. We make this dedication for the benefit
11
- of the public at large and to the detriment of our heirs and
12
- successors. We intend this dedication to be an overt act of
13
- relinquishment in perpetuity of all present and future rights to this
14
- software under copyright law.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- For more information, please refer to <https://unlicense.org>
@@ -1,4 +0,0 @@
1
- import { LoggerBase } from './logger-base';
2
- import { StandardLogger } from './standard-logger';
3
- export { LoggerBase, StandardLogger };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAC,UAAU,EAAE,cAAc,EAAC,CAAC"}
package/dist/cjs/index.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StandardLogger = exports.LoggerBase = void 0;
4
- const logger_base_1 = require("./logger-base");
5
- Object.defineProperty(exports, "LoggerBase", { enumerable: true, get: function () { return logger_base_1.LoggerBase; } });
6
- const standard_logger_1 = require("./standard-logger");
7
- Object.defineProperty(exports, "StandardLogger", { enumerable: true, get: function () { return standard_logger_1.StandardLogger; } });
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AAGjC,2FAHA,wBAAU,OAGA;AAFlB,uDAAiD;AAE7B,+FAFZ,gCAAc,OAEY"}
@@ -1,19 +0,0 @@
1
- export declare type LogTag = {
2
- name: string;
3
- value: string;
4
- };
5
- export declare type LogData = {
6
- message: string;
7
- data: any;
8
- tags: LogTag[];
9
- };
10
- export declare type LogOutput = {
11
- log: (logData: LogData) => Promise<void>;
12
- transform?: (logData: LogData) => Promise<LogData | null>;
13
- };
14
- export declare class LoggerBase {
15
- private logOutputs;
16
- constructor(logOutputs: LogOutput[]);
17
- log(logData: LogData): Promise<void>;
18
- }
19
- //# sourceMappingURL=logger-base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger-base.d.ts","sourceRoot":"","sources":["../../src/logger-base.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,oBAAY,SAAS,GAAG;IACtB,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CAC3D,CAAC;AAEF,qBAAa,UAAU;IACT,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,SAAS,EAAE;IAErC,GAAG,CAAC,OAAO,EAAE,OAAO;CAc3B"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.LoggerBase = void 0;
13
- class LoggerBase {
14
- constructor(logOutputs) {
15
- this.logOutputs = logOutputs;
16
- }
17
- log(logData) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- for (const logOutput of this.logOutputs) {
20
- if (!logOutput.transform) {
21
- // no transform function, just log
22
- yield logOutput.log(logData);
23
- continue;
24
- }
25
- // There is a transformation function
26
- // This might return null to prevent sending
27
- const transformedLogData = yield logOutput.transform(logData);
28
- if (transformedLogData)
29
- yield logOutput.log(transformedLogData);
30
- }
31
- });
32
- }
33
- }
34
- exports.LoggerBase = LoggerBase;
35
- //# sourceMappingURL=logger-base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger-base.js","sourceRoot":"","sources":["../../src/logger-base.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,MAAa,UAAU;IACrB,YAAoB,UAAuB;QAAvB,eAAU,GAAV,UAAU,CAAa;IAAG,CAAC;IAEzC,GAAG,CAAC,OAAgB;;YACxB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE;gBACvC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;oBACxB,kCAAkC;oBAClC,MAAM,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBAC7B,SAAS;iBACV;gBACD,qCAAqC;gBACrC,4CAA4C;gBAC5C,MAAM,kBAAkB,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC9D,IAAI,kBAAkB;oBACpB,MAAM,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;aAC3C;QACH,CAAC;KAAA;CACF;AAjBD,gCAiBC"}
@@ -1,18 +0,0 @@
1
- import { LogData, LogOutput, LogTag } from '../logger-base';
2
- export declare type ConsoleLogFunctions = 'info' | 'error' | 'debug' | 'log';
3
- export declare type ConsoleFunctionMap = {
4
- tagName: LogTag['name'];
5
- tagValue: LogTag['value'];
6
- consoleFunction: ConsoleLogFunctions;
7
- };
8
- export interface ConsoleOutputOptions {
9
- transform?: (logData: LogData) => Promise<LogData>;
10
- tagToConsoleFunctionMap?: ConsoleFunctionMap[];
11
- }
12
- export declare class ConsoleOutput implements LogOutput {
13
- protected opts: ConsoleOutputOptions;
14
- constructor(opts: ConsoleOutputOptions);
15
- log(logData: LogData): Promise<void>;
16
- transform(logData: LogData): Promise<LogData>;
17
- }
18
- //# sourceMappingURL=console-output.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"console-output.d.ts","sourceRoot":"","sources":["../../../src/outputs/console-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAE1D,oBAAY,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AACrE,oBAAY,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,eAAe,EAAE,mBAAmB,CAAC;CACtC,CAAC;AACF,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,uBAAuB,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAChD;AACD,qBAAa,aAAc,YAAW,SAAS;IACjC,SAAS,CAAC,IAAI,EAAE,oBAAoB;gBAA1B,IAAI,EAAE,oBAAoB;IAE1C,GAAG,CAAC,OAAO,EAAE,OAAO;IAgBpB,SAAS,CAAC,OAAO,EAAE,OAAO;CAIjC"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ConsoleOutput = void 0;
13
- class ConsoleOutput {
14
- constructor(opts) {
15
- this.opts = opts;
16
- }
17
- log(logData) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- let logFunction = 'log';
20
- if (this.opts.tagToConsoleFunctionMap) {
21
- for (const tag of logData.tags) {
22
- const consoleFunctionMap = this.opts.tagToConsoleFunctionMap.filter((x) => x.tagName === tag.name && x.tagValue === tag.value);
23
- if (consoleFunctionMap.length > 0) {
24
- logFunction = consoleFunctionMap[0].consoleFunction;
25
- }
26
- }
27
- }
28
- if (logData.data)
29
- return console[logFunction](logData.message, logData.data);
30
- return console[logFunction](logData.message);
31
- });
32
- }
33
- transform(logData) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- if (this.opts.transform)
36
- return this.opts.transform(logData);
37
- return logData;
38
- });
39
- }
40
- }
41
- exports.ConsoleOutput = ConsoleOutput;
42
- //# sourceMappingURL=console-output.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"console-output.js","sourceRoot":"","sources":["../../../src/outputs/console-output.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,MAAa,aAAa;IACxB,YAAsB,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE9C,GAAG,CAAC,OAAgB;;YACxB,IAAI,WAAW,GAAG,KAAK,CAAC;YACxB,IAAI,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;gBACrC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE;oBAC9B,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CACjE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,KAAK,GAAG,CAAC,KAAK,CAC1D,CAAC;oBACF,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;wBACjC,WAAW,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;qBACrD;iBACF;aACF;YACD,IAAI,OAAO,CAAC,IAAI;gBAAE,OAAO,OAAO,CAAC,WAAkC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YACpG,OAAO,OAAO,CAAC,WAAkC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtE,CAAC;KAAA;IAEK,SAAS,CAAC,OAAgB;;YAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC7D,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF;AAvBD,sCAuBC"}
@@ -1,13 +0,0 @@
1
- import { LogData, LogOutput } from '../logger-base';
2
- export interface FileOutputOptions {
3
- transform?: (logData: LogData) => Promise<LogData>;
4
- filename: string;
5
- }
6
- export declare class FileOutput implements LogOutput {
7
- protected opts: FileOutputOptions;
8
- private readonly _fd;
9
- constructor(opts: FileOutputOptions);
10
- log(logData: LogData): Promise<void>;
11
- transform(logData: LogData): Promise<LogData>;
12
- }
13
- //# sourceMappingURL=file-output.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-output.d.ts","sourceRoot":"","sources":["../../../src/outputs/file-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAGlD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,UAAW,YAAW,SAAS;IAG9B,SAAS,CAAC,IAAI,EAAE,iBAAiB;IAF7C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;gBAER,IAAI,EAAE,iBAAiB;IAIvC,GAAG,CAAC,OAAO,EAAE,OAAO;IAYpB,SAAS,CAAC,OAAO,EAAE,OAAO;CAUjC"}
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.FileOutput = void 0;
36
- const fs = __importStar(require("fs"));
37
- class FileOutput {
38
- constructor(opts) {
39
- this.opts = opts;
40
- this._fd = fs.openSync(opts.filename, 'a');
41
- }
42
- log(logData) {
43
- var _a;
44
- return __awaiter(this, void 0, void 0, function* () {
45
- let message = (_a = logData.message) !== null && _a !== void 0 ? _a : '';
46
- if (logData.data) {
47
- if (message.length > 0)
48
- message += ' ';
49
- message += logData.data;
50
- }
51
- message += '\n';
52
- fs.appendFile(this._fd, message, { encoding: 'utf-8' }, (err) => {
53
- if (err)
54
- throw err;
55
- });
56
- });
57
- }
58
- transform(logData) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- if (this.opts.transform)
61
- return this.opts.transform(logData);
62
- if (logData.data) {
63
- return Object.assign(Object.assign({}, logData), { data: JSON.stringify(logData.data) });
64
- }
65
- return logData;
66
- });
67
- }
68
- }
69
- exports.FileOutput = FileOutput;
70
- //# sourceMappingURL=file-output.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-output.js","sourceRoot":"","sources":["../../../src/outputs/file-output.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAyB;AAOzB,MAAa,UAAU;IAGrB,YAAsB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;QAC3C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IAEK,GAAG,CAAC,OAAgB;;;YACxB,IAAI,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,CAAC;YACpC,IAAI,OAAO,CAAC,IAAI,EAAE;gBAChB,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;oBAAE,OAAO,IAAI,GAAG,CAAC;gBACvC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;aACzB;YACD,OAAO,IAAI,IAAI,CAAC;YAChB,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,CAAC,GAAiC,EAAE,EAAE;gBAC1F,IAAI,GAAG;oBAAE,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,CAAC;;KACJ;IAEK,SAAS,CAAC,OAAgB;;YAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC7D,IAAI,OAAO,CAAC,IAAI,EAAE;gBAChB,uCACK,OAAO,KACV,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAClC;aACH;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF;AA7BD,gCA6BC"}
@@ -1,11 +0,0 @@
1
- import { LogData, LogOutput } from '../logger-base';
2
- export interface JsonOutputOptions {
3
- transform?: (logData: LogData) => Promise<LogData>;
4
- }
5
- export declare class JsonOutput implements LogOutput {
6
- protected opts: JsonOutputOptions;
7
- constructor(opts: JsonOutputOptions);
8
- log(logData: LogData): Promise<void>;
9
- transform(logData: LogData): Promise<LogData>;
10
- }
11
- //# sourceMappingURL=json-output.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-output.d.ts","sourceRoot":"","sources":["../../../src/outputs/json-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAGlD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;AACD,qBAAa,UAAW,YAAW,SAAS;IAC9B,SAAS,CAAC,IAAI,EAAE,iBAAiB;gBAAvB,IAAI,EAAE,iBAAiB;IAEvC,GAAG,CAAC,OAAO,EAAE,OAAO;IASpB,SAAS,CAAC,OAAO,EAAE,OAAO;CAIjC"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.JsonOutput = void 0;
36
- const process = __importStar(require("process"));
37
- class JsonOutput {
38
- constructor(opts) {
39
- this.opts = opts;
40
- }
41
- log(logData) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- const log = Object.assign({ message: logData.message, level: logData.tags.filter(x => x.name === 'log-level')[0].value }, logData.data);
44
- process.stdout.write(JSON.stringify(log) + '\n');
45
- });
46
- }
47
- transform(logData) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- if (this.opts.transform)
50
- return this.opts.transform(logData);
51
- return logData;
52
- });
53
- }
54
- }
55
- exports.JsonOutput = JsonOutput;
56
- //# sourceMappingURL=json-output.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-output.js","sourceRoot":"","sources":["../../../src/outputs/json-output.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AAKnC,MAAa,UAAU;IACrB,YAAsB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAE3C,GAAG,CAAC,OAAgB;;YACxB,MAAM,GAAG,mBACP,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAC7D,OAAO,CAAC,IAAI,CAChB,CAAA;YACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QACnD,CAAC;KAAA;IAEK,SAAS,CAAC,OAAgB;;YAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC7D,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF;AAhBD,gCAgBC"}
@@ -1,5 +0,0 @@
1
- import { ConsoleOutput } from './console-output';
2
- import { FileOutput } from './file-output';
3
- import { JsonOutput } from './json-output';
4
- export { ConsoleOutput, FileOutput, JsonOutput };
5
- //# sourceMappingURL=outputs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"outputs.d.ts","sourceRoot":"","sources":["../../../src/outputs/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAC,aAAa,EAAE,UAAU,EAAE,UAAU,EAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JsonOutput = exports.FileOutput = exports.ConsoleOutput = void 0;
4
- const console_output_1 = require("./console-output");
5
- Object.defineProperty(exports, "ConsoleOutput", { enumerable: true, get: function () { return console_output_1.ConsoleOutput; } });
6
- const file_output_1 = require("./file-output");
7
- Object.defineProperty(exports, "FileOutput", { enumerable: true, get: function () { return file_output_1.FileOutput; } });
8
- const json_output_1 = require("./json-output");
9
- Object.defineProperty(exports, "JsonOutput", { enumerable: true, get: function () { return json_output_1.JsonOutput; } });
10
- //# sourceMappingURL=outputs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../../src/outputs/outputs.ts"],"names":[],"mappings":";;;AAAA,qDAA+C;AAIvC,8FAJA,8BAAa,OAIA;AAHrB,+CAAyC;AAGlB,2FAHf,wBAAU,OAGe;AAFjC,+CAAyC;AAEN,2FAF3B,wBAAU,OAE2B"}
@@ -1 +0,0 @@
1
- {"type": "commonjs"}