Update log filter for miscapitalized module loading error (#2040)

This commit is contained in:
Jonatan Kłosko 2023-07-06 18:43:00 +02:00 committed by GitHub
parent 2cd77aefeb
commit ce5e91a20c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,17 +18,19 @@ defmodule Livebook.Runtime.ErlDist.LoggerGLHandler do
end
@doc false
def filter_code_server_logs(%{meta: meta} = event, _) do
def filter_code_server_logs(%{msg: msg} = event, _) do
# During intellisense we check if certain modules are loaded. If
# the module name is miscapitalized, such as "Io", and we are on
# a case insensitive file system, then :code_serverlogs an error
# a case insensitive file system, this results in a log error
# message: "Error loading module 'Elixir.Io'". We want to ignore
# such logs
if Process.whereis(:code_server) == meta.pid do
with {~c"~s~n", [content]} when is_list(content) <- msg,
true <- :string.str(content, ~c"Error loading module") > 0,
true <- :string.str(content, ~c"module name in object code is") > 0 do
:stop
else
event
_ -> event
end
end
end