Permalink
Browse files

Restored CLI and log colors.

  • Loading branch information...
marcominetti committed Nov 7, 2015
1 parent 0c45893 commit 0bb3cbfe0e6c0818609efe7bd02de864adac203c
Showing with 17 additions and 33 deletions.
  1. +7 −15 core/bootstrap.server.js
  2. +8 −15 core/cluster/bootstrap.server.js
  3. +2 −3 main.server.js
View
@@ -75,19 +75,10 @@ platform.configuration.runtime.testing = global.testing;
platform.configuration.runtime.path = global.main.path;
console.logger = new native.winston.Logger({
- levels: {
- trace: 0,
- verbose: 2,
- debug: 4,
- info: 5,
- data: 6,
- warn: 7,
- error: 8
- },
colors: {
trace: 'magenta',
verbose: 'cyan',
- debug: 'blue',
+ debug: 'cyan',
info: 'green',
data: 'grey',
warn: 'yellow',
@@ -97,17 +88,18 @@ console.logger = new native.winston.Logger({
native.winston.config.addColors({
trace: 'magenta',
verbose: 'cyan',
- debug: 'blue',
+ debug: 'cyan',
info: 'green',
data: 'grey',
warn: 'yellow',
error: 'red'
});
console.logger.formatters = console.logger.formatters || {};
console.logger.formatters.console = function(options) {
- return (new Date()).toISOString() + ' ' + options.label + ' ' +
+ return native.winston.config.colorize('data',(new Date()).toISOString()) + ' ' +
+ native.winston.config.colorize('trace', options.label) + ' ' +
native.winston.config.colorize(options.level, options.level.toLowerCase()) + ': ' +
- native.winston.config.colorize(options.level,((options.message != null) ? options.message : '')) +
+ ((options.message != null) ? options.message : '') +
((options.meta != null && Object.keys(options.meta).length > 0) ?
'\n' + native.util.inspect(options.meta, {'colors': true, 'depth': null}) :
'');
@@ -289,7 +281,7 @@ bootstrap.post = async function() {
return source_path.replace(/^(\.\.\/)*/g, '../../../');
});
var dist_source_code = native.fs.readFileSync(native.path.join(native.compile.basepath, relativepath),
- {'encoding': 'utf8'});
+ {'encoding': 'utf8'});
bootstrap.dist.core.add(
'../../../' + path.replace(/\\/g, '/'),
dist_source_code.replace(/\n\s*\/\/\# sourceMappingURL=.*?\n|\n\s*\/\/\# sourceMappingURL=.*?$/gi, ''),
@@ -414,7 +406,7 @@ bootstrap.load.file = function(path, root, callback) {
return source_path.replace(/^(\.\.\/)*/g, '../../../') + '.boot';
});
var dist_source_code = native.fs.readFileSync(native.path.join(native.compile.basepath, relativepath) +
- '.' + basename + '.boot', {'encoding': 'utf8'});
+ '.' + basename + '.boot', {'encoding': 'utf8'});
bootstrap.dist.boot.add(
'../../../' + path.replace(/\\/g, '/') + '.boot',
dist_source_code.replace(/\n\s*\/\/\# sourceMappingURL=.*?\n|\n\s*\/\/\# sourceMappingURL=.*?$/gi, ''),
@@ -206,19 +206,10 @@ platform.cluster.worker.role = process.env.CLUSTER_NODE_ROLE || 'master';
platform.cluster.worker.master = native.cluster.isMaster;
console.logger = new native.winston.Logger({
- levels: {
- trace: 0,
- verbose: 2,
- debug: 4,
- info: 5,
- data: 6,
- warn: 7,
- error: 8
- },
colors: {
trace: 'magenta',
verbose: 'cyan',
- debug: 'blue',
+ debug: 'cyan',
info: 'green',
data: 'grey',
warn: 'yellow',
@@ -228,19 +219,21 @@ console.logger = new native.winston.Logger({
native.winston.config.addColors({
trace: 'magenta',
verbose: 'cyan',
- debug: 'blue',
+ debug: 'cyan',
info: 'green',
data: 'grey',
warn: 'yellow',
error: 'red'
});
console.logger.formatters = console.logger.formatters || {};
console.logger.formatters.console = function(options) {
- return (new Date()).toISOString() + ' ' + options.label + ' ' +
+ return native.winston.config.colorize('data',(new Date()).toISOString()) + ' ' +
+ native.winston.config.colorize('trace', options.label) + ' ' +
native.winston.config.colorize(options.level, options.level.toLowerCase()) + ': ' +
- native.winston.config.colorize(options.level,((options.message != null) ? options.message : '')) +
- ((options.meta != null && Object.keys(options.meta).length > 0) ? '\n' +
- native.util.inspect(options.meta, {'colors': true, 'depth': null}) : '');
+ ((options.message != null) ? options.message : '') +
+ ((options.meta != null && Object.keys(options.meta).length > 0) ?
+ '\n' + native.util.inspect(options.meta, {'colors': true, 'depth': null}) :
+ '');
};
console.logger.formatters.file = function(options) {
return JSON.stringify({
View
@@ -69,12 +69,11 @@ if (process.env.NODE_WRAPPER_MAIN !== 'false' && process.env.NODE_LOW_MEMORY !==
var parallel_process = child_process.spawn(path.join(parallel_node_path, 'node'), execArgv.concat(args), {
'cwd': process.cwd(),
- 'env': env
+ 'env': env,
+ 'stdio': 'inherit'
});
args = null;
execArgv = null;
- parallel_process.stderr.pipe(process.stderr);
- parallel_process.stdout.pipe(process.stdout);
['exit', 'SIGTERM', 'SIGINT'].forEach(function(e) {
process.on(e, function() {
parallel_process.kill();

0 comments on commit 0bb3cbf

Please sign in to comment.