mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Replace console with minilog
This commit is contained in:
parent
f6c0064235
commit
73edb65c4d
5 changed files with 15 additions and 6 deletions
|
@ -36,6 +36,7 @@
|
|||
"json": "9.0.4",
|
||||
"json-loader": "0.5.4",
|
||||
"lodash.defaultsdeep": "4.6.0",
|
||||
"minilog": "3.0.1",
|
||||
"promise": "7.1.1",
|
||||
"scratch-blocks": "latest",
|
||||
"scratch-render": "latest",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
var log = require('../util/log');
|
||||
var Thread = require('./thread');
|
||||
|
||||
/**
|
||||
|
@ -52,7 +53,7 @@ var execute = function (sequencer, thread) {
|
|||
|
||||
|
||||
if (!opcode) {
|
||||
console.warn('Could not get opcode for block: ' + currentBlockId);
|
||||
log.warn('Could not get opcode for block: ' + currentBlockId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -110,7 +111,7 @@ var execute = function (sequencer, thread) {
|
|||
handleReport(fields[fieldKey].value);
|
||||
}
|
||||
} else {
|
||||
console.warn('Could not get implementation for opcode: ' +
|
||||
log.warn('Could not get implementation for opcode: ' +
|
||||
opcode);
|
||||
}
|
||||
thread.requestScriptGlowInFrame = true;
|
||||
|
@ -234,7 +235,7 @@ var execute = function (sequencer, thread) {
|
|||
}, function (rejectionReason) {
|
||||
// Promise rejected: the primitive had some error.
|
||||
// Log it and proceed.
|
||||
console.warn('Primitive rejected promise: ', rejectionReason);
|
||||
log.warn('Primitive rejected promise: ', rejectionReason);
|
||||
thread.status = Thread.STATUS_RUNNING;
|
||||
thread.popStack();
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@ var Blocks = require('../engine/blocks');
|
|||
var Clone = require('../sprites/clone');
|
||||
var Sprite = require('../sprites/sprite');
|
||||
var Color = require('../util/color.js');
|
||||
var log = require('../util/log');
|
||||
var uid = require('../util/uid');
|
||||
var specMap = require('./sb2specmap');
|
||||
var Variable = require('../engine/variable');
|
||||
|
@ -251,7 +252,7 @@ var parseBlock = function (sb2block) {
|
|||
var oldOpcode = sb2block[0];
|
||||
// Convert the block using the specMap. See sb2specmap.js.
|
||||
if (!oldOpcode || !specMap[oldOpcode]) {
|
||||
console.warn('Couldn\'t find SB2 block: ', oldOpcode);
|
||||
log.warn('Couldn\'t find SB2 block: ', oldOpcode);
|
||||
return;
|
||||
}
|
||||
var blockMetadata = specMap[oldOpcode];
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
var util = require('util');
|
||||
|
||||
var log = require('../util/log');
|
||||
var MathUtil = require('../util/math-util');
|
||||
var Target = require('../engine/target');
|
||||
|
||||
|
@ -211,10 +213,10 @@ Clone.prototype.setSay = function (type, message) {
|
|||
}
|
||||
// @todo: Render to stage.
|
||||
if (!type || !message) {
|
||||
console.log('Clearing say bubble');
|
||||
log.info('Clearing say bubble');
|
||||
return;
|
||||
}
|
||||
console.log('Setting say bubble:', type, message);
|
||||
log.info('Setting say bubble:', type, message);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
4
src/util/log.js
Normal file
4
src/util/log.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
var minilog = require('minilog');
|
||||
minilog.enable();
|
||||
|
||||
module.exports = minilog('vm');
|
Loading…
Reference in a new issue