Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to suppress startup banner #24

Closed
wants to merge 5 commits into from
Closed

Conversation

bodawei
Copy link
Contributor

@bodawei bodawei commented Sep 26, 2017

This is a proposal of a solution to #23

Problem

When running lots of integration-type tests using the electrode server, we end up with a lot of "noise" in our logs with the "Hapi.js server running" message that gets printed automatically.

Proposed Solution

This adds an optional configuration value:

electrode: {
  suppressStartupBanner: true
}

which, if set to true, will cause Electrode Server to not display its startup banner.

This includes the code change, a doc change, and a test to validate it works.

@jchip
Copy link
Member

jchip commented Nov 27, 2017

I prefer something more generic than a specific option like suppressStartupBanner though.
For example, maybe name it verbose. It could be a boolean or even a level (numeric or label like info, warn, error).

Internally we have a dedicate module that's like a slightly more glorified console that allows setting an env level to suppress any kind of information logs from our modules.

@bodawei
Copy link
Contributor Author

bodawei commented Nov 29, 2017

That sounds reasonable. I'm inclined to do the following, then:

  1. change the configuration to property name to logLevel
  2. Create a simple type called something like logger, which has three methods: info(), warn(), error(). electrode-server.js would instantiate one with the setting from logLevel. the logger instance would just turn around and call console.log|warn|error, but only if the function is >= logLevel (thus, if logLevel is 'warn', and error() is called, it would print, but info() would not)
  3. replace all calls to console.() with logger.().

Other thoughts:

  • @jchip I'm not sure how this would or would not fit with your internal more glorified system. Thoughts?
  • I'm inclined to leave the property in the electrode object in the config, but I could see an argument for promoting it in some way and offering it as something all plugins could look for and live off of, thus allowing any plugin to look at this level and decide whether to print.

@jchip
Copy link
Member

jchip commented Dec 13, 2017

@bodawei sounds good.

@CLAassistant
Copy link

CLAassistant commented Dec 23, 2017

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Deej Burrowes seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@bodawei
Copy link
Contributor Author

bodawei commented Dec 24, 2017

Snafu'ed this. Replaced with: #27

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

Successfully merging this pull request may close these issues.

None yet

3 participants