Skip to content

Commit 00525e5

Browse files
authored
[DDW-562] Fix the count of packed cardano-wallet logs (#2341)
* [DDW-562] Fix cardano-wallet logs packing * [DDW-562] Updates CHANGELOG
1 parent 2c437df commit 00525e5

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Changelog
1111

1212
### Fixes
1313

14+
- Fixed logging issue with too few `cardano-wallet` logs being packed into logs zip archive ([PR 2341](https://github.com/input-output-hk/daedalus/pull/2341))
1415
- Fixed misalignment of the "i" icon on the "Set password" dialog ([PR 2337](https://github.com/input-output-hk/daedalus/pull/2337))
1516
- Removed steps counter from the "Success" wallet restoration dialog step ([PR 2335](https://github.com/input-output-hk/daedalus/pull/2335))
1617

source/main/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ export const ALLOWED_LOGS = [
145145
'node.log',
146146
];
147147
export const ALLOWED_NODE_LOGS = new RegExp(/(node.log-)(\d{14}$)/);
148+
export const ALLOWED_WALLET_LOGS = new RegExp(/(cardano-wallet.log-)(\d{14}$)/);
148149
export const ALLOWED_LAUNCHER_LOGS = new RegExp(/(launcher-)(\d{14}$)/);
149150
export const MAX_NODE_LOGS_ALLOWED = 3;
151+
export const MAX_WALLET_LOGS_ALLOWED = 3;
150152
export const MAX_LAUNCHER_LOGS_ALLOWED = 3;
151153

152154
// CardanoNode config

source/main/ipc/get-logs.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import fs from 'fs';
44
import path from 'path';
55
import {
66
pubLogsFolderPath,
7-
MAX_NODE_LOGS_ALLOWED,
87
ALLOWED_LOGS,
98
ALLOWED_NODE_LOGS,
9+
ALLOWED_WALLET_LOGS,
1010
ALLOWED_LAUNCHER_LOGS,
11+
MAX_NODE_LOGS_ALLOWED,
12+
MAX_WALLET_LOGS_ALLOWED,
1113
MAX_LAUNCHER_LOGS_ALLOWED,
1214
} from '../config';
1315
import { MainIpcChannel } from './lib/MainIpcChannel';
@@ -50,6 +52,10 @@ const isFileAllowed = (fileName: string) =>
5052
const isFileNodeLog = (fileName: string, nodeLogsIncluded: number) =>
5153
ALLOWED_NODE_LOGS.test(fileName) && nodeLogsIncluded < MAX_NODE_LOGS_ALLOWED;
5254

55+
const isFileWalletLog = (fileName: string, walletLogsIncluded: number) =>
56+
ALLOWED_WALLET_LOGS.test(fileName) &&
57+
walletLogsIncluded < MAX_WALLET_LOGS_ALLOWED;
58+
5359
const isFileLauncherLog = (fileName: string, nodeLogsIncluded: number) =>
5460
ALLOWED_LAUNCHER_LOGS.test(fileName) &&
5561
nodeLogsIncluded < MAX_LAUNCHER_LOGS_ALLOWED;
@@ -62,6 +68,7 @@ export default () => {
6268
const files = fs.readdirSync(pubLogsFolderPath).sort().reverse();
6369

6470
let nodeLogsIncluded = 0;
71+
let walletLogsIncluded = 0;
6572
let launcherLogsIncluded = 0;
6673
for (let i = 0; i < files.length; i++) {
6774
const currentFile = path.join(pubLogsFolderPath, files[i]);
@@ -72,6 +79,9 @@ export default () => {
7279
} else if (isFileNodeLog(fileName, nodeLogsIncluded)) {
7380
logFiles.push(fileName);
7481
nodeLogsIncluded++;
82+
} else if (isFileWalletLog(fileName, walletLogsIncluded)) {
83+
logFiles.push(fileName);
84+
walletLogsIncluded++;
7585
} else if (isFileLauncherLog(fileName, launcherLogsIncluded)) {
7686
logFiles.push(fileName);
7787
launcherLogsIncluded++;

0 commit comments

Comments
 (0)