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

Use :persistent_term for Logger config #8977

Merged
merged 3 commits into from Apr 24, 2019

Conversation

Projects
None yet
3 participants
@josevalim
Copy link
Member

commented Apr 23, 2019

Closes #8592.

@@ -284,7 +305,19 @@ defmodule Logger.Config do
end
end

defp read_data(key) do
if :erlang.module_loaded(:persistent_term) do

This comment has been minimized.

Copy link
@michalmuskala

michalmuskala Apr 23, 2019

Member

Have you checked if maybe function_exported? will be faster? The module will always be loaded if available since it's a preloaded module.

@michalmuskala

This comment has been minimized.

Copy link
Member

commented Apr 23, 2019

The general advise for peristent_term is to use a single key with a complex value instead of multiple keys. Storing all the settings with a record under one key might be a good solution here - this also might avoid constructing the tuple for the key lookup which should be beneficial.

@josevalim

This comment has been minimized.

Copy link
Member Author

commented Apr 23, 2019

@michalmuskala yeah, that's what I originally attempted but it makes it harder to work with both persistent term and ETS. In the future, I would migrate to a single key. I guess I can at least merge translation data and log data now, since they always change at the same time.

@josevalim

This comment has been minimized.

Copy link
Member Author

commented Apr 23, 2019

@michalmuskala suggestions pushed, thanks for the review.

@josevalim josevalim merged commit 1f5ad68 into master Apr 24, 2019

3 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@josevalim

This comment has been minimized.

Copy link
Member Author

commented Apr 24, 2019

❤️ 💚 💙 💛 💜

@josevalim josevalim deleted the jv-persistent-term branch Apr 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.