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

Logging Intl.Locale objects omits the locale info #21271

Closed
lionel-rowe opened this issue Nov 20, 2023 · 0 comments · Fixed by #24827
Closed

Logging Intl.Locale objects omits the locale info #21271

lionel-rowe opened this issue Nov 20, 2023 · 0 comments · Fixed by #24827
Assignees
Labels
bug Something isn't working correctly ext/console Related to the ext/console crate

Comments

@lionel-rowe
Copy link
Contributor

Default logging (console.log, repl, etc) for Intl.Locale objects looks like this:

> new Intl.Locale('zh-Hant-TW', { hourCycle: "h12" })
Locale [Intl.Locale] {}

Given that all information about an Intl.Locale is captured in its serialized form and that such serialized forms are typically short, it might make sense to log that info, something like this:

> new Intl.Locale('zh-Hant-TW', { hourCycle: "h12" })
Locale [Intl.Locale] { 'zh-Hant-TW-u-hc-h12' }

However, the full serialization is only available by calling toString, so possibly not appropriate for logging. Given that many common usages of locales don't use any of the extensions (calendar, hourCycle, etc.) simply showing the baseName might also suffice:

> new Intl.Locale('zh-Hant-TW', { hourCycle: "h12" })
Locale [Intl.Locale] { baseName: 'zh-Hant-TW' }

I guess there might be quite a few similar built-ins that don't have good logging in Deno (or Node for that matter) but could have properties exposed to logs to improve that experience. Obviously it makes sense to log things like file names for File objects (#20414 and #20415), but to what extent is it considered useful to do the same for APIs that might be less commonly used?

@lucacasonato lucacasonato added bug Something isn't working correctly ext/console Related to the ext/console crate labels Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly ext/console Related to the ext/console crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants