@dynamic-labs/logger 2.1.0-alpha.19 → 2.1.0-alpha.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.
- package/CHANGELOG.md +14 -0
- package/package.json +4 -1
- package/src/index.cjs +16 -12
- package/src/index.d.ts +4 -1
- package/src/index.js +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.19...v2.1.0-alpha.20) (2024-05-21)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* adds client.networks module ([#5650](https://github.com/dynamic-labs/DynamicAuth/issues/5650)) ([70f7fe5](https://github.com/dynamic-labs/DynamicAuth/commit/70f7fe5f437756c51e787ac12183be0a23c51b89))
|
|
8
|
+
* user fields supports custom fields ([#5639](https://github.com/dynamic-labs/DynamicAuth/issues/5639)) ([8eb5788](https://github.com/dynamic-labs/DynamicAuth/commit/8eb5788fc3e1286929f5949ecb57736b21b13fb5))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add webcredentials to expo ([#5640](https://github.com/dynamic-labs/DynamicAuth/issues/5640)) ([9026fbf](https://github.com/dynamic-labs/DynamicAuth/commit/9026fbf0108537e884588f3adcdb9f0db04a159b))
|
|
14
|
+
* init ethers web3provider without a network if selected network is unsupported ([#5651](https://github.com/dynamic-labs/DynamicAuth/issues/5651)) ([e82040f](https://github.com/dynamic-labs/DynamicAuth/commit/e82040f424b17a70fac4400ab5b85a0dc6c0e35a))
|
|
15
|
+
|
|
2
16
|
## [2.1.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.18...v2.1.0-alpha.19) (2024-05-17)
|
|
3
17
|
|
|
4
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/logger",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.20",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -24,5 +24,8 @@
|
|
|
24
24
|
"require": "./src/index.cjs"
|
|
25
25
|
},
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"eventemitter3": "5.0.1"
|
|
27
30
|
}
|
|
28
31
|
}
|
package/src/index.cjs
CHANGED
|
@@ -4,10 +4,15 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
7
|
+
var EventEmitter = require('eventemitter3');
|
|
7
8
|
var types = require('./types.cjs');
|
|
8
9
|
var deepMerge = require('./utils/deepMerge.cjs');
|
|
9
10
|
var processArgs = require('./utils/processArgs.cjs');
|
|
10
11
|
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
|
|
15
|
+
|
|
11
16
|
/* eslint-disable @typescript-eslint/no-explicit-any, no-console */
|
|
12
17
|
const IGNORE_MESSAGES = ['Failed to send logs to server'];
|
|
13
18
|
const messageQueue = [];
|
|
@@ -35,12 +40,6 @@ class Logger {
|
|
|
35
40
|
Logger.globalKeys.environmentId = environmentId;
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
|
-
static setGlobalKey(key, value) {
|
|
39
|
-
if (!Logger.globalKeys) {
|
|
40
|
-
Logger.globalKeys = {};
|
|
41
|
-
}
|
|
42
|
-
Logger.globalKeys[key] = value;
|
|
43
|
-
}
|
|
44
43
|
setMetaData(key, value) {
|
|
45
44
|
if (!this.meta) {
|
|
46
45
|
this.meta = {};
|
|
@@ -117,6 +116,7 @@ class Logger {
|
|
|
117
116
|
var _a, _b;
|
|
118
117
|
const messages = [];
|
|
119
118
|
messageQueue.forEach((msg) => {
|
|
119
|
+
var _a, _b, _c, _d, _e;
|
|
120
120
|
const body = {};
|
|
121
121
|
const { objectArgs, remainingArgs } = processArgs.processArgs(msg);
|
|
122
122
|
Object.assign(body, ...objectArgs);
|
|
@@ -125,11 +125,11 @@ class Logger {
|
|
|
125
125
|
message: [msg.message, ...remainingArgs].join(' '),
|
|
126
126
|
meta: this.meta,
|
|
127
127
|
url: {
|
|
128
|
-
hostname: window.location.hostname,
|
|
129
|
-
origin: window.location.origin,
|
|
130
|
-
pathname: window.location.pathname,
|
|
131
|
-
port: window.location.port,
|
|
132
|
-
protocol: window.location.protocol,
|
|
128
|
+
hostname: (_a = window.location) === null || _a === void 0 ? void 0 : _a.hostname,
|
|
129
|
+
origin: (_b = window.location) === null || _b === void 0 ? void 0 : _b.origin,
|
|
130
|
+
pathname: (_c = window.location) === null || _c === void 0 ? void 0 : _c.pathname,
|
|
131
|
+
port: (_d = window.location) === null || _d === void 0 ? void 0 : _d.port,
|
|
132
|
+
protocol: (_e = window.location) === null || _e === void 0 ? void 0 : _e.protocol,
|
|
133
133
|
},
|
|
134
134
|
});
|
|
135
135
|
messages.push(body);
|
|
@@ -184,10 +184,14 @@ class Logger {
|
|
|
184
184
|
this.log(types.LogLevel.WARN, message, ...args);
|
|
185
185
|
}
|
|
186
186
|
error(message, ...args) {
|
|
187
|
+
Logger.events.emit('error', message);
|
|
187
188
|
this.log(types.LogLevel.ERROR, message, ...args);
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
|
-
Logger.globalKeys = {
|
|
191
|
+
Logger.globalKeys = {
|
|
192
|
+
emitErrors: true,
|
|
193
|
+
};
|
|
194
|
+
Logger.events = new EventEmitter__default["default"]();
|
|
191
195
|
|
|
192
196
|
Object.defineProperty(exports, 'LogLevel', {
|
|
193
197
|
enumerable: true,
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
1
2
|
import { LogLevel, Message } from './types';
|
|
2
3
|
export { LogLevel } from './types';
|
|
3
4
|
export declare class Logger {
|
|
@@ -8,7 +9,9 @@ export declare class Logger {
|
|
|
8
9
|
constructor(name: string | string[], level?: LogLevel);
|
|
9
10
|
static setEmitErrors(emit?: boolean): void;
|
|
10
11
|
static setEnvironmentId(environmentId?: string): void;
|
|
11
|
-
static
|
|
12
|
+
static events: EventEmitter<{
|
|
13
|
+
error: Message;
|
|
14
|
+
}, any>;
|
|
12
15
|
setMetaData(key: string, value: any): void;
|
|
13
16
|
private getNameArray;
|
|
14
17
|
createLogger(name: string | string[], level?: LogLevel): Logger;
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
3
|
+
import EventEmitter from 'eventemitter3';
|
|
3
4
|
import { LogLevel } from './types.js';
|
|
4
5
|
export { LogLevel } from './types.js';
|
|
5
6
|
import { deepMerge } from './utils/deepMerge.js';
|
|
@@ -32,12 +33,6 @@ class Logger {
|
|
|
32
33
|
Logger.globalKeys.environmentId = environmentId;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
static setGlobalKey(key, value) {
|
|
36
|
-
if (!Logger.globalKeys) {
|
|
37
|
-
Logger.globalKeys = {};
|
|
38
|
-
}
|
|
39
|
-
Logger.globalKeys[key] = value;
|
|
40
|
-
}
|
|
41
36
|
setMetaData(key, value) {
|
|
42
37
|
if (!this.meta) {
|
|
43
38
|
this.meta = {};
|
|
@@ -114,6 +109,7 @@ class Logger {
|
|
|
114
109
|
var _a, _b;
|
|
115
110
|
const messages = [];
|
|
116
111
|
messageQueue.forEach((msg) => {
|
|
112
|
+
var _a, _b, _c, _d, _e;
|
|
117
113
|
const body = {};
|
|
118
114
|
const { objectArgs, remainingArgs } = processArgs(msg);
|
|
119
115
|
Object.assign(body, ...objectArgs);
|
|
@@ -122,11 +118,11 @@ class Logger {
|
|
|
122
118
|
message: [msg.message, ...remainingArgs].join(' '),
|
|
123
119
|
meta: this.meta,
|
|
124
120
|
url: {
|
|
125
|
-
hostname: window.location.hostname,
|
|
126
|
-
origin: window.location.origin,
|
|
127
|
-
pathname: window.location.pathname,
|
|
128
|
-
port: window.location.port,
|
|
129
|
-
protocol: window.location.protocol,
|
|
121
|
+
hostname: (_a = window.location) === null || _a === void 0 ? void 0 : _a.hostname,
|
|
122
|
+
origin: (_b = window.location) === null || _b === void 0 ? void 0 : _b.origin,
|
|
123
|
+
pathname: (_c = window.location) === null || _c === void 0 ? void 0 : _c.pathname,
|
|
124
|
+
port: (_d = window.location) === null || _d === void 0 ? void 0 : _d.port,
|
|
125
|
+
protocol: (_e = window.location) === null || _e === void 0 ? void 0 : _e.protocol,
|
|
130
126
|
},
|
|
131
127
|
});
|
|
132
128
|
messages.push(body);
|
|
@@ -181,9 +177,13 @@ class Logger {
|
|
|
181
177
|
this.log(LogLevel.WARN, message, ...args);
|
|
182
178
|
}
|
|
183
179
|
error(message, ...args) {
|
|
180
|
+
Logger.events.emit('error', message);
|
|
184
181
|
this.log(LogLevel.ERROR, message, ...args);
|
|
185
182
|
}
|
|
186
183
|
}
|
|
187
|
-
Logger.globalKeys = {
|
|
184
|
+
Logger.globalKeys = {
|
|
185
|
+
emitErrors: true,
|
|
186
|
+
};
|
|
187
|
+
Logger.events = new EventEmitter();
|
|
188
188
|
|
|
189
189
|
export { Logger };
|