Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Send 'error' log messages to stderr. #14

Merged
merged 1 commit into from

2 participants

Evan Goer Ryan Grove
Evan Goer

This would make it a little cleaner for me to handle errors when automating the Selleck CLI.

Ryan Grove rgrove merged commit 6448d04 into from
Ryan Grove
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 5, 2012
  1. Evan Goer
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/selleck.js
15 lib/selleck.js
View
@@ -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;
Something went wrong with that request. Please try again.