Skip to content

Commit

Permalink
fix: Format date when output log. Catch exception when export public …
Browse files Browse the repository at this point in the history
…key info.
  • Loading branch information
yanguoyu committed Oct 16, 2023
1 parent dd43356 commit 3b90931
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
18 changes: 11 additions & 7 deletions packages/neuron-wallet/src/controllers/export-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,18 @@ export default class ExportDebugController {
}

private async addHdPublicKeyInfoCsv() {
const addressMetas = await AddressService.getAddressesByAllWallets()
let csv = 'walletId,addressType,addressIndex,publicKeyInBlake160\n'
for (const addressMeta of addressMetas) {
const row = `${addressMeta.walletId},${addressMeta.addressType},${addressMeta.addressIndex},${addressMeta.blake160}\n`
csv += row
try {
const addressMetas = await AddressService.getAddressesByAllWallets()
let csv = 'walletId,addressType,addressIndex,publicKeyInBlake160\n'
for (const addressMeta of addressMetas) {
const row = `${addressMeta.walletId},${addressMeta.addressType},${addressMeta.addressIndex},${addressMeta.blake160}\n`
csv += row
}
const csvFileName = 'hd_public_key_info.csv'
this.archive.append(csv, { name: csvFileName })
} catch (error) {
logger.error(`Export Debug:\t export public key info error: ${error}`)
}
const csvFileName = 'hd_public_key_info.csv'
this.archive.append(csv, { name: csvFileName })
}

private addLogFiles = (files = ['main.log', 'renderer.log']) => {
Expand Down
7 changes: 6 additions & 1 deletion packages/neuron-wallet/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import env from '../env'
if (!env.isDevMode) {
logger.transports.file.level = 'info'
}

logger.transports.file.format = ({ date, level, data }) => {
return `[${date.toISOString()}] [${level}] ${data}`
}
logger.transports.console.format = ({ date, level, data }) => {
return `[${date.toISOString()}] [${level}] ${data}`
}
// logger.catchErrors({ showDialog: false })

export default logger

0 comments on commit 3b90931

Please sign in to comment.