Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Configurable log levels for builder itself. #100

Merged
merged 1 commit into from
Mar 9, 2016
Merged

Conversation

ryan-roemer
Copy link
Member

  • 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 Feature: Configurable log levels. #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.

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 for setLevel() not being defined / a function.

/cc @chaseadamsio @shakefon @zachhale @coopy

@ryan-roemer ryan-roemer force-pushed the chore-log-levels branch 2 times, most recently from 35a127f to d2c0ed6 Compare March 7, 2016 21:04
@@ -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.
Copy link

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?

Copy link
Member Author

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.

@baer
Copy link

baer commented Mar 8, 2016

Looks goo! One small code change and a few style comments but otherwise 👍

@ryan-roemer
Copy link
Member Author

@baer @zachhale -- Ready for re-review!

@zachhale
Copy link
Contributor

zachhale commented Mar 8, 2016

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 }`)
Copy link

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

@baer
Copy link

baer commented Mar 9, 2016

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.
ryan-roemer added a commit that referenced this pull request Mar 9, 2016
Configurable log levels for builder itself.
@ryan-roemer ryan-roemer merged commit 8f86bee into master Mar 9, 2016
@ryan-roemer ryan-roemer deleted the chore-log-levels branch March 9, 2016 00:31
@coopy
Copy link

coopy commented Mar 9, 2016

Posthumous 👍 – nice work ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants