@bsv/wallet-toolbox 1.7.3 → 1.7.5
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 +10 -0
- package/mobile/out/src/WalletLogger.d.ts +32 -0
- package/mobile/out/src/WalletLogger.d.ts.map +1 -1
- package/mobile/out/src/WalletLogger.js +5 -1
- package/mobile/out/src/WalletLogger.js.map +1 -1
- package/mobile/out/src/index.client.d.ts +1 -0
- package/mobile/out/src/index.client.d.ts.map +1 -1
- package/mobile/out/src/index.client.js +1 -0
- package/mobile/out/src/index.client.js.map +1 -1
- package/mobile/package-lock.json +2 -2
- package/mobile/package.json +1 -1
- package/out/src/WalletLogger.d.ts +32 -0
- package/out/src/WalletLogger.d.ts.map +1 -1
- package/out/src/WalletLogger.js +5 -1
- package/out/src/WalletLogger.js.map +1 -1
- package/out/src/index.all.d.ts +1 -0
- package/out/src/index.all.d.ts.map +1 -1
- package/out/src/index.all.js +1 -0
- package/out/src/index.all.js.map +1 -1
- package/out/src/index.client.d.ts +1 -0
- package/out/src/index.client.d.ts.map +1 -1
- package/out/src/index.client.js +1 -0
- package/out/src/index.client.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/WalletLogger.ts +40 -1
- package/src/index.all.ts +1 -0
- package/src/index.client.ts +1 -0
package/package.json
CHANGED
package/src/WalletLogger.ts
CHANGED
|
@@ -7,6 +7,7 @@ export class WalletLogger implements WalletLoggerInterface {
|
|
|
7
7
|
isOrigin: boolean = true
|
|
8
8
|
isError: boolean = false
|
|
9
9
|
level?: WalletLoggerLevel
|
|
10
|
+
flushFormat?: 'json'
|
|
10
11
|
|
|
11
12
|
constructor(log?: string | WalletLoggerInterface) {
|
|
12
13
|
if (log) {
|
|
@@ -107,7 +108,11 @@ export class WalletLogger implements WalletLoggerInterface {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
flush(): object | undefined {
|
|
110
|
-
const
|
|
111
|
+
const trace = this.toLogString()
|
|
112
|
+
const log = this.flushFormat === 'json' ? JSON.stringify({
|
|
113
|
+
name: 'WalletLogger.flush',
|
|
114
|
+
trace
|
|
115
|
+
}) : trace
|
|
111
116
|
if (this.isError) console.error(log)
|
|
112
117
|
else console.log(log)
|
|
113
118
|
const r = this.isOrigin ? undefined : this.toWalletLoggerJson()
|
|
@@ -165,3 +170,37 @@ export function logCreateActionArgs(args: CreateActionArgs): object {
|
|
|
165
170
|
* 'trace' Instead of adding debug details, focus on execution path and timing.
|
|
166
171
|
*/
|
|
167
172
|
export type WalletLoggerLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace'
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Constructor properties available to `WalletLogger`
|
|
176
|
+
*/
|
|
177
|
+
export interface WalletLoggerArgs {
|
|
178
|
+
/**
|
|
179
|
+
* Optional. Logging levels that may influence what is logged.
|
|
180
|
+
*
|
|
181
|
+
* 'error' Only requests resulting in an exception should be logged.
|
|
182
|
+
* 'warn' Also log requests that succeed but with an abnormal condition.
|
|
183
|
+
* 'info' Also log normal successful requests.
|
|
184
|
+
* 'debug' Add input parm and result details where possible.
|
|
185
|
+
* 'trace' Instead of adding debug details, focus on execution path and timing.
|
|
186
|
+
*/
|
|
187
|
+
level?: 'error' | 'warn' | 'info' | 'debug' | 'trace'
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Valid if an accumulating logger. Count of `group` calls without matching `groupEnd`.
|
|
191
|
+
*/
|
|
192
|
+
indent?: number
|
|
193
|
+
/**
|
|
194
|
+
* True if this is an accumulating logger and the logger belongs to the object servicing the initial request.
|
|
195
|
+
*/
|
|
196
|
+
isOrigin?: boolean
|
|
197
|
+
/**
|
|
198
|
+
* True if this is an accumulating logger and an error was logged.
|
|
199
|
+
*/
|
|
200
|
+
isError?: boolean
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Optional array of accumulated logged data and errors.
|
|
204
|
+
*/
|
|
205
|
+
logs?: WalletLoggerLog[]
|
|
206
|
+
}
|
package/src/index.all.ts
CHANGED
|
@@ -22,5 +22,6 @@ export * from './wab-client/auth-method-interactors/TwilioPhoneInteractor'
|
|
|
22
22
|
export * from './wab-client/auth-method-interactors/DevConsoleInteractor'
|
|
23
23
|
export * from './wab-client/WABClient'
|
|
24
24
|
export * from './Wallet'
|
|
25
|
+
export * from './WalletLogger'
|
|
25
26
|
export * from './WalletAuthenticationManager'
|
|
26
27
|
export * from './WalletPermissionsManager'
|
package/src/index.client.ts
CHANGED
|
@@ -20,5 +20,6 @@ export * from './wab-client/auth-method-interactors/TwilioPhoneInteractor'
|
|
|
20
20
|
export * from './wab-client/auth-method-interactors/DevConsoleInteractor'
|
|
21
21
|
export * from './wab-client/WABClient'
|
|
22
22
|
export * from './Wallet'
|
|
23
|
+
export * from './WalletLogger'
|
|
23
24
|
export * from './WalletAuthenticationManager'
|
|
24
25
|
export * from './WalletPermissionsManager'
|