-
-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
94 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Log, LogMessage as UtilsLogMessage } from '@trezor/utils'; | ||
|
||
/** take an instance of ILogger and return instance of Log while keeping more or less the same behavior */ | ||
export const convertILoggerToLog = (iLogger: ILogger): Log => { | ||
return { | ||
log: (msg: string) => iLogger.info('', msg), | ||
info: (msg: string) => iLogger.info('', msg), | ||
debug: (msg: string) => iLogger.debug('', msg), | ||
warn: (msg: string) => iLogger.warn('', msg), | ||
error: (msg: string) => iLogger.error('', msg), | ||
prefix: '', | ||
messages: [], | ||
enabled: true, | ||
css: '', | ||
MAX_ENTRIES: 1000, | ||
setColors: (_colors: any) => {}, | ||
setWriter: (_logWriter: any) => {}, | ||
addMessage: (_msg: UtilsLogMessage) => {}, | ||
logWriter: undefined, | ||
getLog: (): UtilsLogMessage[] => { | ||
return iLogger.getLog().map(log => ({ | ||
message: [log.text], | ||
prefix: '', | ||
level: log.level, | ||
timestamp: log.date.getTime(), | ||
})); | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { Log } from '@trezor/utils'; | ||
|
||
import { TrezordNode } from './http'; | ||
|
||
const trezordNode = new TrezordNode({ port: 21325, api: 'usb' }); | ||
const trezordNode = new TrezordNode({ | ||
port: 21325, | ||
api: 'usb', | ||
logger: new Log('@trezor/transport-bridge', true), | ||
}); | ||
|
||
trezordNode.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters