mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2025-01-08 13:41:59 -05:00
use minilog for logging, like scratch-gui
This commit is contained in:
parent
5abc787f1b
commit
229c42469d
4 changed files with 31 additions and 4 deletions
15
package-lock.json
generated
15
package-lock.json
generated
|
@ -7314,6 +7314,12 @@
|
|||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
|
||||
"dev": true
|
||||
},
|
||||
"microee": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/microee/-/microee-0.0.6.tgz",
|
||||
"integrity": "sha1-oSvbAQNoHosSapsHHrpMRnx4//4=",
|
||||
"dev": true
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "3.1.10",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
|
||||
|
@ -7438,6 +7444,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"minilog": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minilog/-/minilog-3.1.0.tgz",
|
||||
"integrity": "sha1-0tDxiHyjY9Gs8OqG1cTfKTs/tnU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"microee": "0.0.6"
|
||||
}
|
||||
},
|
||||
"minimalistic-assert": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
"intl": "1.2.5",
|
||||
"lodash.bindall": "^4.4.0",
|
||||
"lodash.defaultsdeep": "^4.6.1",
|
||||
"minilog": "^3.1.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"nets": "^3.2.0",
|
||||
"react": "16.2.0",
|
||||
|
|
12
src/common/log.js
Normal file
12
src/common/log.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import minilog from 'minilog';
|
||||
minilog.enable();
|
||||
|
||||
const namespace = (() => {
|
||||
switch (process.type) {
|
||||
case 'browser': return 'main';
|
||||
case 'renderer': return 'web';
|
||||
default: return process.type; // probably 'worker' for a web worker
|
||||
}
|
||||
})();
|
||||
|
||||
export default minilog(`app-${namespace}`);
|
|
@ -6,6 +6,7 @@ import {URL} from 'url';
|
|||
import {getFilterForExtension} from './FileFilters';
|
||||
import telemetry from './ScratchDesktopTelemetry';
|
||||
import MacOSMenu from './MacOSMenu';
|
||||
import log from '../common/log.js';
|
||||
|
||||
telemetry.appWasOpened();
|
||||
|
||||
|
@ -290,10 +291,8 @@ app.on('ready', () => {
|
|||
// WARNING: depending on a lot of things including the version of Electron `installExtension` might
|
||||
// return a promise that never resolves, especially if the extension is already installed.
|
||||
installExtension(extension).then(
|
||||
// eslint-disable-next-line no-console
|
||||
extensionName => console.log(`Installed dev extension: ${extensionName}`),
|
||||
// eslint-disable-next-line no-console
|
||||
errorMessage => console.error(`Error installing dev extension: ${errorMessage}`)
|
||||
extensionName => log(`Installed dev extension: ${extensionName}`),
|
||||
errorMessage => log.error(`Error installing dev extension: ${errorMessage}`)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue