wallet-core/node_modules/fancy-log/index.js
Florian Dold 82f2b76e25
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules
into one file (plus commons chunks) for every entry point.  This results
in a much smaller extension size (almost half).  Furthermore we use
yarn/npm even for extension run-time dependencies.  This relieves us
from manually vendoring and building dependencies.  It's also easier to
understand for new developers familiar with node.
2017-04-24 16:14:29 +02:00

52 lines
1.1 KiB
JavaScript

'use strict';
/*
Initial code from https://github.com/gulpjs/gulp-util/blob/v3.0.6/lib/log.js
*/
var chalk = require('chalk');
var timestamp = require('time-stamp');
function getTimestamp(){
return '['+chalk.grey(timestamp('HH:mm:ss'))+']';
}
function log(){
var time = getTimestamp();
process.stdout.write(time + ' ');
console.log.apply(console, arguments);
return this;
}
function info(){
var time = getTimestamp();
process.stdout.write(time + ' ');
console.info.apply(console, arguments);
return this;
}
function dir(){
var time = getTimestamp();
process.stdout.write(time + ' ');
console.dir.apply(console, arguments);
return this;
}
function warn(){
var time = getTimestamp();
process.stderr.write(time + ' ');
console.warn.apply(console, arguments);
return this;
}
function error(){
var time = getTimestamp();
process.stderr.write(time + ' ');
console.error.apply(console, arguments);
return this;
}
module.exports = log;
module.exports.info = info;
module.exports.dir = dir;
module.exports.warn = warn;
module.exports.error = error;