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

Initial import of logging-bunyan #1977

Merged
merged 8 commits into from
Feb 14, 2017

Conversation

ofrobots
Copy link
Contributor

@ofrobots ofrobots commented Feb 9, 2017

This PR adds a new module @google-cloud/logging-bunyan that provides simple, minimal config way of logging to Stackdriver Logging from applications using bunyan.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 9, 2017

'use strict';

var assert = require('assert');

This comment was marked as spam.

This comment was marked as spam.

@zbjornson
Copy link
Contributor

zbjornson commented Feb 9, 2017

Hello! There's an unofficial, moderately popular Bunyan transport as well: https://github.com/mlazarov/bunyan-stackdriver

If it helps, the key differences I see are:

@ofrobots
Copy link
Contributor Author

ofrobots commented Feb 9, 2017

Hello @zbjornson! Thanks for chiming in. We wanted to start officially support a module for working with bunyan (and winston: #1830). It would be great to have your collaboration.

This is an initial version of the library here, but I do have some thoughts on the points you highlighted:

  • Batching: It would good to have batching indeed, and we need it for logging-winston too, but ideally batching should be built into the base logging library. This is something we have to hash out still. /cc @stephenplusplus
  • We do need to deal with circular log entries and non JSON values in this module (and in logging-winston).
  • I was not familiar with Bunyan's reemitErrorEvents. Thanks for pointing it out.

We can start addressing these in follow-ons. Again, collaboration would be most welcome!

@zbjornson
Copy link
Contributor

Sounds great! I'm a bit short on time for the next few days to actually code, but happy to review and discuss anything. Let me know how I can help.

@ofrobots
Copy link
Contributor Author

@GoogleCloudPlatform/node-team, @stephenplusplus This is ready for review. PTAL.

Copy link
Contributor

@matthewloring matthewloring left a comment

Choose a reason for hiding this comment

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

Do we want to check in the yarn.lock file?

@ofrobots
Copy link
Contributor Author

ofrobots commented Feb 10, 2017 via email

streams: [loggingBunyan.stream('info')]
});

logger.error('warp nacelles offline');

This comment was marked as spam.

@@ -0,0 +1,46 @@
{
"name": "@google-cloud/logging-bunyan",
"version": "0.0.0",

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

this.log_[level](entry, function() {});
};

module.exports = LoggingBunyan;

This comment was marked as spam.

This comment was marked as spam.

});

});
});

This comment was marked as spam.

This comment was marked as spam.

'@google-cloud/logging-bunyan only works as a raw bunyan stream type.');
}
var level = BUNYAN_TO_STACKDRIVER[rec.level];
var entryMetadata = {resource: this.resource_, timestamp: rec.time};

This comment was marked as spam.

This comment was marked as spam.


options = options || {};

this.logName_ = options.logName || 'bunyan_log';

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@stephenplusplus
Copy link
Contributor

Once functionality is approved by the reviewers, I'll do some simple linting/style stuff.

@ofrobots
Copy link
Contributor Author

@zbjornson for the issues/feature requests you raised:

@zbjornson
Copy link
Contributor

bueno, thanks! Looks like everything is addressed here or tracked in other issues.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Feb 13, 2017
@stephenplusplus
Copy link
Contributor

@ofrobots I went over it for lint/nit/style changes. The biggest change was probably that I removed tests that were using the Bunyan module inside of the unit test file for index.js. I saw the system tests were using the real module, so if more testing with Bunyan is needed, please pop them in there.

@ofrobots
Copy link
Contributor Author

LGTM. The removed tests are not that significant test of the interop to be really worth keeping.

@@ -35,19 +29,12 @@ logger.info('shields at 99%');

It's incredibly easy to get authenticated and start using Google's APIs. You can set your credentials on a global basis as well as on a per-API basis. See each individual API section below to see how you can auth on a per-API-basis. This is useful if you want to use different accounts for different Google Cloud services.

### On Google Cloud Platform
### On Google Compute Engine

This comment was marked as spam.

This comment was marked as spam.

@ofrobots
Copy link
Contributor Author

Let us know if there is anything more needed from our side before this can land. Once this lands, we can start work on some follow-on PRs.

@stephenplusplus
Copy link
Contributor

Just waiting on me?

@stephenplusplus stephenplusplus merged commit 49a7beb into googleapis:master Feb 14, 2017
@ofrobots ofrobots deleted the logging-bunyan branch February 14, 2017 21:53
@stephenplusplus
Copy link
Contributor

@google-cloud/[email protected] published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: no This human has *not* signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants