googleapis / nodejs-logging

Node.js client for Stackdriver Logging: Store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services (AWS).
https://cloud.google.com/logging/
Apache License 2.0
173 stars 63 forks source link

README client constructor example incorrect (likely out of date). #1533

Open orrymr opened 4 weeks ago

orrymr commented 4 weeks ago

In the Using the client library part of the readme, we have the following snippet of code:

// Creates a client
const logging = new Logging({projectId});

However, I believe this should be changed to:

// Creates a client
const logging = new Logging();
logging.setProjectId({projectId});

My assumption is that projectId was removed from the constructor in order to allow the client to dynamically connect to several projects; that is during the running of the program it may dynamically switch which project it is connect to.

I am using "@google-cloud/logging": "^11.2.0"