Skip to content

Conversation

hauleth
Copy link
Contributor

@hauleth hauleth commented Nov 2, 2019

Related to #9464

@hauleth hauleth force-pushed the chore/remove-error_logger-calls branch from 91ea50e to bcffdb0 Compare November 2, 2019 15:46
@hauleth hauleth marked this pull request as ready for review November 2, 2019 15:56
@hauleth hauleth force-pushed the chore/remove-error_logger-calls branch from bcffdb0 to b57a3ed Compare November 2, 2019 16:11
@hauleth hauleth force-pushed the chore/remove-error_logger-calls branch from b57a3ed to 2c7e23c Compare November 2, 2019 18:37
error_logger: %{tag: :error_msg},
report_cb: &__MODULE__.format_report/2
}
)
Copy link
Member

Choose a reason for hiding this comment

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

Fantastic work!

%{
domain: [:otp, :elixir],
error_logger: %{tag: :error_msg},
report_cb: &__MODULE__.format_report/2
Copy link
Member

Choose a reason for hiding this comment

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

We should keep this one private too and make the name consistent between files (format_log or format_report).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I see, almost all code in OTP uses remote calls to the report_cb, probably the reasoning is the same as in telemetry, as this is clearer for the VM.

Copy link
Member

Choose a reason for hiding this comment

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

We need to have a reasoning though as doing it just in case is not good enough. Especially because it exports a public API that we would need to @doc false. So I would:

  1. Use local functions for now
  2. Verify with the OTP team why they have used remote ones

Can you please check those? Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Using an external function means the whole second argument will be a compile-time literal. A local function can't be optimised like that.

@hauleth hauleth force-pushed the chore/remove-error_logger-calls branch from 29bf3fb to 6f4f33b Compare November 3, 2019 10:51

{:ok, msg, metadata}
{:ok, msg, metadata}
end
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 have ported it as is, but is there any reason why do that in translator instead of using report_cb directly? I think it would make more sense to have uniform error reports.

Copy link
Member

Choose a reason for hiding this comment

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

that Is a separate discussion. Unifying reports would be a good option but we would definitely have to push some things uostream before. For example, we include more information on debug level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@josevalim you mean in inspect? This is what 2nd argument in report_cb is for, to pass additional informations to formatters.

Copy link
Member

Choose a reason for hiding this comment

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

I mean we show more information in general. Compare both reports in debug mode for a crashed GenServer and you will see the differences. :)

@josevalim
Copy link
Member

josevalim commented Nov 3, 2019 via email

@michalmuskala
Copy link
Member

michalmuskala commented Nov 3, 2019

The main technical issue is that it's not possible to represent "static" local funs in the external term format that is used for encoding the literal chunk in the BEAM files.

Local funs that don't capture the environment (are not closures) are convered to literals when loaded, but this still means they can't be embedded within other literals.

@josevalim josevalim merged commit 71caf1f into elixir-lang:master Nov 3, 2019
@josevalim josevalim deleted the chore/remove-error_logger-calls branch November 3, 2019 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants