From 8e78129ce4b0722df0cda2bbc9a331a6b3c6e6bb Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 22 Nov 2017 00:07:28 +0000 Subject: [PATCH] console.debug back to console.log --- app/__jest__/setup.js | 1 - app/common/analytics.js | 6 +++--- app/common/database.js | 4 ++-- app/main.development.js | 7 ++----- app/main/local-storage.js | 2 +- app/main/updates.js | 10 +++++----- app/network/network.js | 4 ++-- app/network/o-auth-2/grant-authorization-code.js | 2 +- app/network/o-auth-2/misc.js | 6 +++--- app/plugins/index.js | 2 +- app/plugins/install.js | 10 +++++----- app/sync/crypt.js | 12 ++++++------ app/sync/storage.js | 2 +- app/ui/containers/app.js | 4 ++-- 14 files changed, 34 insertions(+), 38 deletions(-) diff --git a/app/__jest__/setup.js b/app/__jest__/setup.js index 0141e4b1dc..159a704a92 100644 --- a/app/__jest__/setup.js +++ b/app/__jest__/setup.js @@ -16,7 +16,6 @@ const localStorageMock = (function () { }; })(); -global.console.debug = global.console.log; global.localStorage = localStorageMock; global.requestAnimationFrame = cb => process.nextTick(cb); global.require = require; diff --git a/app/common/analytics.js b/app/common/analytics.js index 1ea3476b9c..ba9f3e7b43 100644 --- a/app/common/analytics.js +++ b/app/common/analytics.js @@ -69,7 +69,7 @@ export async function _trackEvent ( value: ?string ) { const prefix = interactive ? '[ga] Event' : '[ga] Non-interactive'; - console.debug(prefix, [category, action, label, value].filter(Boolean).join(', ')); + console.log(prefix, [category, action, label, value].filter(Boolean).join(', ')); const params = [ {name: KEY_HIT_TYPE, value: 'event'}, @@ -86,7 +86,7 @@ export async function _trackEvent ( async function _trackPageView () { const params = [{name: KEY_HIT_TYPE, value: 'pageview'}]; - console.debug('[ga] Page', GA_LOCATION); + console.log('[ga] Page', GA_LOCATION); await _sendToGoogle(params); } @@ -129,7 +129,7 @@ async function _getDefaultParams (): Promise> { async function _sendToGoogle (params: Array) { let settings = await models.settings.getOrCreate(); if (settings.disableAnalyticsTracking) { - console.debug('[ga] Google analytics tracking disabled. Not sending'); + console.log('[ga] Google analytics tracking disabled. Not sending'); return; } diff --git a/app/common/database.js b/app/common/database.js index b13a753d8c..11efc10cf4 100644 --- a/app/common/database.js +++ b/app/common/database.js @@ -37,7 +37,7 @@ export async function initClient () { await fn(changes); } }); - console.debug('[db] Initialized DB client'); + console.log('[db] Initialized DB client'); } export async function init ( @@ -81,7 +81,7 @@ export async function init ( e.sender.send(replyChannel, result); }); - console.debug(`[db] Initialized DB at ${getDBFilePath('$TYPE')}`); + console.log(`[db] Initialized DB at ${getDBFilePath('$TYPE')}`); } // ~~~~~~~~~~~~~~~~ // diff --git a/app/main.development.js b/app/main.development.js index 497223ba0b..779cf38b55 100644 --- a/app/main.development.js +++ b/app/main.development.js @@ -12,9 +12,6 @@ if (needsRestart) { process.exit(0); } -// Fall back so client-side code works -console.debug = console.debug || console.log; - // Initialize some things database.init(models.types()); errorHandling.init(); @@ -65,8 +62,8 @@ app.on('ready', async () => { // Install developer extensions if we're in dev mode // if (isDevelopment() || process.env.INSOMNIA_FORCE_DEBUG) { // try { - // console.debug('[main] Installed Extension: ' + await installExtension(REACT_DEVELOPER_TOOLS)); - // console.debug('[main] Installed Extension: ' + await installExtension(REDUX_DEVTOOLS)); + // console.log('[main] Installed Extension: ' + await installExtension(REACT_DEVELOPER_TOOLS)); + // console.log('[main] Installed Extension: ' + await installExtension(REDUX_DEVTOOLS)); // } catch (err) { // console.warn('Failed to install devtools extension', err); // } diff --git a/app/main/local-storage.js b/app/main/local-storage.js index b09881fdef..efa48f2c18 100644 --- a/app/main/local-storage.js +++ b/app/main/local-storage.js @@ -11,7 +11,7 @@ class LocalStorage { this._buffer = {}; mkdirp.sync(basePath); - console.debug(`[localstorage] Initialized at ${basePath}`); + console.log(`[localstorage] Initialized at ${basePath}`); } setItem (key, obj) { diff --git a/app/main/updates.js b/app/main/updates.js index 304cb5ba96..4b493009fa 100644 --- a/app/main/updates.js +++ b/app/main/updates.js @@ -62,17 +62,17 @@ export async function init () { }); autoUpdater.on('update-not-available', () => { - console.debug('[updater] Not Available'); + console.log('[updater] Not Available'); _sendUpdateComplete(false, 'Up to Date'); }); autoUpdater.on('update-available', () => { - console.debug('[updater] Update Available'); + console.log('[updater] Update Available'); _sendUpdateStatus('Downloading...'); }); autoUpdater.on('update-downloaded', (e, releaseNotes, releaseName, releaseDate, updateUrl) => { - console.debug(`[updater] Downloaded ${releaseName}`); + console.log(`[updater] Downloaded ${releaseName}`); _sendUpdateComplete(true, 'Updated (Restart Required)'); _showUpdateNotification(); }); @@ -119,13 +119,13 @@ async function _checkForUpdates (force: boolean) { const updateUrl = await getUpdateUrl(force); if (updateUrl === null) { - console.debug(`[updater] Updater not running platform=${process.platform} dev=${isDevelopment()}`); + console.log(`[updater] Updater not running platform=${process.platform} dev=${isDevelopment()}`); _sendUpdateComplete(false, 'Updates Not Supported'); return; } try { - console.debug(`[updater] Checking for updates url=${updateUrl}`); + console.log(`[updater] Checking for updates url=${updateUrl}`); autoUpdater.setFeedURL(updateUrl); autoUpdater.checkForUpdates(); } catch (err) { diff --git a/app/network/network.js b/app/network/network.js index 7e44e000bd..822fdc0eb5 100644 --- a/app/network/network.js +++ b/app/network/network.js @@ -225,7 +225,7 @@ export async function _actuallySend ( const percent = Math.round(dlnow / dltotal * 100); if (percent !== lastPercent) { - console.debug(`[debug] Request downloaded ${percent}%`); + console.log(`[debug] Request downloaded ${percent}%`); lastPercent = percent; } @@ -279,7 +279,7 @@ export async function _actuallySend ( // Doesn't exist yet, so write it mkdirp.sync(baseCAPath); fs.writeFileSync(fullCAPath, CACerts.blob); - console.debug('[net] Set CA to', fullCAPath); + console.log('[net] Set CA to', fullCAPath); } setOpt(Curl.option.CAINFO, fullCAPath); diff --git a/app/network/o-auth-2/grant-authorization-code.js b/app/network/o-auth-2/grant-authorization-code.js index d9b6e9222d..d3884dbc6a 100644 --- a/app/network/o-auth-2/grant-authorization-code.js +++ b/app/network/o-auth-2/grant-authorization-code.js @@ -68,7 +68,7 @@ async function _authorize (url, clientId, redirectUri = '', scope = '', state = const redirectedTo = await authorizeUserInWindow(finalUrl, regex); - console.debug('[oauth2] Detected redirect ' + redirectedTo); + console.log('[oauth2] Detected redirect ' + redirectedTo); const {query} = urlParse(redirectedTo); return responseToObject(query, [ diff --git a/app/network/o-auth-2/misc.js b/app/network/o-auth-2/misc.js index f75d1594e2..e00f0b9540 100644 --- a/app/network/o-auth-2/misc.js +++ b/app/network/o-auth-2/misc.js @@ -54,14 +54,14 @@ export function authorizeUserInWindow (url, urlRegex = /.*/) { // Be sure to resolve URL so that we can handle redirects with no host like /foo/bar const currentUrl = child.webContents.getURL(); if (currentUrl.match(urlRegex)) { - console.debug(`[oauth2] Matched redirect to "${currentUrl}" with ${urlRegex.toString()}`); + console.log(`[oauth2] Matched redirect to "${currentUrl}" with ${urlRegex.toString()}`); finalUrl = currentUrl; child.close(); } else if (currentUrl === url) { // It's the first one, so it's not a redirect - console.debug(`[oauth2] Loaded "${currentUrl}"`); + console.log(`[oauth2] Loaded "${currentUrl}"`); } else { - console.debug(`[oauth2] Ignoring URL "${currentUrl}". Didn't match ${urlRegex.toString()}`); + console.log(`[oauth2] Ignoring URL "${currentUrl}". Didn't match ${urlRegex.toString()}`); } }); diff --git a/app/plugins/index.js b/app/plugins/index.js index 97d44eb2d7..7dbfc79fc0 100644 --- a/app/plugins/index.js +++ b/app/plugins/index.js @@ -100,7 +100,7 @@ export async function getPlugins (force: boolean = false): Promise }; plugins.push(plugin); - console.debug(`[plugin] Loaded ${modulePath}`); + console.log(`[plugin] Loaded ${modulePath}`); } catch (err) { showError({ title: 'Plugin Error', diff --git a/app/plugins/install.js b/app/plugins/install.js index 8555918dbc..eb0316fb6f 100644 --- a/app/plugins/install.js +++ b/app/plugins/install.js @@ -29,9 +29,9 @@ export default async function (moduleName: string): Promise { request.on('response', response => { const bodyBuffers = []; - console.debug(`[plugins] Downloading plugin tarball from ${info.dist.tarball}`); + console.log(`[plugins] Downloading plugin tarball from ${info.dist.tarball}`); response.on('end', () => { - console.debug(`[plugins] Extracting plugin to ${pluginDir}`); + console.log(`[plugins] Extracting plugin to ${pluginDir}`); const w = tar.extract({ cwd: pluginDir, // Extract to plugin's directory strict: true, // Fail on anything @@ -42,7 +42,7 @@ export default async function (moduleName: string): Promise { reject(new Error(`Failed to extract ${info.dist.tarball}: ${err.message}`)); }); - console.debug(`[plugins] Running Yarn install in "${pluginDir}"`); + console.log(`[plugins] Running Yarn install in "${pluginDir}"`); w.on('end', () => { childProcess.execFile( process.execPath, @@ -88,7 +88,7 @@ export default async function (moduleName: string): Promise { async function _isInsomniaPlugin (moduleName: string): Promise { return new Promise((resolve, reject) => { - console.debug(`[plugins] Fetching module info from npm`); + console.log(`[plugins] Fetching module info from npm`); childProcess.execFile( process.execPath, [YARN_PATH, 'info', moduleName, '--json'], @@ -124,7 +124,7 @@ async function _isInsomniaPlugin (moduleName: string): Promise { return; } - console.debug(`[plugins] Detected Insomnia plugin ${data.name}`); + console.log(`[plugins] Detected Insomnia plugin ${data.name}`); resolve({ insomnia: data.insomnia, diff --git a/app/sync/crypt.js b/app/sync/crypt.js index b47396d5ff..40efa0fe52 100644 --- a/app/sync/crypt.js +++ b/app/sync/crypt.js @@ -176,7 +176,7 @@ export async function generateAES256Key () { const subtle = c ? c.subtle || c.webkitSubtle : null; if (subtle) { - console.debug('[crypt] Using Native AES Key Generation'); + console.log('[crypt] Using Native AES Key Generation'); const key = await subtle.generateKey( {name: 'AES-GCM', length: 256}, true, @@ -184,7 +184,7 @@ export async function generateAES256Key () { ); return subtle.exportKey('jwk', key); } else { - console.debug('[crypt] Using Fallback Forge AES Key Generation'); + console.log('[crypt] Using Fallback Forge AES Key Generation'); const key = forge.util.bytesToHex(forge.random.getBytesSync(32)); return { kty: 'oct', @@ -206,7 +206,7 @@ export async function generateKeyPairJWK () { const subtle = window.crypto && window.crypto.subtle; if (subtle) { - console.debug('[crypt] Using Native RSA Generation'); + console.log('[crypt] Using Native RSA Generation'); const pair = await subtle.generateKey( { @@ -224,7 +224,7 @@ export async function generateKeyPairJWK () { privateKey: await subtle.exportKey('jwk', pair.privateKey) }; } else { - console.debug('[crypt] Using Forge RSA Generation'); + console.log('[crypt] Using Forge RSA Generation'); const pair = forge.pki.rsa.generateKeyPair({bits: 2048, e: 0x10001}); const privateKey = { @@ -308,7 +308,7 @@ function _b64UrlToHex (s) { */ async function _pbkdf2Passphrase (passphrase, salt) { if (window.crypto && window.crypto.subtle) { - console.debug('[crypt] Using native PBKDF2'); + console.log('[crypt] Using native PBKDF2'); const k = await window.crypto.subtle.importKey( 'raw', @@ -328,7 +328,7 @@ async function _pbkdf2Passphrase (passphrase, salt) { const derivedKeyRaw = await window.crypto.subtle.deriveBits(algo, k, DEFAULT_BYTE_LENGTH * 8); return Buffer.from(derivedKeyRaw).toString('hex'); } else { - console.debug('[crypt] Using Forge PBKDF2'); + console.log('[crypt] Using Forge PBKDF2'); const derivedKeyRaw = forge.pkcs5.pbkdf2( passphrase, forge.util.hexToBytes(salt), diff --git a/app/sync/storage.js b/app/sync/storage.js index 2331b67932..4db4f288e4 100644 --- a/app/sync/storage.js +++ b/app/sync/storage.js @@ -210,7 +210,7 @@ export function initDB (config, forceReset) { } // Done - console.debug(`[sync] Initialize Sync DB at ${basePath}`); + console.log(`[sync] Initialize Sync DB at ${basePath}`); } } diff --git a/app/ui/containers/app.js b/app/ui/containers/app.js index 9c0393ad82..7215db115e 100644 --- a/app/ui/containers/app.js +++ b/app/ui/containers/app.js @@ -747,7 +747,7 @@ class App extends PureComponent { } if (e.dataTransfer.files.length === 0) { - console.debug('[drag] Ignored drop event because no files present'); + console.log('[drag] Ignored drop event because no files present'); return; } @@ -1013,7 +1013,7 @@ async function _moveDoc (docToMove, parentId, targetId, targetOffset) { // If sort keys get too close together, we need to redistribute the list. This is // not performant at all (need to update all siblings in DB), but it is extremely rare // anyway - console.debug(`[app] Recreating Sort Keys ${beforeKey} ${afterKey}`); + console.log(`[app] Recreating Sort Keys ${beforeKey} ${afterKey}`); db.bufferChanges(300); docs.map((r, i) => __updateDoc(r, {metaSortKey: i * 100, parentId}));