2017-06-08 10:52:47 +00:00
|
|
|
// Generated by CoffeeScript 1.12.6
|
2017-04-24 12:48:43 +00:00
|
|
|
var eol;
|
|
|
|
|
|
|
|
eol = require('os').EOL;
|
|
|
|
|
|
|
|
exports.getLogStreams = function() {
|
|
|
|
var StreamLogger, _, colors, logger, streams;
|
|
|
|
StreamLogger = require('resin-stream-logger').StreamLogger;
|
|
|
|
colors = require('colors');
|
|
|
|
_ = require('lodash');
|
|
|
|
logger = new StreamLogger();
|
|
|
|
logger.addPrefix('build', colors.blue('[Build]'));
|
|
|
|
logger.addPrefix('info', colors.cyan('[Info]'));
|
|
|
|
logger.addPrefix('debug', colors.magenta('[Debug]'));
|
|
|
|
logger.addPrefix('success', colors.green('[Success]'));
|
|
|
|
logger.addPrefix('warn', colors.yellow('[Warn]'));
|
2017-04-24 10:06:53 +00:00
|
|
|
logger.addPrefix('error', colors.red('[Error]'));
|
2017-04-24 12:48:43 +00:00
|
|
|
streams = {
|
|
|
|
build: logger.createLogStream('build'),
|
|
|
|
info: logger.createLogStream('info'),
|
|
|
|
debug: logger.createLogStream('debug'),
|
|
|
|
success: logger.createLogStream('success'),
|
2017-04-24 10:06:53 +00:00
|
|
|
warn: logger.createLogStream('warn'),
|
|
|
|
error: logger.createLogStream('error')
|
2017-04-24 12:48:43 +00:00
|
|
|
};
|
|
|
|
_.mapKeys(streams, function(stream, key) {
|
|
|
|
if (key !== 'debug') {
|
|
|
|
return stream.pipe(process.stdout);
|
|
|
|
} else {
|
|
|
|
if (process.env.DEBUG != null) {
|
|
|
|
return stream.pipe(process.stdout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return streams;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.logInfo = function(logStreams, msg) {
|
|
|
|
return logStreams.info.write(msg + eol);
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.logDebug = function(logStreams, msg) {
|
|
|
|
return logStreams.debug.write(msg + eol);
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.logSuccess = function(logStreams, msg) {
|
|
|
|
return logStreams.success.write(msg + eol);
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.logWarn = function(logStreams, msg) {
|
|
|
|
return logStreams.warn.write(msg + eol);
|
|
|
|
};
|
2017-04-24 10:06:53 +00:00
|
|
|
|
|
|
|
exports.logError = function(logStreams, msg) {
|
|
|
|
return logStreams.error.write(msg + eol);
|
|
|
|
};
|