Permalink
Browse files

Update lib/clog.js

support console.log formatting behavior.
  • Loading branch information...
1 parent c9b6fa0 commit 83cd23497c82652158e1ddcf9f7d0286b0be929e @bennidhamma bennidhamma committed Aug 23, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/clog.js
View
@@ -119,14 +119,14 @@ Clog.prototype.configure = function (config) {
* Log method.
*/
-Clog.prototype.log = function (type) {
-
+Clog.prototype.log = function (type, msg) {
+ var msgIsString = typeof (msg) == 'string';
levels[type] !== false && console.log.apply(
console
, [colors[type]
- ? '\033[' + colors[type] + 'm' + type + ':\033[39m'
- : '\033[37m' + type + ':\033[39m'
- ].concat(toArray(arguments).slice(1))
+ ? '\033[' + colors[type] + 'm' + type + ':\033[39m ' + (msgIsString ? msg : '')
+ : '\033[37m' + type + ':\033[39m ' + (msgIsString ? msg : '')
+ ].concat(toArray(arguments).slice(msgIsString ? 2 : 1))
);
return levels[type];

0 comments on commit 83cd234

Please sign in to comment.