Skip to content
Browse files

Send 'error' log messages to stderr.

  • Loading branch information...
1 parent 0683deb commit 6f4664e808e071d729fd5487e672c716d18af299 @evangoer evangoer committed Sep 4, 2012
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/selleck.js
View
15 lib/selleck.js
@@ -284,10 +284,21 @@ function isProjectDirectory(dir) {
exports.isProjectDirectory = isProjectDirectory;
/**
-@method log
+Logs a message to stdout or stderr, with an optional log level.
+
+@method log
+@param {String} message A message to write to the console.
+@param {String} [level] A short string describing the type of message.
+ If the level is 'error', Selleck logs the message to stderr.
+ Otherwise, Selleck logs the message to stdout.
+ The default level is 'info'.
**/
function log(message, level) {
- console.log('[' + (level || 'info') + '] ' + message);
+ if (level === 'error') {
+ console.error('[error] ' + message);
+ } else {
+ console.log('[' + (level || 'info') + '] ' + message);
+ }
}
exports.log = log;

0 comments on commit 6f4664e

Please sign in to comment.
Something went wrong with that request. Please try again.