Skip to content

@google-cloud/logging v0.4.0

Compare
Choose a tag to compare
@stephenplusplus stephenplusplus released this 17 Oct 23:08
· 22390 commits to main since this release

Updating

$ npm install @google-cloud/logging@0.4.0

⚠️ Breaking Changes

Promises have arrived!

Issue: #551
PR: #1707

It's been a long time coming, but we're finally here. We've shipped promise support in the Stackdriver Logging module!

Do I have to use promises?

Nope, carry on. (But keep reading if you use streams)

How do I use promises?

Don't pass a callback:

var logging = require('@google-cloud/logging')();

logging.getEntries()
  .then(function(data) {
    var entities = data[0];
  })
  .catch(function(err) {});
How do I use a method as a stream?

All of the streaming functionality from our methods have been moved to their own method.

var logging = require('@google-cloud/logging')();

- logging.getEntries()
+ logging.getEntriesStream()
   .on('data', function(entry) {})

- logging.getSinks()
+ logging.getSinksStream()
   .on('data', function(sink) {})
var log = logging.log('syslog');

- log.getEntries()
+ log.getEntriesStream()
   .on('data', function(entry) {})