Skip to content

Commit

Permalink
colorized logs
Browse files Browse the repository at this point in the history
  • Loading branch information
bkimminich committed Nov 7, 2014
1 parent 2a30644 commit dd3688e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*jslint node: true */
'use strict';

var packageJson = require('../package.json');
var colors = require('colors/safe'),
packageJson = require('../package.json');

exports.queryResultToJson = function(data, status) {
var wrappedData = {};
Expand Down Expand Up @@ -55,7 +56,7 @@ exports.version = function(module) {
exports.solve = function(challenge) {
challenge.solved = true;
challenge.save().success(function() {
console.log('Solved challenge "' + challenge.description + '"');
console.log(colors.green('Solved') + ' challenge "' + challenge.name + '"');
});
};

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"jsonwebtoken": "~1.1",
"pdfkit": "~0.7",
"glob": "~4.0",
"colors": "~1.0",
"grunt": "~0.4",
"grunt-cli": "~0.1",
"grunt-angular-templates": "~0.5",
Expand Down
3 changes: 2 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var application_root = __dirname.replace(/\\/g, '/'),
fs = require('fs'),
glob = require('glob'),
morgan = require('morgan'),
colors = require('colors/safe'),
restful = require('sequelize-restful'),
express = require('express'),
errorhandler = require('errorhandler'),
Expand Down Expand Up @@ -101,7 +102,7 @@ exports.start = function (config, readyCallback) {
models.sequelize.sync().success(function() {
datacreator();
this.server = app.listen(config.port, function () {
console.log('Listening on port %d', config.port);
console.log(colors.cyan('Listening on port %d'), config.port);
// callback to call when the server is ready
if (readyCallback) {
readyCallback();
Expand Down
3 changes: 2 additions & 1 deletion test/e2eTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var spawn = require('win-spawn'),
colors = require('colors/safe'),
server = require('./../server.js');

server.start({ port: 3000 }, function () {
Expand All @@ -15,7 +16,7 @@ server.start({ port: 3000 }, function () {
protractor.stderr.on('data', logToConsole);

protractor.on('exit', function (exitCode) {
console.log('Protractor exited with code ' + exitCode + '.');
console.log('Protractor exited with code ' + exitCode + ' (' + (exitCode === 0 ? colors.green('SUCCESS') : colors.red('FAILED')) + ')');
process.exit(exitCode);
});
});
3 changes: 2 additions & 1 deletion test/serverTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var spawn = require('win-spawn'),
colors = require('colors/safe'),
server = require('./../server.js');

server.start({ port: 3000 }, function () {
Expand All @@ -15,7 +16,7 @@ server.start({ port: 3000 }, function () {
jasmineNode.stderr.on('data', logToConsole);

jasmineNode.on('exit', function (exitCode) {
console.log('Jasmine-Node exited with code ' + exitCode + '.');
console.log('Jasmine-Node exited with code ' + exitCode + '(' + (exitCode === 0 ? colors.green('SUCCESS') : colors.red('FAILED')) + ')');
process.exit(exitCode);
});
});

0 comments on commit dd3688e

Please sign in to comment.