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

Set own custom logger module to apply a log output solution for each platform #338

Closed yoichiro closed 4 years ago

yoichiro commented 5 years ago

Fixes #337

Abstract

This pull request provides a new feature to set own custom logger module.

Detail

This pull request has some modifications like the following:

Developers can define own custom logger with the Logger interface like the following:

const customLogger = {
  debug(message?: any, ...optionParams?: any[]) {
    // Write a log with arguments by own method/format...
  },
  ...
} as Logger;

And, the developers can specify the own logger above with like the following:

import { dialogflow } from `actions-on-google`;

const app = dialogflow({
  logger: customLogger
});
yoichiro commented 4 years ago

After I received some comments from committers, I thought deeply about whether this feature is really necessary or not. As the result, I reached the recognition that current log outputs are for debug of the SDK itself. That is, I think that I should introduce another mechanism to output logs for analytics and so on rather than I change current log output logic. I close this pull request and the related issue. Thank you for the comments and reviewing!