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

Support skipping logger creation if it is provided #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

potatopankakes
Copy link

The allows:

  • an app to provide their own logger.
  • skip the creation of the winston logger.
  • avoid constructing winston transport configuration, when not used.

Copy link

@msluther msluther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a fair enough feature.

The docs could use some updating though to reflect this.
e.g. https://github.com/godaddy/slay#app , https://github.com/godaddy/slay#app-startup-in-detail
And perhaps a sample of how to provide your own logger and what that "interface" for a logger should look like (given that some internal components to slay are going to call methods on app.log).

Also perhaps an e2e test showing that a custom logger can work here without crashing, stuff actually gets logged to it, etc.

@@ -6,7 +6,7 @@ const gulp = require('gulp');
process.env.NODE_ENV = process.env.NODE_ENV || 'development';

require('godaddy-test-tools')(gulp, {
lint: { files: ['*.js', 'lib/**/*.js', 'test/*.js'] },
lint: { files: ['*.js', 'lib/**/*.js', 'test/**/*.js'] },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super familiar with gulp, but depending on platform and how this gets used you may need to include both test/*.js and test/**/*.js.

Copy link
Contributor

@indexzero indexzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable enough indeed, but we should probably put in the effort to discuss the capabilities of such a module an document them in-depth before saying "any object will do for app.log".

A good way to start that discussion is: what logger are you replacing winston with? We can do a capabilities diff from there as a straw person.

@@ -9,6 +9,11 @@ var debug = require('diagnostics')('slay:preboot:logger');
* a winston Logger for this app instance.
*/
module.exports = function (app, options, callback) {
if (app.log) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This capability checking is not quite enough as there are a few calls to app.log.info in the other preboots.

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.

3 participants