Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Format date when output log. Catch exception when export public key info. #2877

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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