kopia lustrzana https://github.com/c9/core
Add callback to log function. Fix logging
rodzic
5195df553e
commit
ffca6961fd
|
@ -109,6 +109,7 @@ module.exports = function(options) {
|
|||
|
||||
// VFS
|
||||
"plugins/c9.vfs.client/vfs.ping",
|
||||
"plugins/c9.vfs.client/vfs.log",
|
||||
{
|
||||
packagePath: "plugins/c9.vfs.client/vfs_client",
|
||||
debug: debug,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
module.exports = function(vfs, options, register) {
|
||||
register(null, {
|
||||
log: function(message, callback) {
|
||||
console.log("VFSLOG: " + message);
|
||||
console.error("VFSERROR: " + message);
|
||||
log: function (message, callback) {
|
||||
callback = callback || function(){};
|
||||
|
||||
console.log(message);
|
||||
callback();
|
||||
}
|
||||
})
|
||||
|
|
|
@ -44,8 +44,13 @@ define(function (require, exports, module) {
|
|||
|
||||
function log() {
|
||||
if (!server) return console.error("Cannot log, client is offline");
|
||||
var callback = function(){};
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (typeof args[args.length-1] === "function") {
|
||||
callback = args.splice(args.length-1, 1);
|
||||
}
|
||||
|
||||
var message = "";
|
||||
args.forEach(function (arg) {
|
||||
if (typeof arg === "object") {
|
||||
|
@ -54,7 +59,7 @@ define(function (require, exports, module) {
|
|||
message += arg;
|
||||
});
|
||||
|
||||
server.log(message);
|
||||
server.log(message, callback);
|
||||
}
|
||||
|
||||
plugin.on("load", function() {
|
||||
|
|
Ładowanie…
Reference in New Issue