Skip to content

Commit

Permalink
Merge pull request #1381 from input-output-hk/chore/ddw-616-save-daed…
Browse files Browse the repository at this point in the history
…alus-log-as-json-file

[DDW-616] Save daedalus log as json file
  • Loading branch information
nikolaglumac committed Apr 10, 2019
2 parents f9c045a + e8052ef commit 112367a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Changelog

### Fixes

- Fixed file extension of downloaded logs ([PR 1381](https://github.com/input-output-hk/daedalus/pull/1381))
- Fixed password validation rules for all languages ([PR 1354](https://github.com/input-output-hk/daedalus/pull/1354))
- Fixed the routing logic which allowed the display of "Settings" screens before the wallet data is fully loaded ([PR 1373](https://github.com/input-output-hk/daedalus/pull/1373))
- Fixed the "download logs" link position in Japanese version of the "Support" screen ([PR 1372](https://github.com/input-output-hk/daedalus/pull/1372))
Expand Down
2 changes: 1 addition & 1 deletion source/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const onAppReady = async () => {
startTime,
});

Logger.info(`========== Daedalus is starting at ${startTime} ==========`);
Logger.info(`Daedalus is starting at ${startTime}`, { startTime });

Logger.info('Updating System-info.json file', { ...systemInfo.data });

Expand Down
3 changes: 2 additions & 1 deletion source/main/ipc/compress-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default () => {
const stream = fs.readFileSync(
path.join(pubLogsFolderPath, logFiles[i])
);
archive.append(stream, { name: logFiles[i] });
const name = logFiles[i].replace('.log', '');
archive.append(stream, { name });
}

archive.finalize(error => {
Expand Down
2 changes: 1 addition & 1 deletion source/main/utils/mainErrorHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Logger } from './logging';
import { stringifyError } from '../../common/utils/logging';

export default (onError?: Function) => {
Logger.info('========== Main Error Handler started ==========');
Logger.info('Main Error Handler started');

unhandled({
logger: (error: any) => Logger.error('unhandledException::main', { error }),
Expand Down
12 changes: 4 additions & 8 deletions source/main/utils/safeExitWithCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ export const safeExitWithCode = (exitCode: number) => {
file.level = false;
// Flush the stream to the log file and exit afterwards.
// https://nodejs.org/api/stream.html#stream_writable_end_chunk_encoding_callback
file.stream.end(
`========== Flushing logs and exiting with code ${exitCode} ===========`,
'utf8',
() => {
app.releaseSingleInstanceLock();
app.exit(exitCode);
}
);
file.stream.end('', 'utf8', () => {
app.releaseSingleInstanceLock();
app.exit(exitCode);
});
};
14 changes: 8 additions & 6 deletions source/renderer/app/stores/NetworkStatusStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,10 @@ export default class NetworkStatusStore extends Store {
) {
// We are connected for the first time, move on to syncing stage
this._networkStatus = NETWORK_STATUS.SYNCING;
Logger.info(
`========== Connected after ${this._getStartupTimeDelta()} milliseconds ==========`
);
const connectingTimeDelta = this._getStartupTimeDelta();
Logger.info(`Connected after ${connectingTimeDelta} milliseconds`, {
connectingTimeDelta,
});
}

// Update sync progress
Expand Down Expand Up @@ -490,9 +491,10 @@ export default class NetworkStatusStore extends Store {
// We are synced for the first time, move on to running stage
this._networkStatus = NETWORK_STATUS.RUNNING;
this.actions.networkStatus.isSyncedAndReady.trigger();
Logger.info(
`========== Synced after ${this._getStartupTimeDelta()} milliseconds ==========`
);
const syncingTimeDelta = this._getStartupTimeDelta();
Logger.info(`Synced after ${syncingTimeDelta} milliseconds`, {
syncingTimeDelta,
});
}

if (wasConnected !== this.isConnected) {
Expand Down

0 comments on commit 112367a

Please sign in to comment.