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

[DDW-616] Save daedalus log as json file #1381

Merged
merged 6 commits into from
Apr 10, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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