Permalink
Browse files

Merge branch 'develop' into feature/ddw-465-multi-language-installers

  • Loading branch information...
nikolaglumac committed Feb 10, 2019
2 parents d88a3e7 + 411a09e commit e21bb999fc775e649af5ae4a981fdb6756b93b80
Showing with 490 additions and 276 deletions.
  1. +2 −0 CHANGELOG.md
  2. +2 −2 cardano-sl-src.json
  3. +1 −0 source/common/types/environment.types.js
  4. +50 −0 source/common/types/logging.types.js
  5. +81 −0 source/common/utils/logging.js
  6. +54 −49 source/main/cardano/CardanoNode.js
  7. +9 −9 source/main/cardano/setupCardanoNodeMode.js
  8. +7 −7 source/main/cardano/setupFrontendOnlyMode.js
  9. +1 −1 source/main/config.js
  10. +2 −0 source/main/environment.js
  11. +16 −20 source/main/index.js
  12. +8 −9 source/main/ipc/compress-logs.js
  13. +1 −1 source/main/ipc/parse-redemption-code-from-pdf.js
  14. +2 −3 source/main/ipc/reportRequestChannel.js
  15. +2 −2 source/main/utils/buildAppMenus.js
  16. +1 −2 source/main/utils/handleDiskSpace.js
  17. +23 −2 source/main/utils/logging.js
  18. +3 −3 source/main/utils/mainErrorHandler.js
  19. +1 −1 source/main/utils/processes.js
  20. +2 −3 source/main/utils/rendererErrorHandler.js
  21. +38 −32 source/main/utils/setupLogging.js
  22. +65 −66 source/renderer/app/api/api.js
  23. +6 −3 source/renderer/app/api/transactions/requests/redeemPaperVendedAda.js
  24. +8 −9 source/renderer/app/api/utils/patchAdaApi.js
  25. +8 −2 source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.js
  26. +5 −0 source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.scss
  27. +1 −0 source/renderer/app/i18n/locales/de-DE.json
  28. +34 −20 source/renderer/app/i18n/locales/defaultMessages.json
  29. +3 −2 source/renderer/app/i18n/locales/en-US.json
  30. +1 −0 source/renderer/app/i18n/locales/hr-HR.json
  31. +2 −1 source/renderer/app/i18n/locales/ja-JP.json
  32. +1 −0 source/renderer/app/i18n/locales/ko-KR.json
  33. +1 −0 source/renderer/app/i18n/locales/zh-CN.json
  34. +4 −4 source/renderer/app/stores/AdaRedemptionStore.js
  35. +21 −21 source/renderer/app/stores/NetworkStatusStore.js
  36. +24 −2 source/renderer/app/utils/logging.js
@@ -5,6 +5,8 @@ Changelog

### Features

- Structured the Daedalus logs in the same format as the Cardano logs, which follows the structured logging specification ([PR 1299](https://github.com/input-output-hk/daedalus/pull/1299))
- Implemented an extra explanation line in the Create Paper Wallet Certificate dialog ([PR 1309](https://github.com/input-output-hk/daedalus/pull/1309))
- Improve performance of rendering huge lists of transactions and addresses ([PR 1276](https://github.com/input-output-hk/daedalus/pull/1276), [PR 1303](https://github.com/input-output-hk/daedalus/pull/1303), [PR 1305](https://github.com/input-output-hk/daedalus/pull/1305), ([PR 1306](https://github.com/input-output-hk/daedalus/pull/1306)))
- Implemented a "System-info.json" file, containing the system specification of the machine user is running Daedalus ([PR 1292](https://github.com/input-output-hk/daedalus/pull/1292))
- Implemented a block-consolidation status screen ([PR 1275](https://github.com/input-output-hk/daedalus/pull/1275), [PR 1294](https://github.com/input-output-hk/daedalus/pull/1294))
@@ -1,6 +1,6 @@
{
"url": "https://github.com/input-output-hk/cardano-sl",
"rev": "529060b7e73505b5c64125675a7ff4fa87fe0ae0",
"sha256": "087jr6isj6ahbg1qpvv8sp2a2j03v2csl3vw6czkfia9n4q9p0s0",
"rev": "6dbbcf8a15a7589f684dab6862c0c27e77056b66",
"sha256": "0wpc8kvd3gnvdsxpk8wy52pjx1iylhq9fdv03a56djz0rmm67iz3",
"fetchSubmodules": false
}
@@ -17,6 +17,7 @@ export type Environment = {
buildNumber: string,
buildLabel: string,
platform: string,
platformVersion: string,
os: string,
installerVersion: string,
version: string,
@@ -0,0 +1,50 @@
// @flow
export type FormatMessageContextParams = {
appName: string,
electronProcess: string,
level: string,
network: string,
};

export type ConstructMessageBodyParams = {
at: string,
env: string,
ns?: Array<?string>,
data?: ?Object,
app?: Array<?string>,
msg: string,
pid: number | string,
sev: string,
thread: number | string,
};

export type MessageBody = {
at: string,
env: string,
ns: Array<?string>,
data: Object,
app: Array<?string>,
msg: string,
pid: number | string,
sev: string,
thread: number | string,
};

export type ElectronLoggerMessage = {
date: Date,
data: Array<*>,
level: string,
};

export type LogSystemInfoParams = {
cardanoVersion: string,
cpu: Array<Object>,
current: string,
daedalusVersion: string,
isInSafeMode: string,
network: string,
osName: string,
platformVersion: string,
ram: string,
startTime: string,
};
@@ -1,6 +1,87 @@
// @flow
import { pickBy } from 'lodash';
import type {
FormatMessageContextParams,
ConstructMessageBodyParams,
MessageBody,
ElectronLoggerMessage,
} from '../types/logging.types';

const DEFAULT_MESSAGE_BODY = {
ns: ['daedalus'],
data: {},
app: ['daedalus'],
};

const isProd = process.env.NODE_ENV === 'production';

const stringifyMessageBody = (messageBody: MessageBody): string => {
const spacing = isProd ? 0 : 2;
return JSON.stringify(messageBody, null, spacing);
};

export const filterLogData = (data: Object): Object => {
const sensitiveData = [
'spendingPassword', 'oldPassword', 'newPassword',
'mnemonic', 'recoveryPhrase', 'passphrase', 'password',
];
return pickBy(data, (value, key) => {
if (sensitiveData.includes(key)) { return false; }
return true;
});
};

export const stringifyData = (data: any) => JSON.stringify(data, null, 2);

export const stringifyError = (error: any) => (
JSON.stringify(error, Object.getOwnPropertyNames(error), 2)
);

export const formatContext = (context: FormatMessageContextParams): string => {
const { appName, electronProcess, level, network } = context;
return `[${appName}.*${network}*:${level}:${electronProcess}]`;
};

export const formatMessageTime = (date: Date): string => {
const [year, time] = date.toISOString().split('T');
return `[${year}T${time.slice(0, -1)}Z]`;
};

export const constructMessageBody = (bodyData: ConstructMessageBodyParams): MessageBody => {
let messageBody = { ...DEFAULT_MESSAGE_BODY, ...bodyData };
if (typeof messageBody.data === 'string') {
messageBody = { ...messageBody, data: { response: messageBody.data } };
}
const { at, env, ns, data, app, msg, pid, sev, thread } = messageBody;
return { at, env, ns, data, app, msg, pid, sev, thread };
};

export const formatMessage = (loggerMessage: ElectronLoggerMessage): string => {
const at = loggerMessage.date.toISOString();
const [context, messageData] = loggerMessage.data;
const { level } = loggerMessage;
const { message: msg, data = {}, environmentData } = messageData;
const { network, os, platformVersion, version } = environmentData;

const messageBodyParams: ConstructMessageBodyParams = {
at,
env: `${network}:${os}:${platformVersion}`,
ns: [
'daedalus',
`v${version}`,
`*${network}*`,
],
data,
msg,
pid: '',
sev: level,
thread: '',
};

const messageBody: MessageBody = constructMessageBody(messageBodyParams);

if (isProd) return stringifyMessageBody(messageBody);

const messageTime: string = formatMessageTime(loggerMessage.date);
return `${messageTime} ${context} ${stringifyMessageBody(messageBody)}`;
};
Oops, something went wrong.

0 comments on commit e21bb99

Please sign in to comment.