mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
debug - prefer logger over console
This commit is contained in:
parent
a265144176
commit
96d1175834
@ -1,6 +1,8 @@
|
||||
const urlUtil = require('url')
|
||||
const endOfStream = require('end-of-stream')
|
||||
const pipe = require('pump')
|
||||
const log = require('loglevel')
|
||||
const extension = require('extensionizer')
|
||||
const LocalStorageStore = require('obs-store/lib/localStorage')
|
||||
const storeTransform = require('obs-store/lib/transform')
|
||||
const ExtensionPlatform = require('./platforms/extension')
|
||||
@ -9,13 +11,11 @@ const migrations = require('./migrations/')
|
||||
const PortStream = require('./lib/port-stream.js')
|
||||
const NotificationManager = require('./lib/notification-manager.js')
|
||||
const MetamaskController = require('./metamask-controller')
|
||||
const extension = require('extensionizer')
|
||||
const firstTimeState = require('./first-time-state')
|
||||
|
||||
const STORAGE_KEY = 'metamask-config'
|
||||
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
||||
|
||||
const log = require('loglevel')
|
||||
window.log = log
|
||||
log.setDefaultLevel(METAMASK_DEBUG ? 'debug' : 'warn')
|
||||
|
||||
@ -29,12 +29,12 @@ let popupIsOpen = false
|
||||
const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY })
|
||||
|
||||
// initialization flow
|
||||
initialize().catch(console.error)
|
||||
initialize().catch(log.error)
|
||||
|
||||
async function initialize () {
|
||||
const initState = await loadStateFromPersistence()
|
||||
await setupController(initState)
|
||||
console.log('MetaMask initialization complete.')
|
||||
log.debug('MetaMask initialization complete.')
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -340,7 +340,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
setupUntrustedCommunication (connectionStream, originDomain) {
|
||||
// Check if new connection is blacklisted
|
||||
if (this.blacklistController.checkForPhishing(originDomain)) {
|
||||
console.log('MetaMask - sending phishing warning for', originDomain)
|
||||
log.debug('MetaMask - sending phishing warning for', originDomain)
|
||||
this.sendPhishingWarning(connectionStream, originDomain)
|
||||
return
|
||||
}
|
||||
@ -374,7 +374,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
dnode,
|
||||
outStream,
|
||||
(err) => {
|
||||
if (err) console.error(err)
|
||||
if (err) log.error(err)
|
||||
}
|
||||
)
|
||||
dnode.on('remote', (remote) => {
|
||||
@ -402,7 +402,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
providerStream,
|
||||
outStream,
|
||||
(err) => {
|
||||
if (err) console.error(err)
|
||||
if (err) log.error(err)
|
||||
}
|
||||
)
|
||||
|
||||
@ -416,7 +416,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
function loggerMiddleware (req, res, next, end) {
|
||||
next((cb) => {
|
||||
if (res.error) {
|
||||
console.error('Error in RPC response:\n', res)
|
||||
log.error('Error in RPC response:\n', res)
|
||||
}
|
||||
if (req.isMetamaskInternal) return
|
||||
log.info(`RPC (${originDomain}):`, req, '->', res)
|
||||
@ -441,7 +441,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
this.publicConfigStore,
|
||||
outStream,
|
||||
(err) => {
|
||||
if (err) console.error(err)
|
||||
if (err) log.error(err)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user