mirror of
https://github.com/Kong/insomnia.git
synced 2026-05-24 00:30:15 -04:00
console.debug back to console.log
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<Array<RequestParameter>> {
|
||||
async function _sendToGoogle (params: Array<RequestParameter>) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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')}`);
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~ //
|
||||
|
||||
@@ -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);
|
||||
// }
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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, [
|
||||
|
||||
@@ -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()}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ export async function getPlugins (force: boolean = false): Promise<Array<Plugin>
|
||||
};
|
||||
|
||||
plugins.push(plugin);
|
||||
console.debug(`[plugin] Loaded ${modulePath}`);
|
||||
console.log(`[plugin] Loaded ${modulePath}`);
|
||||
} catch (err) {
|
||||
showError({
|
||||
title: 'Plugin Error',
|
||||
|
||||
@@ -29,9 +29,9 @@ export default async function (moduleName: string): Promise<void> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
|
||||
async function _isInsomniaPlugin (moduleName: string): Promise<Object> {
|
||||
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<Object> {
|
||||
return;
|
||||
}
|
||||
|
||||
console.debug(`[plugins] Detected Insomnia plugin ${data.name}`);
|
||||
console.log(`[plugins] Detected Insomnia plugin ${data.name}`);
|
||||
|
||||
resolve({
|
||||
insomnia: data.insomnia,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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}));
|
||||
|
||||
Reference in New Issue
Block a user