-
Notifications
You must be signed in to change notification settings - Fork 26
Configurable log levels for builder itself. #100
Conversation
35a127f
to
d2c0ed6
Compare
@@ -14,6 +14,7 @@ var log = require("../lib/log"); | |||
* @param {Object} [opts] Options object | |||
* @param {Object} [opts.env] Environment object to mutate (Default `process.env`) | |||
* @param {Array} [opts.argv] Arguments array (Default: `process.argv`) | |||
* @param {Array} [opts.msgs] Array of log messages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I correct in understanding that these are not log messages but message templates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Array of { level, type, msg }
. I'll update the comment.
Looks goo! One small code change and a few style comments but otherwise 👍 |
Assuming it works, looks good to me! @baer? |
@@ -14,6 +14,7 @@ var log = require("../lib/log"); | |||
* @param {Object} [opts] Options object | |||
* @param {Object} [opts.env] Environment object to mutate (Default `process.env`) | |||
* @param {Array} [opts.argv] Arguments array (Default: `process.argv`) | |||
* @param {Array} [opts.msgs] Array of log messages (`{ level, type, msg }`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be more clear as "message-templates" or something since these are not JUST messages but that's just a personal preference
A few style things but other than that this is airtight. 👍 |
* Refactor `builder.js` to pass a buffer of messages to builder to be later logged. * Refactor to queue up log statements until `log.setLevel()` is called. The issue we're solving is logging in "./environment" when environment is needed to determine what level to log at. * Adds `--log-level=info|warn|error|none` flag. Fixes #6 * Adds `--quiet` flag as alias for `--log-level=none`. * Adds env variable `_BUILDER_ARGS_LOG_LEVEL=info|warn|error|none` to also control. * Add tests and docs.
6e9b658
to
2a7ec90
Compare
Configurable log levels for builder itself.
Posthumous 👍 – nice work ;) |
builder.js
to pass a buffer of messages to builder to belater logged.
log.setLevel()
is called. Theissue we're solving is logging in "./environment" when environment is
needed to determine what level to log at.
--log-level=info|warn|error|none
flag. Fixes Feature: Configurable log levels. #6--quiet
flag as alias for--log-level=none
._BUILDER_ARGS_LOG_LEVEL=info|warn|error|none
to alsocontrol.
These new controls should allow us to easily set things for test commands. Closes #66
Note: I'm not totally sure this won't break in earlier
builder
global installs. We may need to educate folks generally to update if we see any errors forsetLevel()
not being defined / a function./cc @chaseadamsio @shakefon @zachhale @coopy