Skip to content
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

[browser logging] allow to configure root level #176397

Merged
merged 8 commits into from
Feb 12, 2024

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Feb 7, 2024

Summary

Part of #144276

  • Introduce the concept of browser-side logging configuration, via a logging.browser config prefix
  • Allow to configure the log level for the root browser logger via logging.browser.root.level
  • Set the default level to info for both dev and production mode (consistent with server-side logging)

@pgayvallet pgayvallet added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Logging labels Feb 7, 2024
@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet
Copy link
Contributor Author

/ci

Copy link
Contributor Author

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

Self-review / comments

Comment on lines +11 to +23
/**
* @internal
*/
export interface BrowserLoggingConfig {
root: BrowserRootLoggerConfig;
}

/**
* @internal
*/
export interface BrowserRootLoggerConfig {
level: LogLevelId;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Base types for the browser-side logging config. It's simplistic right now, but more fields should appear when we go further on #144276

@@ -63,6 +69,7 @@ export const config = {
}),
level: levelSchema,
}),
browser: browserConfig,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm exposing the browser logging configuration via the logging.browser config prefix. So the browser-side config is "included" in the server-side logging prefix that is logging.

I wasn't sure, but in the end I still think it makes sense to have a single prefix (and that it isn't worth introducing heavy changes to move the server-side logging under the logging.server prefix either), but please tell if you think otherwise or have another idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to have them symmetrical, but I think logging.browser.* is fine

Comment on lines +136 to +138
this.initContext.logger.debug<EventDebugLogMeta>(`Report event "${eventType}"`, {
ebt_event: event,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer needs this isDev check now that the default level is info and is configurable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +136 to +138
# Enables debug logging on the browser (dev console)
#logging.browser.root:
# level: debug
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure it was really needed given right now it's mostly for internal/development usage, but I still added a snippet in the config file.

@pgayvallet pgayvallet marked this pull request as ready for review February 8, 2024 12:52
@pgayvallet pgayvallet requested a review from a team as a code owner February 8, 2024 12:52
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet pgayvallet added release_note:skip Skip the PR/issue when compiling release notes v8.14.0 v8.13.0 and removed v8.14.0 labels Feb 8, 2024
Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Did not test locally, code LGTM!

Comment on lines +136 to +138
this.initContext.logger.debug<EventDebugLogMeta>(`Report event "${eventType}"`, {
ebt_event: event,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -63,6 +69,7 @@ export const config = {
}),
level: levelSchema,
}),
browser: browserConfig,
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to have them symmetrical, but I think logging.browser.* is fine

@pgayvallet pgayvallet enabled auto-merge (squash) February 9, 2024 14:26
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 385.4KB 385.3KB -61.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pgayvallet pgayvallet merged commit 1dc0076 into elastic:main Feb 12, 2024
16 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Feb 12, 2024
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

Part of elastic#144276

- Introduce the concept of browser-side logging configuration, via a
`logging.browser` config prefix
- Allow to configure the log level for the root browser logger via
`logging.browser.root.level`
- Set the default level to `info` for both dev and production mode
(consistent with server-side logging)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

Part of elastic#144276

- Introduce the concept of browser-side logging configuration, via a
`logging.browser` config prefix
- Allow to configure the log level for the root browser logger via
`logging.browser.root.level`
- Set the default level to `info` for both dev and production mode
(consistent with server-side logging)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
## Summary

Part of elastic#144276

- Introduce the concept of browser-side logging configuration, via a
`logging.browser` config prefix
- Allow to configure the log level for the root browser logger via
`logging.browser.root.level`
- Set the default level to `info` for both dev and production mode
(consistent with server-side logging)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Logging release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants