actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
900 stars 197 forks source link

Support configuring loggers #413

Open pierredelisle7 opened 3 years ago

pierredelisle7 commented 3 years ago

See https://github.com/googlecodelabs/smarthome-washer/issues/39 for background information.

The ask is for the node.js smarthome client library to support configuring its various loggers (debug, info, warn, error).

The ability to configure the loggers would, for example, allow client applications that use firebase cloud functions to improve substantially the readability of their logs as is shown below.

Currently, one log message coming from this client library appears with multiple log entries in the "firebase cloud functions log console" which impacts readability substantially:

Current logs

If logging were configurable (PR coming shortly), log messages from this library would have a single log entry, which improves readability tremendously:

NewFunctionLogs
proppy commented 3 years ago

It would be interesting to see if we can leverage the existing framework abstraction: https://github.com/actions-on-google/actions-on-google-nodejs/tree/master/src/framework

To automatically use the Firebase Cloud Functions logger SDK when detected that we're deployed in a Firebase Cloud Functions environment.

Looks like this is currently done by running framework specific checks againt the arguments of the handler: https://github.com/actions-on-google/actions-on-google-nodejs/blob/master/src/assistant.ts#L74