zeddy-logger 1.0.0

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 (60) hide show
  1. package/.prettierrc +14 -0
  2. package/LICENSE +24 -0
  3. package/README.md +115 -0
  4. package/dist/cjs/index.d.ts +4 -0
  5. package/dist/cjs/index.d.ts.map +1 -0
  6. package/dist/cjs/index.js +8 -0
  7. package/dist/cjs/index.js.map +1 -0
  8. package/dist/cjs/logger-base.d.ts +19 -0
  9. package/dist/cjs/logger-base.d.ts.map +1 -0
  10. package/dist/cjs/logger-base.js +32 -0
  11. package/dist/cjs/logger-base.js.map +1 -0
  12. package/dist/cjs/outputs/console-output.d.ts +18 -0
  13. package/dist/cjs/outputs/console-output.d.ts.map +1 -0
  14. package/dist/cjs/outputs/console-output.js +42 -0
  15. package/dist/cjs/outputs/console-output.js.map +1 -0
  16. package/dist/cjs/outputs/file-output.d.ts +13 -0
  17. package/dist/cjs/outputs/file-output.d.ts.map +1 -0
  18. package/dist/cjs/outputs/file-output.js +70 -0
  19. package/dist/cjs/outputs/file-output.js.map +1 -0
  20. package/dist/cjs/outputs/outputs.d.ts +4 -0
  21. package/dist/cjs/outputs/outputs.d.ts.map +1 -0
  22. package/dist/cjs/outputs/outputs.js +8 -0
  23. package/dist/cjs/outputs/outputs.js.map +1 -0
  24. package/dist/cjs/package.json +1 -0
  25. package/dist/cjs/standard-logger.d.ts +27 -0
  26. package/dist/cjs/standard-logger.d.ts.map +1 -0
  27. package/dist/cjs/standard-logger.js +29 -0
  28. package/dist/cjs/standard-logger.js.map +1 -0
  29. package/dist/esm/index.d.ts +4 -0
  30. package/dist/esm/index.d.ts.map +1 -0
  31. package/dist/esm/index.js +4 -0
  32. package/dist/esm/index.js.map +1 -0
  33. package/dist/esm/logger-base.d.ts +19 -0
  34. package/dist/esm/logger-base.d.ts.map +1 -0
  35. package/dist/esm/logger-base.js +18 -0
  36. package/dist/esm/logger-base.js.map +1 -0
  37. package/dist/esm/outputs/console-output.d.ts +18 -0
  38. package/dist/esm/outputs/console-output.d.ts.map +1 -0
  39. package/dist/esm/outputs/console-output.js +26 -0
  40. package/dist/esm/outputs/console-output.js.map +1 -0
  41. package/dist/esm/outputs/file-output.d.ts +13 -0
  42. package/dist/esm/outputs/file-output.d.ts.map +1 -0
  43. package/dist/esm/outputs/file-output.js +34 -0
  44. package/dist/esm/outputs/file-output.js.map +1 -0
  45. package/dist/esm/outputs/outputs.d.ts +4 -0
  46. package/dist/esm/outputs/outputs.d.ts.map +1 -0
  47. package/dist/esm/outputs/outputs.js +4 -0
  48. package/dist/esm/outputs/outputs.js.map +1 -0
  49. package/dist/esm/package.json +1 -0
  50. package/dist/esm/standard-logger.d.ts +27 -0
  51. package/dist/esm/standard-logger.d.ts.map +1 -0
  52. package/dist/esm/standard-logger.js +25 -0
  53. package/dist/esm/standard-logger.js.map +1 -0
  54. package/examples/logger.ts +19 -0
  55. package/examples/main.ts +8 -0
  56. package/logs.txt +7 -0
  57. package/package.json +51 -0
  58. package/tsconfig.base.json +105 -0
  59. package/tsconfig.cjs.json +8 -0
  60. package/tsconfig.esm.json +8 -0
package/.prettierrc ADDED
@@ -0,0 +1,14 @@
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 ADDED
@@ -0,0 +1,24 @@
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>
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Zeddy Logger
2
+ Zeddy Logger is a simple zero-dependency logging library that integrates well with NestJS
3
+ and allows great flexibility.
4
+
5
+ This library closely follows suggestions written in my upcoming book 'Pragmatic Node.js development: Primer in NestJS'.
6
+
7
+
8
+ ### Note
9
+ As this is only a library each app should create their own version of logger, but for simple projects provided
10
+ ```StandardLogger``` is good base class to extend.
11
+
12
+ ### Basic Usage
13
+ Simple example is provided below but more advanced usage for NestJS is in example repo https://github.com/zveljkovic/zeddy-logger-example
14
+ ```typescript
15
+ // logger.ts
16
+ export class Logger extends StandardLogger {
17
+ constructor(filename: string) {
18
+ super([
19
+ new ConsoleOutput({
20
+ tagToConsoleFunctionMap: [
21
+ {tagName: 'log-level', tagValue: 'info', consoleFunction: 'info'},
22
+ {tagName: 'log-level', tagValue: 'debug', consoleFunction: 'debug'},
23
+ ],
24
+ }),
25
+ new FileOutput({
26
+ filename,
27
+ }),
28
+ ]);
29
+ }
30
+ }
31
+
32
+ // some code file
33
+ const logger = new Logger('logs.txt');
34
+ logger.info('test message', {a: 1, b: 2});
35
+ ```
36
+
37
+ ### NestJS Request Based Logger
38
+ If you want to log some additional information from NestJS http request (for example some headers),
39
+ recommended way is to enrich the request object in interceptor.
40
+
41
+ ```typescript
42
+ // app-request.ts
43
+ import {Request} from "express";
44
+
45
+ export type AppRequest = Request & { randomNumberFromInterceptor: number };
46
+ ```
47
+ ```typescript
48
+ // request.interceptor.ts
49
+ import {
50
+ Injectable,
51
+ NestInterceptor,
52
+ ExecutionContext,
53
+ CallHandler,
54
+ } from '@nestjs/common';
55
+ import { Observable } from 'rxjs';
56
+ import { AppRequest } from './app-request';
57
+
58
+ @Injectable()
59
+ export class RequestInterceptor implements NestInterceptor {
60
+ intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
61
+ const request = context.switchToHttp().getRequest<AppRequest>();
62
+ request.randomNumberFromInterceptor = Math.random() * 42;
63
+ return next.handle();
64
+ }
65
+ }
66
+ ```
67
+ With the above we can plug it in NestJS and each request will contain ```randomNumberFromInterceptor```
68
+ but that could also be any value available in request.
69
+
70
+ With that value in request now we can create request scoped logger that will add
71
+ that value to any logs made with it.
72
+
73
+ ```typescript
74
+ // request-based-logger.ts
75
+ import { Inject, Injectable, Scope } from '@nestjs/common';
76
+ import { AppRequest } from './app-request';
77
+ import { REQUEST } from '@nestjs/core';
78
+ import { StandardLogger } from 'zeddy-logger';
79
+ import { ConsoleOutput, FileOutput } from 'zeddy-logger/outputs';
80
+
81
+ @Injectable({ scope: Scope.REQUEST })
82
+ export class RequestBasedLogger extends StandardLogger {
83
+ constructor(@Inject(REQUEST) private request: AppRequest) {
84
+ const outputs = [
85
+ new ConsoleOutput({
86
+ transform: async (logData) => {
87
+ return {
88
+ message: logData.message,
89
+ tags: logData.tags,
90
+ data: {
91
+ ...logData.data,
92
+ randomNumberFromInterceptor: request.randomNumberFromInterceptor,
93
+ },
94
+ };
95
+ },
96
+ tagToConsoleFunctionMap: [
97
+ { tagName: 'log-level', tagValue: 'info', consoleFunction: 'info' },
98
+ { tagName: 'log-level', tagValue: 'debug', consoleFunction: 'debug' },
99
+ ],
100
+ }),
101
+ new FileOutput({
102
+ filename: 'logs.txt',
103
+ }),
104
+ ];
105
+ super(outputs);
106
+ }
107
+ }
108
+ ```
109
+
110
+
111
+ ### Example project
112
+ Example project can be found on [https://github.com/zveljkovic/zeddy-logger-example](https://github.com/zveljkovic/zeddy-logger-example).
113
+ It features even more advanced usage that allows not to react to "level" of the
114
+ log message but also on "type". This is useful if you want to
115
+ treat logs about outbound http requests differently from textual logs.
@@ -0,0 +1,4 @@
1
+ import { LoggerBase } from './logger-base';
2
+ import { StandardLogger } from './standard-logger';
3
+ export { LoggerBase, StandardLogger };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,19 @@
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
@@ -0,0 +1 @@
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;CAU3B"}
@@ -0,0 +1,32 @@
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
+ let finalLogData = logData;
21
+ if (logOutput.transform) {
22
+ // This might return null to prevent sending
23
+ finalLogData = yield logOutput.transform(logData);
24
+ }
25
+ if (!finalLogData)
26
+ yield logOutput.log(finalLogData);
27
+ }
28
+ });
29
+ }
30
+ }
31
+ exports.LoggerBase = LoggerBase;
32
+ //# sourceMappingURL=logger-base.js.map
@@ -0,0 +1 @@
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,YAAY,GAAG,OAAO,CAAC;gBAC3B,IAAI,SAAS,CAAC,SAAS,EAAE;oBACvB,4CAA4C;oBAC5C,YAAY,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;iBACnD;gBACD,IAAI,CAAC,YAAY;oBAAE,MAAM,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;aACtD;QACH,CAAC;KAAA;CACF;AAbD,gCAaC"}
@@ -0,0 +1,18 @@
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
+ private opts;
14
+ constructor(opts: ConsoleOutputOptions);
15
+ log(logData: LogData): Promise<void>;
16
+ transform(logData: LogData): Promise<LogData>;
17
+ }
18
+ //# sourceMappingURL=console-output.d.ts.map
@@ -0,0 +1 @@
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,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAExC,GAAG,CAAC,OAAO,EAAE,OAAO;IAgBpB,SAAS,CAAC,OAAO,EAAE,OAAO;CAIjC"}
@@ -0,0 +1,42 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-output.js","sourceRoot":"","sources":["../../../src/outputs/console-output.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,MAAa,aAAa;IACxB,YAAoB,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE5C,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"}
@@ -0,0 +1,13 @@
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
+ private opts;
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-output.d.ts","sourceRoot":"","sources":["../../../src/outputs/file-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAS,MAAM,gBAAgB,CAAC;AAG1D,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,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;gBAEV,IAAI,EAAE,iBAAiB;IAIrC,GAAG,CAAC,OAAO,EAAE,OAAO;IAYpB,SAAS,CAAC,OAAO,EAAE,OAAO;CAUjC"}
@@ -0,0 +1,70 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-output.js","sourceRoot":"","sources":["../../../src/outputs/file-output.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAyB;AAOzB,MAAa,UAAU;IAGrB,YAAoB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;QACzC,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"}
@@ -0,0 +1,4 @@
1
+ import { ConsoleOutput } from './console-output';
2
+ import { FileOutput } from './file-output';
3
+ export { ConsoleOutput, FileOutput };
4
+ //# sourceMappingURL=outputs.d.ts.map
@@ -0,0 +1 @@
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;AAEzC,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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
+ //# sourceMappingURL=outputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../../src/outputs/outputs.ts"],"names":[],"mappings":";;;AAAA,qDAA+C;AAGvC,8FAHA,8BAAa,OAGA;AAFrB,+CAAyC;AAElB,2FAFf,wBAAU,OAEe"}
@@ -0,0 +1 @@
1
+ {"type": "commonjs"}
@@ -0,0 +1,27 @@
1
+ import { LoggerBase, LogOutput } from './logger-base';
2
+ export declare const LogLevel: {
3
+ info: {
4
+ name: string;
5
+ value: string;
6
+ };
7
+ debug: {
8
+ name: string;
9
+ value: string;
10
+ };
11
+ warning: {
12
+ name: string;
13
+ value: string;
14
+ };
15
+ error: {
16
+ name: string;
17
+ value: string;
18
+ };
19
+ };
20
+ export declare class StandardLogger extends LoggerBase {
21
+ constructor(logOutputs: LogOutput[]);
22
+ info(message: string, data?: any): void;
23
+ debug(message: string, data?: any): void;
24
+ warning(message: string, data?: any): void;
25
+ error(message: string, data?: any): void;
26
+ }
27
+ //# sourceMappingURL=standard-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-logger.d.ts","sourceRoot":"","sources":["../../src/standard-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAEpD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CAKpB,CAAC;AAEF,qBAAa,cAAe,SAAQ,UAAU;gBAChC,UAAU,EAAE,SAAS,EAAE;IAInC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAIhC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAIjC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAInC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;CAGlC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StandardLogger = exports.LogLevel = void 0;
4
+ const logger_base_1 = require("./logger-base");
5
+ exports.LogLevel = {
6
+ info: { name: 'log-level', value: 'info' },
7
+ debug: { name: 'log-level', value: 'debug' },
8
+ warning: { name: 'log-level', value: 'warning' },
9
+ error: { name: 'log-level', value: 'debug' },
10
+ };
11
+ class StandardLogger extends logger_base_1.LoggerBase {
12
+ constructor(logOutputs) {
13
+ super(logOutputs);
14
+ }
15
+ info(message, data) {
16
+ this.log({ tags: [exports.LogLevel.info], data, message });
17
+ }
18
+ debug(message, data) {
19
+ this.log({ tags: [exports.LogLevel.debug], data, message });
20
+ }
21
+ warning(message, data) {
22
+ this.log({ tags: [exports.LogLevel.warning], data, message });
23
+ }
24
+ error(message, data) {
25
+ this.log({ tags: [exports.LogLevel.error], data, message });
26
+ }
27
+ }
28
+ exports.StandardLogger = StandardLogger;
29
+ //# sourceMappingURL=standard-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-logger.js","sourceRoot":"","sources":["../../src/standard-logger.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAEvC,QAAA,QAAQ,GAAG;IACtB,IAAI,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAC;IACxC,KAAK,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAC;IAC1C,OAAO,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAC;IAC9C,KAAK,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAC;CAC3C,CAAC;AAEF,MAAa,cAAe,SAAQ,wBAAU;IAC5C,YAAY,UAAuB;QACjC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,IAAU;QAC9B,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,gBAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,IAAU;QAC/B,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,gBAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,CAAC,OAAe,EAAE,IAAU;QACjC,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,gBAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,IAAU;QAC/B,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,gBAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACpD,CAAC;CACF;AApBD,wCAoBC"}
@@ -0,0 +1,4 @@
1
+ import { LoggerBase } from './logger-base';
2
+ import { StandardLogger } from './standard-logger';
3
+ export { LoggerBase, StandardLogger };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,4 @@
1
+ import { LoggerBase } from './logger-base';
2
+ import { StandardLogger } from './standard-logger';
3
+ export { LoggerBase, StandardLogger };
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","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"}
@@ -0,0 +1,19 @@
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
@@ -0,0 +1 @@
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;CAU3B"}
@@ -0,0 +1,18 @@
1
+ export class LoggerBase {
2
+ logOutputs;
3
+ constructor(logOutputs) {
4
+ this.logOutputs = logOutputs;
5
+ }
6
+ async log(logData) {
7
+ for (const logOutput of this.logOutputs) {
8
+ let finalLogData = logData;
9
+ if (logOutput.transform) {
10
+ // This might return null to prevent sending
11
+ finalLogData = await logOutput.transform(logData);
12
+ }
13
+ if (!finalLogData)
14
+ await logOutput.log(finalLogData);
15
+ }
16
+ }
17
+ }
18
+ //# sourceMappingURL=logger-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-base.js","sourceRoot":"","sources":["../../src/logger-base.ts"],"names":[],"mappings":"AAgBA,MAAM,OAAO,UAAU;IACD;IAApB,YAAoB,UAAuB;QAAvB,eAAU,GAAV,UAAU,CAAa;IAAG,CAAC;IAE/C,KAAK,CAAC,GAAG,CAAC,OAAgB;QACxB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE;YACvC,IAAI,YAAY,GAAG,OAAO,CAAC;YAC3B,IAAI,SAAS,CAAC,SAAS,EAAE;gBACvB,4CAA4C;gBAC5C,YAAY,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACnD;YACD,IAAI,CAAC,YAAY;gBAAE,MAAM,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;SACtD;IACH,CAAC;CACF"}
@@ -0,0 +1,18 @@
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
+ private opts;
14
+ constructor(opts: ConsoleOutputOptions);
15
+ log(logData: LogData): Promise<void>;
16
+ transform(logData: LogData): Promise<LogData>;
17
+ }
18
+ //# sourceMappingURL=console-output.d.ts.map
@@ -0,0 +1 @@
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,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAExC,GAAG,CAAC,OAAO,EAAE,OAAO;IAgBpB,SAAS,CAAC,OAAO,EAAE,OAAO;CAIjC"}
@@ -0,0 +1,26 @@
1
+ export class ConsoleOutput {
2
+ opts;
3
+ constructor(opts) {
4
+ this.opts = opts;
5
+ }
6
+ async log(logData) {
7
+ let logFunction = 'log';
8
+ if (this.opts.tagToConsoleFunctionMap) {
9
+ for (const tag of logData.tags) {
10
+ const consoleFunctionMap = this.opts.tagToConsoleFunctionMap.filter((x) => x.tagName === tag.name && x.tagValue === tag.value);
11
+ if (consoleFunctionMap.length > 0) {
12
+ logFunction = consoleFunctionMap[0].consoleFunction;
13
+ }
14
+ }
15
+ }
16
+ if (logData.data)
17
+ return console[logFunction](logData.message, logData.data);
18
+ return console[logFunction](logData.message);
19
+ }
20
+ async transform(logData) {
21
+ if (this.opts.transform)
22
+ return this.opts.transform(logData);
23
+ return logData;
24
+ }
25
+ }
26
+ //# sourceMappingURL=console-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-output.js","sourceRoot":"","sources":["../../../src/outputs/console-output.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAElD,KAAK,CAAC,GAAG,CAAC,OAAgB;QACxB,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACrC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE;gBAC9B,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;gBACF,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;oBACjC,WAAW,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;iBACrD;aACF;SACF;QACD,IAAI,OAAO,CAAC,IAAI;YAAE,OAAO,OAAO,CAAC,WAAkC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACpG,OAAO,OAAO,CAAC,WAAkC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAgB;QAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC7D,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,13 @@
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
+ private opts;
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-output.d.ts","sourceRoot":"","sources":["../../../src/outputs/file-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAS,MAAM,gBAAgB,CAAC;AAG1D,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,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;gBAEV,IAAI,EAAE,iBAAiB;IAIrC,GAAG,CAAC,OAAO,EAAE,OAAO;IAYpB,SAAS,CAAC,OAAO,EAAE,OAAO;CAUjC"}
@@ -0,0 +1,34 @@
1
+ import * as fs from 'fs';
2
+ export class FileOutput {
3
+ opts;
4
+ _fd;
5
+ constructor(opts) {
6
+ this.opts = opts;
7
+ this._fd = fs.openSync(opts.filename, 'a');
8
+ }
9
+ async log(logData) {
10
+ let message = logData.message ?? '';
11
+ if (logData.data) {
12
+ if (message.length > 0)
13
+ message += ' ';
14
+ message += logData.data;
15
+ }
16
+ message += '\n';
17
+ fs.appendFile(this._fd, message, { encoding: 'utf-8' }, (err) => {
18
+ if (err)
19
+ throw err;
20
+ });
21
+ }
22
+ async transform(logData) {
23
+ if (this.opts.transform)
24
+ return this.opts.transform(logData);
25
+ if (logData.data) {
26
+ return {
27
+ ...logData,
28
+ data: JSON.stringify(logData.data),
29
+ };
30
+ }
31
+ return logData;
32
+ }
33
+ }
34
+ //# sourceMappingURL=file-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-output.js","sourceRoot":"","sources":["../../../src/outputs/file-output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAOzB,MAAM,OAAO,UAAU;IAGD;IAFH,GAAG,CAAU;IAE9B,YAAoB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;QACzC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAAgB;QACxB,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QACpC,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,IAAI,GAAG,CAAC;YACvC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;SACzB;QACD,OAAO,IAAI,IAAI,CAAC;QAChB,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,CAAC,GAAiC,EAAE,EAAE;YAC1F,IAAI,GAAG;gBAAE,MAAM,GAAG,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAgB;QAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC7D,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,OAAO;gBACL,GAAG,OAAO;gBACV,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;aACnC,CAAC;SACH;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import { ConsoleOutput } from './console-output';
2
+ import { FileOutput } from './file-output';
3
+ export { ConsoleOutput, FileOutput };
4
+ //# sourceMappingURL=outputs.d.ts.map
@@ -0,0 +1 @@
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;AAEzC,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ConsoleOutput } from './console-output';
2
+ import { FileOutput } from './file-output';
3
+ export { ConsoleOutput, FileOutput };
4
+ //# sourceMappingURL=outputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputs.js","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;AAEzC,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"type": "module"}
@@ -0,0 +1,27 @@
1
+ import { LoggerBase, LogOutput } from './logger-base';
2
+ export declare const LogLevel: {
3
+ info: {
4
+ name: string;
5
+ value: string;
6
+ };
7
+ debug: {
8
+ name: string;
9
+ value: string;
10
+ };
11
+ warning: {
12
+ name: string;
13
+ value: string;
14
+ };
15
+ error: {
16
+ name: string;
17
+ value: string;
18
+ };
19
+ };
20
+ export declare class StandardLogger extends LoggerBase {
21
+ constructor(logOutputs: LogOutput[]);
22
+ info(message: string, data?: any): void;
23
+ debug(message: string, data?: any): void;
24
+ warning(message: string, data?: any): void;
25
+ error(message: string, data?: any): void;
26
+ }
27
+ //# sourceMappingURL=standard-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-logger.d.ts","sourceRoot":"","sources":["../../src/standard-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAEpD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CAKpB,CAAC;AAEF,qBAAa,cAAe,SAAQ,UAAU;gBAChC,UAAU,EAAE,SAAS,EAAE;IAInC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAIhC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAIjC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAInC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;CAGlC"}
@@ -0,0 +1,25 @@
1
+ import { LoggerBase } from './logger-base';
2
+ export const LogLevel = {
3
+ info: { name: 'log-level', value: 'info' },
4
+ debug: { name: 'log-level', value: 'debug' },
5
+ warning: { name: 'log-level', value: 'warning' },
6
+ error: { name: 'log-level', value: 'debug' },
7
+ };
8
+ export class StandardLogger extends LoggerBase {
9
+ constructor(logOutputs) {
10
+ super(logOutputs);
11
+ }
12
+ info(message, data) {
13
+ this.log({ tags: [LogLevel.info], data, message });
14
+ }
15
+ debug(message, data) {
16
+ this.log({ tags: [LogLevel.debug], data, message });
17
+ }
18
+ warning(message, data) {
19
+ this.log({ tags: [LogLevel.warning], data, message });
20
+ }
21
+ error(message, data) {
22
+ this.log({ tags: [LogLevel.error], data, message });
23
+ }
24
+ }
25
+ //# sourceMappingURL=standard-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-logger.js","sourceRoot":"","sources":["../../src/standard-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,eAAe,CAAC;AAEpD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAC;IACxC,KAAK,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAC;IAC1C,OAAO,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAC;IAC9C,KAAK,EAAE,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAC;CAC3C,CAAC;AAEF,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,YAAY,UAAuB;QACjC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,IAAU;QAC9B,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,IAAU;QAC/B,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,CAAC,OAAe,EAAE,IAAU;QACjC,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,IAAU;QAC/B,IAAI,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import {StandardLogger} from '../src';
2
+ import {ConsoleOutput} from '../src/outputs/outputs';
3
+ import {FileOutput} from '../src/outputs/outputs';
4
+
5
+ export class Logger extends StandardLogger {
6
+ constructor(filename: string) {
7
+ super([
8
+ new ConsoleOutput({
9
+ tagToConsoleFunctionMap: [
10
+ {tagName: 'log-level', tagValue: 'info', consoleFunction: 'info'},
11
+ {tagName: 'log-level', tagValue: 'debug', consoleFunction: 'debug'},
12
+ ],
13
+ }),
14
+ new FileOutput({
15
+ filename,
16
+ }),
17
+ ]);
18
+ }
19
+ }
@@ -0,0 +1,8 @@
1
+ import {Logger} from './logger';
2
+
3
+ const main = async () => {
4
+ const logger = new Logger('logs.txt');
5
+ logger.info('test message', {a: 1, b: 2});
6
+ };
7
+
8
+ main();
package/logs.txt ADDED
@@ -0,0 +1,7 @@
1
+ test message {"a":1,"b":2}
2
+ test message {"a":1,"b":2}
3
+ test message {"a":1,"b":2}
4
+ test message {"a":1,"b":2}
5
+ test message {"a":1,"b":2}
6
+ test message {"a":1,"b":2}
7
+ test message {"a":1,"b":2}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "zeddy-logger",
3
+ "version": "1.0.0",
4
+ "description": "Logging library for Node",
5
+ "author": "Zlatibor Veljković",
6
+ "license": "The Unlicense",
7
+ "repository": "https://github.com/zveljkovic/zeddy-logging",
8
+ "homepage": "https://github.com/zveljkovic/zeddy-logging",
9
+ "keywords": [
10
+ "logging",
11
+ "zeddy"
12
+ ],
13
+ "scripts": {
14
+ "example": "node-dev --respawn examples\\main.ts",
15
+ "test": "echo \"Error: no test specified\" && exit 1",
16
+ "build": "tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json & node fixup.js",
17
+ "publish:local": "npm pack --pack-destination",
18
+ "prepare": "npm run build",
19
+ "prepublishOnly": "",
20
+ "preversion": "",
21
+ "version": "git add -A src",
22
+ "postversion": "git push && git push --tags"
23
+ },
24
+ "main": "dist/cjs/index.js",
25
+ "module": "dist/esm/index.js",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/esm/index.d.ts",
29
+ "import": "./dist/esm/index.js",
30
+ "require": "./dist/cjs/index.js",
31
+ "default": "./dist/esm/index.js"
32
+ },
33
+ "./outputs": {
34
+ "types": "./dist/esm/outputs/outputs.d.ts",
35
+ "import": "./dist/esm/outputs/outputs.js",
36
+ "require": "./dist/cjs/outputs/outputs.js",
37
+ "default": "./dist/esm/outputs/outputs.js"
38
+ }
39
+ },
40
+ "typesVersions": {
41
+ "*": {
42
+ "outputs": ["./dist/esm/outputs/outputs"]
43
+ }
44
+ },
45
+ "devDependencies": {
46
+ "node-dev": "^7.4.3",
47
+ "prettier": "^2.7.1",
48
+ "ts-node": "^10.9.1",
49
+ "typescript": "^4.8.3"
50
+ }
51
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ "lib": ["es2015"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
+
27
+ /* Modules */
28
+ // "module": "commonjs", /* Specify what module code is generated. */
29
+ // "rootDir": "./", /* Specify the root folder within your source files. */
30
+ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
31
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "resolveJsonModule": true, /* Enable importing .json files. */
39
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
40
+
41
+ /* JavaScript Support */
42
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
43
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
44
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
45
+
46
+ /* Emit */
47
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
50
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
52
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
53
+ // "removeComments": true, /* Disable emitting comments. */
54
+ // "noEmit": true, /* Disable emitting files from a compilation. */
55
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
56
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
57
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
58
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
59
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
61
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
62
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
63
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
64
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
65
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
66
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
67
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
68
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
69
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
70
+
71
+ /* Interop Constraints */
72
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
73
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
74
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
75
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
76
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
77
+
78
+ /* Type Checking */
79
+ "strict": true, /* Enable all strict type-checking options. */
80
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
81
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
82
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
83
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
84
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
85
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
86
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
87
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
88
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
89
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
90
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
91
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
92
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
93
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
94
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
95
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
96
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
97
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
98
+
99
+ /* Completeness */
100
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
101
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
102
+ },
103
+ "exclude": ["node_modules", "dist"],
104
+ "include": ["src"]
105
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "outDir": "dist/cjs",
6
+ "target": "es2015"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "esnext",
5
+ "outDir": "dist/esm",
6
+ "target": "esnext"
7
+ }
8
+ }