Skip to content

Commit

Permalink
wip(suite-desktop): bridge log for node-bridge in suite-desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed May 20, 2024
1 parent 3e14473 commit 1b27cd1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/suite-desktop-core/src/modules/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TrezordNode } from '@trezor/transport-bridge';
import { app, ipcMain } from '../typed-electron';
import { BridgeProcess } from '../libs/processes/BridgeProcess';
import { b2t } from '../libs/utils';
import { Logger } from '../libs/logger';

import type { Module, Dependencies } from './index';

Expand Down Expand Up @@ -53,19 +54,24 @@ const getBridgeInstance = (store: Dependencies['store']) => {
return new BridgeProcess();
}

const localLogger = new Logger('info', {
writeToDisk: true,
outputFile: 'trezor-bridge.log',
outputPath: app.getPath('userData'),
});
return new TrezordNode({

Check failure on line 62 in packages/suite-desktop-core/src/modules/bridge.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

Expected blank line before this statement
port: 21325,
api: bridgeDev || bridgeTest ? 'udp' : 'usb',
assetPrefix: '../build/node-bridge',
// passing down ILogger where Log is expected.
// @ts-expect-error
logger: {
...global.logger,
log: (...args) => logger.info('trezord-node', args.join(' ')),
info: (...args) => logger.info('trezord-node', args.join(' ')),
warn: (...args) => logger.warn('trezord-node', args.join(' ')),
debug: (...args) => logger.debug('trezord-node', args.join(' ')),
error: (...args) => logger.error('trezord-node', args.join(' ')),
...localLogger,
log: (...args) => localLogger.info('trezord-node', args.join(' ')),
info: (...args) => localLogger.info('trezord-node', args.join(' ')),
warn: (...args) => localLogger.warn('trezord-node', args.join(' ')),
debug: (...args) => localLogger.debug('trezord-node', args.join(' ')),
error: (...args) => localLogger.error('trezord-node', args.join(' ')),
},
});
};
Expand Down

0 comments on commit 1b27cd1

Please sign in to comment.