Skip to content

Client logging API: methods for users to access the SDK's log messages #2434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Mar 13, 2020

Conversation

hsubox76
Copy link
Contributor

Adds

  • firebase.setLogLevel() - set threshhold log level to show
  • firebase.onLog() - add a user specified callback that has access to log level, message, and name of package (e.g. app, firestore, auth) that logged it

Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it's pretty good. A couple of things:

  1. The implementation is different than the proposal where the instance of the service is passed to the user defined callback as a parameter. We should update the proposal with the reasons for the new API and get the approval again.

  2. Performance has a special logger to upload performance metrics to the backend.
    Any action on it should not trigger the user defined onLog callback. We will need to introduce a flag or something to tell the special loggers apart and they should not participate in onLog.
    https://github.com/firebase/firebase-js-sdk/blob/master/packages/performance/src/services/perf_logger.ts#L95

I actually think it's a misuse for perf to use @firebase/logger for the purpose of uploading metrics. So another approach can change perf to not use @firebase/logger for uploading metrics.

@hsubox76
Copy link
Contributor Author

I am making a PR for the perf logger conflict issue: #2460.

@hsubox76 hsubox76 changed the title WIP: Add methods for users to access the SDK's log messages Add methods for users to access the SDK's log messages Mar 3, 2020
@hsubox76 hsubox76 changed the title Add methods for users to access the SDK's log messages Client logging API: methods for users to access the SDK's log messages Mar 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants