@xylabs/log 2.11.19 → 2.11.20

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.
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var Log_exports = {};
30
+ __export(Log_exports, {
31
+ Log: () => Log
32
+ });
33
+ module.exports = __toCommonJS(Log_exports);
34
+ var import_rollbar = __toESM(require("rollbar"));
35
+ class Log {
36
+ devMode;
37
+ rollbar;
38
+ constructor(config) {
39
+ this.devMode = config.devMode ?? false;
40
+ if (config.rollbarToken) {
41
+ this.rollbar = new import_rollbar.default({
42
+ accessToken: config.rollbarToken,
43
+ captureUncaught: true,
44
+ captureUnhandledRejections: true,
45
+ codeVersion: config.commitHash,
46
+ code_version: config.commitHash,
47
+ payload: {
48
+ client: {
49
+ javascript: {
50
+ code_version: config.commitHash,
51
+ guess_uncaught_frames: true,
52
+ source_map_enabled: true
53
+ }
54
+ },
55
+ codeVersion: config.commitHash,
56
+ code_version: config.commitHash,
57
+ environment: this.devMode ? "development" : "production",
58
+ ...config.payload
59
+ },
60
+ sendConfig: true
61
+ });
62
+ }
63
+ }
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
+ debug(...params) {
66
+ if (this.devMode) {
67
+ console.debug(params);
68
+ }
69
+ }
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ error(...params) {
72
+ console.error(params);
73
+ if (!this.devMode) {
74
+ this.rollbar?.error(params);
75
+ }
76
+ }
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ info(...params) {
79
+ if (this.devMode) {
80
+ console.info(params);
81
+ }
82
+ }
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ log(...params) {
85
+ if (this.devMode) {
86
+ console.log(params);
87
+ }
88
+ }
89
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
90
+ warn(...params) {
91
+ console.warn(params);
92
+ if (!this.devMode) {
93
+ this.rollbar?.warn(params);
94
+ }
95
+ }
96
+ }
97
+ //# sourceMappingURL=Log.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Log.ts"],"sourcesContent":["import Rollbar from 'rollbar'\n\nexport interface LogConfig {\n commitHash?: string\n devMode?: boolean\n payload?: Record<string, unknown>\n rollbarToken?: string\n}\n\nexport class Log {\n private devMode?: boolean\n private rollbar?: Rollbar\n\n constructor(config: LogConfig) {\n this.devMode = config.devMode ?? false\n\n if (config.rollbarToken) {\n this.rollbar = new Rollbar({\n accessToken: config.rollbarToken,\n captureUncaught: true,\n captureUnhandledRejections: true,\n codeVersion: config.commitHash,\n code_version: config.commitHash,\n payload: {\n client: {\n javascript: {\n code_version: config.commitHash,\n guess_uncaught_frames: true,\n source_map_enabled: true,\n },\n },\n codeVersion: config.commitHash,\n code_version: config.commitHash,\n environment: this.devMode ? 'development' : 'production',\n ...config.payload,\n },\n sendConfig: true,\n })\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n debug(...params: any[]) {\n if (this.devMode) {\n console.debug(params)\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error(...params: any[]) {\n console.error(params)\n if (!this.devMode) {\n this.rollbar?.error(params)\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n info(...params: any[]) {\n if (this.devMode) {\n console.info(params)\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n log(...params: any[]) {\n if (this.devMode) {\n console.log(params)\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n warn(...params: any[]) {\n console.warn(params)\n if (!this.devMode) {\n this.rollbar?.warn(params)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AASb,MAAM,IAAI;AAAA,EACP;AAAA,EACA;AAAA,EAER,YAAY,QAAmB;AAC7B,SAAK,UAAU,OAAO,WAAW;AAEjC,QAAI,OAAO,cAAc;AACvB,WAAK,UAAU,IAAI,eAAAA,QAAQ;AAAA,QACzB,aAAa,OAAO;AAAA,QACpB,iBAAiB;AAAA,QACjB,4BAA4B;AAAA,QAC5B,aAAa,OAAO;AAAA,QACpB,cAAc,OAAO;AAAA,QACrB,SAAS;AAAA,UACP,QAAQ;AAAA,YACN,YAAY;AAAA,cACV,cAAc,OAAO;AAAA,cACrB,uBAAuB;AAAA,cACvB,oBAAoB;AAAA,YACtB;AAAA,UACF;AAAA,UACA,aAAa,OAAO;AAAA,UACpB,cAAc,OAAO;AAAA,UACrB,aAAa,KAAK,UAAU,gBAAgB;AAAA,UAC5C,GAAG,OAAO;AAAA,QACZ;AAAA,QACA,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAAA,EACF;AAAA;AAAA,EAGA,SAAS,QAAe;AACtB,QAAI,KAAK,SAAS;AAChB,cAAQ,MAAM,MAAM;AAAA,IACtB;AAAA,EACF;AAAA;AAAA,EAGA,SAAS,QAAe;AACtB,YAAQ,MAAM,MAAM;AACpB,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,SAAS,MAAM,MAAM;AAAA,IAC5B;AAAA,EACF;AAAA;AAAA,EAGA,QAAQ,QAAe;AACrB,QAAI,KAAK,SAAS;AAChB,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AAAA;AAAA,EAGA,OAAO,QAAe;AACpB,QAAI,KAAK,SAAS;AAChB,cAAQ,IAAI,MAAM;AAAA,IACpB;AAAA,EACF;AAAA;AAAA,EAGA,QAAQ,QAAe;AACrB,YAAQ,KAAK,MAAM;AACnB,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,SAAS,KAAK,MAAM;AAAA,IAC3B;AAAA,EACF;AACF;","names":["Rollbar"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./Log"), module.exports);
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './Log'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,kBAAd;","names":[]}
package/package.json CHANGED
@@ -45,8 +45,8 @@
45
45
  "rollbar": "^2.26.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@xylabs/ts-scripts-yarn3": "^3.0.65",
49
- "@xylabs/tsconfig": "^3.0.65",
48
+ "@xylabs/ts-scripts-yarn3": "^3.0.68",
49
+ "@xylabs/tsconfig": "^3.0.68",
50
50
  "rollbar": "^2.26.2",
51
51
  "typescript": "^5.2.2"
52
52
  },
@@ -58,6 +58,6 @@
58
58
  "url": "https://github.com/xylabs/sdk-js.git"
59
59
  },
60
60
  "sideEffects": false,
61
- "version": "2.11.19",
61
+ "version": "2.11.20",
62
62
  "packageManager": "yarn@3.3.1"
63
63
  }