@dynamic-labs/logger 0.18.0 → 0.18.100-viem.1

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 CHANGED
@@ -1,28 +1,4 @@
1
1
 
2
- ## [0.18.0](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-beta.32...v0.18.0) (2023-08-13)
3
-
4
-
5
- ### Features
6
-
7
- * add in OKX wallet integration ([#2871](https://github.com/dynamic-labs/DynamicAuth/issues/2871)) ([#2927](https://github.com/dynamic-labs/DynamicAuth/issues/2927)) ([f6d06bc](https://github.com/dynamic-labs/DynamicAuth/commit/f6d06bc75ee0e53c9d972f5fab1f4de11818bd82))
8
- * update wallet locked view ([#2923](https://github.com/dynamic-labs/DynamicAuth/issues/2923)) ([3cc03ee](https://github.com/dynamic-labs/DynamicAuth/commit/3cc03ee5913434d99386fc89d4d26d5d3fb3ca19))
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * account already exist message not displaying automatically ([#2896](https://github.com/dynamic-labs/DynamicAuth/issues/2896)) ([#2906](https://github.com/dynamic-labs/DynamicAuth/issues/2906)) ([5e7478a](https://github.com/dynamic-labs/DynamicAuth/commit/5e7478acd864451a7cf7e8e62845cca7ef5439c6))
14
- * don't let user update email if it's tied to an embedded wallet ([#2903](https://github.com/dynamic-labs/DynamicAuth/issues/2903)) ([33c52b5](https://github.com/dynamic-labs/DynamicAuth/commit/33c52b50a880a34b4161a700b8b1805c9b01527d)), closes [#2883](https://github.com/dynamic-labs/DynamicAuth/issues/2883)
15
- * **GVTY-195:** issues with mergeUserAccountsView ([#2945](https://github.com/dynamic-labs/DynamicAuth/issues/2945)) ([2c6265e](https://github.com/dynamic-labs/DynamicAuth/commit/2c6265e3e709edb9ff1af6e6c139b85418e46d76))
16
- * **Magic:** improve gas estimate for transactions ([#2947](https://github.com/dynamic-labs/DynamicAuth/issues/2947)) ([ad35a72](https://github.com/dynamic-labs/DynamicAuth/commit/ad35a722df6abd54b98ea491661ff4ec3e602621))
17
- * missing enable isVerificationInProgress ([#2926](https://github.com/dynamic-labs/DynamicAuth/issues/2926)) ([98f54fd](https://github.com/dynamic-labs/DynamicAuth/commit/98f54fd1345713dfaf0ef837502dfaca3709d633))
18
- * **networks:** merge custom network after API networks ([#2949](https://github.com/dynamic-labs/DynamicAuth/issues/2949)) ([ab22303](https://github.com/dynamic-labs/DynamicAuth/commit/ab22303294123c2a914a65f0d2c15481740647bb))
19
- * onBeforeConnectSuccessConfirmation is being called multiple time ([#2965](https://github.com/dynamic-labs/DynamicAuth/issues/2965)) ([a276968](https://github.com/dynamic-labs/DynamicAuth/commit/a2769689bc82350dfb8123e1fe8a4e92a60b262c))
20
- * **QNTM-249:** broken email update when user is authenticated ([#2932](https://github.com/dynamic-labs/DynamicAuth/issues/2932)) ([db33ba1](https://github.com/dynamic-labs/DynamicAuth/commit/db33ba14c317469958ce314a3822b706e20b07d0))
21
- * reformat social sign-in text ([#2956](https://github.com/dynamic-labs/DynamicAuth/issues/2956)) ([#2961](https://github.com/dynamic-labs/DynamicAuth/issues/2961)) ([f8d2222](https://github.com/dynamic-labs/DynamicAuth/commit/f8d2222d102f5335f95ec917cbb63bf9b55eff0b))
22
- * **transaction:** improve gas estimate in transaction confirmation ([#2938](https://github.com/dynamic-labs/DynamicAuth/issues/2938)) ([02d0f46](https://github.com/dynamic-labs/DynamicAuth/commit/02d0f46127e94e83b4decbaaf6a45dbae135c89d))
23
- * useSyncPrimaryWallet overrides views with "wallet-locked-view" ([#2921](https://github.com/dynamic-labs/DynamicAuth/issues/2921)) ([aa8c369](https://github.com/dynamic-labs/DynamicAuth/commit/aa8c369d2a713eb57ecc99b16a6b62d465789370))
24
- * **wallet-list:** update key to distinguish wallet and wallet group ([#2922](https://github.com/dynamic-labs/DynamicAuth/issues/2922)) ([f40c07c](https://github.com/dynamic-labs/DynamicAuth/commit/f40c07c65915775e99a1dbb8d07bb23824a92915)), closes [#2909](https://github.com/dynamic-labs/DynamicAuth/issues/2909)
25
-
26
2
  ## [0.18.0-beta.32](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-beta.31...v0.18.0-beta.32) (2023-08-09)
27
3
 
28
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/logger",
3
- "version": "0.18.0",
3
+ "version": "0.18.100-viem.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
package/src/index.cjs CHANGED
@@ -2,85 +2,85 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /* eslint-disable @typescript-eslint/no-explicit-any, no-console */
6
- exports.LogLevel = void 0;
7
- (function (LogLevel) {
8
- LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
9
- LogLevel[LogLevel["INFO"] = 1] = "INFO";
10
- LogLevel[LogLevel["WARN"] = 2] = "WARN";
11
- LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
12
- LogLevel[LogLevel["MUTE"] = 99] = "MUTE";
13
- })(exports.LogLevel || (exports.LogLevel = {}));
14
- class Logger {
15
- constructor(name, level) {
16
- this.name = name;
17
- if (level === undefined && process.env['NODE_ENV'] !== 'production') {
18
- this.level = exports.LogLevel.DEBUG;
19
- }
20
- else if (level === undefined) {
21
- this.level = exports.LogLevel.WARN;
22
- }
23
- else {
24
- this.level = level;
25
- }
26
- }
27
- get logLevel() {
28
- return exports.LogLevel[this.level];
29
- }
30
- setLogLevel(level) {
31
- if (level in exports.LogLevel && typeof level === 'string') {
32
- this.level = exports.LogLevel[level];
33
- }
34
- else if (level in exports.LogLevel && typeof level === 'number') {
35
- this.level = level;
36
- }
37
- else {
38
- throw new Error(`Invalid log level: ${level}`);
39
- }
40
- }
41
- formatMessage(level, message) {
42
- if (message instanceof Error) {
43
- message = message.stack;
44
- }
45
- else if (
46
- // Handle Error-Like Objects
47
- message instanceof Object &&
48
- Object.prototype.hasOwnProperty.call(message, 'stack')) {
49
- message = message.stack;
50
- }
51
- else if (message instanceof Object) {
52
- message = JSON.stringify(message);
53
- }
54
- return `[${this.name}] [${exports.LogLevel[level]}]: ${message}`;
55
- }
56
- log(level, message, ...args) {
57
- if (level < this.level || level === exports.LogLevel.MUTE) {
58
- return;
59
- }
60
- const fmtMsg = this.formatMessage(level, message);
61
- switch (level) {
62
- case exports.LogLevel.WARN:
63
- console.warn(fmtMsg, ...args);
64
- break;
65
- case exports.LogLevel.ERROR:
66
- console.error(fmtMsg, ...args);
67
- break;
68
- default:
69
- console.log(fmtMsg, ...args);
70
- }
71
- }
72
- debug(message, ...args) {
73
- this.log(exports.LogLevel.DEBUG, message, ...args);
74
- }
75
- info(message, ...args) {
76
- this.log(exports.LogLevel.INFO, message, ...args);
77
- }
78
- warn(message, ...args) {
79
- this.log(exports.LogLevel.WARN, message, ...args);
80
- }
81
- error(message, ...args) {
82
- this.log(exports.LogLevel.ERROR, message, ...args);
83
- }
5
+ /* eslint-disable @typescript-eslint/no-explicit-any, no-console */
6
+ exports.LogLevel = void 0;
7
+ (function (LogLevel) {
8
+ LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
9
+ LogLevel[LogLevel["INFO"] = 1] = "INFO";
10
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
11
+ LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
12
+ LogLevel[LogLevel["MUTE"] = 99] = "MUTE";
13
+ })(exports.LogLevel || (exports.LogLevel = {}));
14
+ class Logger {
15
+ constructor(name, level) {
16
+ this.name = name;
17
+ if (level === undefined && process.env['NODE_ENV'] !== 'production') {
18
+ this.level = exports.LogLevel.DEBUG;
19
+ }
20
+ else if (level === undefined) {
21
+ this.level = exports.LogLevel.WARN;
22
+ }
23
+ else {
24
+ this.level = level;
25
+ }
26
+ }
27
+ get logLevel() {
28
+ return exports.LogLevel[this.level];
29
+ }
30
+ setLogLevel(level) {
31
+ if (level in exports.LogLevel && typeof level === 'string') {
32
+ this.level = exports.LogLevel[level];
33
+ }
34
+ else if (level in exports.LogLevel && typeof level === 'number') {
35
+ this.level = level;
36
+ }
37
+ else {
38
+ throw new Error(`Invalid log level: ${level}`);
39
+ }
40
+ }
41
+ formatMessage(level, message) {
42
+ if (message instanceof Error) {
43
+ message = message.stack;
44
+ }
45
+ else if (
46
+ // Handle Error-Like Objects
47
+ message instanceof Object &&
48
+ Object.prototype.hasOwnProperty.call(message, 'stack')) {
49
+ message = message.stack;
50
+ }
51
+ else if (message instanceof Object) {
52
+ message = JSON.stringify(message);
53
+ }
54
+ return `[${this.name}] [${exports.LogLevel[level]}]: ${message}`;
55
+ }
56
+ log(level, message, ...args) {
57
+ if (level < this.level || level === exports.LogLevel.MUTE) {
58
+ return;
59
+ }
60
+ const fmtMsg = this.formatMessage(level, message);
61
+ switch (level) {
62
+ case exports.LogLevel.WARN:
63
+ console.warn(fmtMsg, ...args);
64
+ break;
65
+ case exports.LogLevel.ERROR:
66
+ console.error(fmtMsg, ...args);
67
+ break;
68
+ default:
69
+ console.log(fmtMsg, ...args);
70
+ }
71
+ }
72
+ debug(message, ...args) {
73
+ this.log(exports.LogLevel.DEBUG, message, ...args);
74
+ }
75
+ info(message, ...args) {
76
+ this.log(exports.LogLevel.INFO, message, ...args);
77
+ }
78
+ warn(message, ...args) {
79
+ this.log(exports.LogLevel.WARN, message, ...args);
80
+ }
81
+ error(message, ...args) {
82
+ this.log(exports.LogLevel.ERROR, message, ...args);
83
+ }
84
84
  }
85
85
 
86
86
  exports.Logger = Logger;
package/src/index.d.ts CHANGED
@@ -1,22 +1,22 @@
1
- export declare enum LogLevel {
2
- DEBUG = 0,
3
- INFO = 1,
4
- WARN = 2,
5
- ERROR = 3,
6
- MUTE = 99
7
- }
8
- type Message = string | Error | unknown;
9
- export declare class Logger {
10
- private name;
11
- private level;
12
- constructor(name: string, level?: LogLevel);
13
- get logLevel(): string;
14
- setLogLevel(level: LogLevel | keyof typeof LogLevel): void;
15
- private formatMessage;
16
- log(level: LogLevel, message: Message, ...args: any[]): void;
17
- debug(message: Message, ...args: any[]): void;
18
- info(message: Message, ...args: any[]): void;
19
- warn(message: Message, ...args: any[]): void;
20
- error(message: Message, ...args: any[]): void;
21
- }
22
- export {};
1
+ export declare enum LogLevel {
2
+ DEBUG = 0,
3
+ INFO = 1,
4
+ WARN = 2,
5
+ ERROR = 3,
6
+ MUTE = 99
7
+ }
8
+ type Message = string | Error | unknown;
9
+ export declare class Logger {
10
+ private name;
11
+ private level;
12
+ constructor(name: string, level?: LogLevel);
13
+ get logLevel(): string;
14
+ setLogLevel(level: LogLevel | keyof typeof LogLevel): void;
15
+ private formatMessage;
16
+ log(level: LogLevel, message: Message, ...args: any[]): void;
17
+ debug(message: Message, ...args: any[]): void;
18
+ info(message: Message, ...args: any[]): void;
19
+ warn(message: Message, ...args: any[]): void;
20
+ error(message: Message, ...args: any[]): void;
21
+ }
22
+ export {};
package/src/index.js CHANGED
@@ -1,82 +1,82 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, no-console */
2
- var LogLevel;
3
- (function (LogLevel) {
4
- LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
5
- LogLevel[LogLevel["INFO"] = 1] = "INFO";
6
- LogLevel[LogLevel["WARN"] = 2] = "WARN";
7
- LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
8
- LogLevel[LogLevel["MUTE"] = 99] = "MUTE";
9
- })(LogLevel || (LogLevel = {}));
10
- class Logger {
11
- constructor(name, level) {
12
- this.name = name;
13
- if (level === undefined && process.env['NODE_ENV'] !== 'production') {
14
- this.level = LogLevel.DEBUG;
15
- }
16
- else if (level === undefined) {
17
- this.level = LogLevel.WARN;
18
- }
19
- else {
20
- this.level = level;
21
- }
22
- }
23
- get logLevel() {
24
- return LogLevel[this.level];
25
- }
26
- setLogLevel(level) {
27
- if (level in LogLevel && typeof level === 'string') {
28
- this.level = LogLevel[level];
29
- }
30
- else if (level in LogLevel && typeof level === 'number') {
31
- this.level = level;
32
- }
33
- else {
34
- throw new Error(`Invalid log level: ${level}`);
35
- }
36
- }
37
- formatMessage(level, message) {
38
- if (message instanceof Error) {
39
- message = message.stack;
40
- }
41
- else if (
42
- // Handle Error-Like Objects
43
- message instanceof Object &&
44
- Object.prototype.hasOwnProperty.call(message, 'stack')) {
45
- message = message.stack;
46
- }
47
- else if (message instanceof Object) {
48
- message = JSON.stringify(message);
49
- }
50
- return `[${this.name}] [${LogLevel[level]}]: ${message}`;
51
- }
52
- log(level, message, ...args) {
53
- if (level < this.level || level === LogLevel.MUTE) {
54
- return;
55
- }
56
- const fmtMsg = this.formatMessage(level, message);
57
- switch (level) {
58
- case LogLevel.WARN:
59
- console.warn(fmtMsg, ...args);
60
- break;
61
- case LogLevel.ERROR:
62
- console.error(fmtMsg, ...args);
63
- break;
64
- default:
65
- console.log(fmtMsg, ...args);
66
- }
67
- }
68
- debug(message, ...args) {
69
- this.log(LogLevel.DEBUG, message, ...args);
70
- }
71
- info(message, ...args) {
72
- this.log(LogLevel.INFO, message, ...args);
73
- }
74
- warn(message, ...args) {
75
- this.log(LogLevel.WARN, message, ...args);
76
- }
77
- error(message, ...args) {
78
- this.log(LogLevel.ERROR, message, ...args);
79
- }
1
+ /* eslint-disable @typescript-eslint/no-explicit-any, no-console */
2
+ var LogLevel;
3
+ (function (LogLevel) {
4
+ LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
5
+ LogLevel[LogLevel["INFO"] = 1] = "INFO";
6
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
7
+ LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
8
+ LogLevel[LogLevel["MUTE"] = 99] = "MUTE";
9
+ })(LogLevel || (LogLevel = {}));
10
+ class Logger {
11
+ constructor(name, level) {
12
+ this.name = name;
13
+ if (level === undefined && process.env['NODE_ENV'] !== 'production') {
14
+ this.level = LogLevel.DEBUG;
15
+ }
16
+ else if (level === undefined) {
17
+ this.level = LogLevel.WARN;
18
+ }
19
+ else {
20
+ this.level = level;
21
+ }
22
+ }
23
+ get logLevel() {
24
+ return LogLevel[this.level];
25
+ }
26
+ setLogLevel(level) {
27
+ if (level in LogLevel && typeof level === 'string') {
28
+ this.level = LogLevel[level];
29
+ }
30
+ else if (level in LogLevel && typeof level === 'number') {
31
+ this.level = level;
32
+ }
33
+ else {
34
+ throw new Error(`Invalid log level: ${level}`);
35
+ }
36
+ }
37
+ formatMessage(level, message) {
38
+ if (message instanceof Error) {
39
+ message = message.stack;
40
+ }
41
+ else if (
42
+ // Handle Error-Like Objects
43
+ message instanceof Object &&
44
+ Object.prototype.hasOwnProperty.call(message, 'stack')) {
45
+ message = message.stack;
46
+ }
47
+ else if (message instanceof Object) {
48
+ message = JSON.stringify(message);
49
+ }
50
+ return `[${this.name}] [${LogLevel[level]}]: ${message}`;
51
+ }
52
+ log(level, message, ...args) {
53
+ if (level < this.level || level === LogLevel.MUTE) {
54
+ return;
55
+ }
56
+ const fmtMsg = this.formatMessage(level, message);
57
+ switch (level) {
58
+ case LogLevel.WARN:
59
+ console.warn(fmtMsg, ...args);
60
+ break;
61
+ case LogLevel.ERROR:
62
+ console.error(fmtMsg, ...args);
63
+ break;
64
+ default:
65
+ console.log(fmtMsg, ...args);
66
+ }
67
+ }
68
+ debug(message, ...args) {
69
+ this.log(LogLevel.DEBUG, message, ...args);
70
+ }
71
+ info(message, ...args) {
72
+ this.log(LogLevel.INFO, message, ...args);
73
+ }
74
+ warn(message, ...args) {
75
+ this.log(LogLevel.WARN, message, ...args);
76
+ }
77
+ error(message, ...args) {
78
+ this.log(LogLevel.ERROR, message, ...args);
79
+ }
80
80
  }
81
81
 
82
82
  export { LogLevel, Logger };