@google-cloud/logging v0.4.0
⚠️ Breaking Changes
Promises have arrived!
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) {})