fix logging to terminal

pull/3058/head
yann300 2 years ago committed by Aniket
parent 06ca25aad1
commit 5a628416d2
  1. 4
      apps/remix-ide/src/app/tabs/compile-and-run.ts
  2. 2
      apps/remix-ide/src/app/tabs/web3-provider.js
  3. 8
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
  4. 4
      libs/remixd/src/services/foundryClient.ts
  5. 6
      libs/remixd/src/services/hardhatClient.ts
  6. 4
      libs/remixd/src/services/truffleClient.ts

@ -51,11 +51,11 @@ export class CompileAndRun extends Plugin {
}
async runScript (fileName, clearAllInstances) {
await this.call('terminal', 'log', `running ${fileName} ...`)
await this.call('terminal', 'log', { value: `running ${fileName} ...`, type: 'info' })
try {
const exists = await this.call('fileManager', 'exists', fileName)
if (!exists) {
await this.call('terminal', 'log', `${fileName} does not exist.`)
await this.call('terminal', 'log', { value: `${fileName} does not exist.`, type: 'info' } )
return
}
const content = await this.call('fileManager', 'readFile', fileName)

@ -32,7 +32,7 @@ export class Web3ProviderModule extends Plugin {
if (error) {
const errorData = error.data ? error.data : error.message ? error.message : error
// See: https://github.com/ethers-io/ethers.js/issues/901
if (!(typeof errorData === 'string' && errorData.includes("unknown method eth_chainId"))) this.call('terminal', 'log', error.data ? error.data : error.message)
if (!(typeof errorData === 'string' && errorData.includes("unknown method eth_chainId"))) this.call('terminal', 'log', { value: error.data ? error.data : error.message, type: 'error' } )
return reject(errorData)
}
if (payload.method === 'eth_sendTransaction') {

@ -87,7 +87,13 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
},
log: (message) => {
scriptRunnerDispatch({ type: 'log', payload: { message: [message] } })
if (typeof message === 'string') {
message = {
value: message,
type: 'info'
}
}
scriptRunnerDispatch({ type: message.type ? message.type : 'log', payload: { message: [message.value] } })
}
})
}, [])

@ -83,7 +83,7 @@ export class FoundryClient extends PluginClient {
}
if (!this.warnlog) {
// @ts-ignore
this.call('terminal', 'log', 'receiving compilation result from Foundry')
this.call('terminal', 'log', { type: 'info', value: 'receiving compilation result from Foundry' })
this.warnlog = true
}
}
@ -167,6 +167,6 @@ export class FoundryClient extends PluginClient {
console.log('syncing from Foundry')
this.processArtifact()
// @ts-ignore
this.call('terminal', 'log', 'synced with Foundry')
this.call('terminal', 'log', { type: 'info', value: 'synced with Foundry'})
}
}

@ -105,14 +105,12 @@ export class HardhatClient extends PluginClient {
}
}
if (!this.warnLog) {
// @ts-ignore
this.call('terminal', 'log', 'receiving compilation result from Hardhat')
this.call('terminal', 'log', { value: 'receiving compilation result from Hardhat', type: 'info'} )
this.warnLog = true
}
if (targetsSynced.length) {
console.log(`Processing artifacts for files: ${[...new Set(targetsSynced)].join(', ')}`)
// @ts-ignore
this.call('terminal', 'log', `synced with Hardhat: ${[...new Set(targetsSynced)].join(', ')}`)
this.call('terminal', 'log', { type: 'info', value: `synced with Hardhat: ${[...new Set(targetsSynced)].join(', ')}` })
}
}

@ -81,7 +81,7 @@ export class TruffleClient extends PluginClient {
}
if (!this.warnLog) {
// @ts-ignore
this.call('terminal', 'log', 'receiving compilation result from Truffle')
this.call('terminal', 'log', { type: 'info', value: 'receiving compilation result from Truffle' })
this.warnLog = true
}
}
@ -141,6 +141,6 @@ export class TruffleClient extends PluginClient {
console.log('syncing from Truffle')
this.processArtifact()
// @ts-ignore
this.call('terminal', 'log', 'synced with Truffle')
this.call('terminal', 'log', { type: 'info', value: 'synced with Truffle' })
}
}

Loading…
Cancel
Save