Permalink
Browse files

misc refactoring of colors option

  • Loading branch information...
1 parent 1338cc3 commit d874f28b4a3e3566bc96f82eb71d5a4cefc59621 @tj tj committed May 19, 2011
Showing with 7 additions and 8 deletions.
  1. +1 −1 docs/debug.md
  2. +1 −1 examples/debug.js
  3. +5 −6 lib/plugins/debug.js
View
2 docs/debug.md
@@ -28,4 +28,4 @@ Outputs verbose debugging information to _stderr_.
### Options
- - `color` enable color output, defaults to true
+ - `colors` enable color output, defaults to true
View
2 examples/debug.js
@@ -16,5 +16,5 @@ var server = http.createServer(function(req, res){
cluster(server)
.set('workers', 4)
.use(cluster.logger('logs', 'debug'))
- .use(cluster.debug({ colors: false }))
+ .use(cluster.debug())
.listen(3000);
View
11 lib/plugins/debug.js
@@ -15,16 +15,15 @@
module.exports = function(options){
options = options || {};
+ // strip colors
+
function color(text) {
- if (options.colors === false) {
- return text.replace(/\033\[\d+m/g, '')
- }
+ if (options.colors === false) return text.replace(/\033\[\d+m/g, '');
return text
}
- /**
- * Logger.
- */
+ // logger
+
var log = {
debug: function(str){
console.error(color(' \033[90mdebug - %s\033[0m'), str);

0 comments on commit d874f28

Please sign in to comment.