File tree Expand file tree Collapse file tree 5 files changed +50
-2
lines changed
apps/browser-extension-wallet/src/lib/scripts/background Expand file tree Collapse file tree 5 files changed +50
-2
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,7 @@ import axiosFetchAdapter from '@shiroyasha9/axios-fetch-adapter';
32
32
import { SharedWalletScriptKind } from '@lace/core' ;
33
33
import { getBaseUrlForChain } from '@utils/chain' ;
34
34
import { cacheNamiMetadataSubscription } from './cache-nami-metadata' ;
35
-
36
- const logger = console ;
35
+ import { logger } from '@lace/common' ;
37
36
38
37
// It is important that this file is not exported from index,
39
38
// because creating wallet repository with store creates an actual pouchdb database
Original file line number Diff line number Diff line change 51
51
"react-tooltip" : " 4.2.7"
52
52
},
53
53
"devDependencies" : {
54
+ "ts-log" : " ^2.2.7" ,
54
55
"typescript" : " ^4.9.5"
55
56
},
56
57
"peerDependencies" : {
Original file line number Diff line number Diff line change @@ -30,3 +30,5 @@ export * from '@ui/components/Radio';
30
30
export * from '@ui/components/Timeline' ;
31
31
32
32
export * from '@analytics/index' ;
33
+
34
+ export * from './stringifyLogger' ;
Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-console */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import { Logger } from 'ts-log' ;
4
+ import { toSerializableObject } from '@cardano-sdk/util' ;
5
+
6
+ export class StringifyLogger implements Logger {
7
+ private convertParams ( params : any [ ] ) {
8
+ return params . map ( ( param ) =>
9
+ param && typeof param === 'object' ? JSON . stringify ( toSerializableObject ( param ) ) : param
10
+ ) ;
11
+ }
12
+
13
+ trace ( ...params : any [ ] ) : void {
14
+ console . trace ( ...this . convertParams ( params ) ) ;
15
+ }
16
+
17
+ debug ( ...params : any [ ] ) : void {
18
+ console . debug ( ...this . convertParams ( params ) ) ;
19
+ }
20
+
21
+ info ( ...params : any [ ] ) : void {
22
+ console . log ( ...this . convertParams ( params ) ) ;
23
+ }
24
+
25
+ warn ( ...params : any [ ] ) : void {
26
+ console . warn ( ...this . convertParams ( params ) ) ;
27
+ }
28
+
29
+ error ( ...params : any [ ] ) : void {
30
+ console . error ( ...this . convertParams ( params ) ) ;
31
+ }
32
+
33
+ fatal ( ...params : any [ ] ) : void {
34
+ console . error ( ...this . convertParams ( params ) ) ;
35
+ }
36
+ }
37
+
38
+ export const logger = new StringifyLogger ( ) ;
Original file line number Diff line number Diff line change @@ -13331,6 +13331,7 @@ __metadata:
13331
13331
react-copy-to-clipboard: 5.0.4
13332
13332
react-dom: 17.0.2
13333
13333
react-tooltip: 4.2.7
13334
+ ts-log: ^2.2.7
13334
13335
typescript: ^4.9.5
13335
13336
peerDependencies:
13336
13337
react: 17.0.2
@@ -56718,6 +56719,13 @@ __metadata:
56718
56719
languageName: node
56719
56720
linkType: hard
56720
56721
56722
+ "ts-log@npm:^2.2.7":
56723
+ version: 2.2.7
56724
+ resolution: "ts-log@npm:2.2.7"
56725
+ checksum: c423a5eb54abb9471578902953814d3d0c88b3f237db016998f8998ecf982cb0f748bb8ebf93670eeba9b836ff0ce407d8065a340f3ab218ea7b9442c255b3d4
56726
+ languageName: node
56727
+ linkType: hard
56728
+
56721
56729
"ts-mixer@npm:^6.0.3":
56722
56730
version: 6.0.4
56723
56731
resolution: "ts-mixer@npm:6.0.4"
You can’t perform that action at this time.
0 commit comments