forked from AkkomaGang/akkoma
fixes for logger backends
This commit is contained in:
parent
cda2c1fc63
commit
9c1f3bfeff
3 changed files with 27 additions and 4 deletions
|
@ -295,7 +295,8 @@ defp do_transform_string(value) do
|
||||||
|
|
||||||
@spec is_module_name?(String.t()) :: boolean()
|
@spec is_module_name?(String.t()) :: boolean()
|
||||||
def is_module_name?(string) do
|
def is_module_name?(string) do
|
||||||
Regex.match?(~r/^(Pleroma|Phoenix|Tesla)\./, string) or string in ["Oban", "Ueberauth"]
|
Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack)\./, string) or
|
||||||
|
string in ["Oban", "Ueberauth", "ExSyslogger"]
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_eval(entity) do
|
defp do_eval(entity) do
|
||||||
|
|
|
@ -2218,7 +2218,11 @@ test "saving full setting if value is in full_key_update list", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
post(conn, "/api/pleroma/admin/config", %{
|
post(conn, "/api/pleroma/admin/config", %{
|
||||||
configs: [
|
configs: [
|
||||||
%{group: config.group, key: config.key, value: [":console"]}
|
%{
|
||||||
|
group: config.group,
|
||||||
|
key: config.key,
|
||||||
|
value: [":console", %{"tuple" => ["ExSyslogger", ":ex_syslogger"]}]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2227,12 +2231,18 @@ test "saving full setting if value is in full_key_update list", %{conn: conn} do
|
||||||
%{
|
%{
|
||||||
"group" => ":logger",
|
"group" => ":logger",
|
||||||
"key" => ":backends",
|
"key" => ":backends",
|
||||||
"value" => [":console"]
|
"value" => [
|
||||||
|
":console",
|
||||||
|
%{"tuple" => ["ExSyslogger", ":ex_syslogger"]}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
assert Application.get_env(:logger, :backends) == [:console]
|
assert Application.get_env(:logger, :backends) == [
|
||||||
|
:console,
|
||||||
|
{ExSyslogger, :ex_syslogger}
|
||||||
|
]
|
||||||
|
|
||||||
ExUnit.CaptureLog.capture_log(fn ->
|
ExUnit.CaptureLog.capture_log(fn ->
|
||||||
require Logger
|
require Logger
|
||||||
|
|
|
@ -175,6 +175,18 @@ test "tesla module" do
|
||||||
assert Config.from_binary(binary) == Tesla.Adapter.Hackney
|
assert Config.from_binary(binary) == Tesla.Adapter.Hackney
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "ExSyslogger module" do
|
||||||
|
binary = Config.transform("ExSyslogger")
|
||||||
|
assert binary == :erlang.term_to_binary(ExSyslogger)
|
||||||
|
assert Config.from_binary(binary) == ExSyslogger
|
||||||
|
end
|
||||||
|
|
||||||
|
test "Quack.Logger module" do
|
||||||
|
binary = Config.transform("Quack.Logger")
|
||||||
|
assert binary == :erlang.term_to_binary(Quack.Logger)
|
||||||
|
assert Config.from_binary(binary) == Quack.Logger
|
||||||
|
end
|
||||||
|
|
||||||
test "sigil" do
|
test "sigil" do
|
||||||
binary = Config.transform("~r[comp[lL][aA][iI][nN]er]")
|
binary = Config.transform("~r[comp[lL][aA][iI][nN]er]")
|
||||||
assert binary == :erlang.term_to_binary(~r/comp[lL][aA][iI][nN]er/)
|
assert binary == :erlang.term_to_binary(~r/comp[lL][aA][iI][nN]er/)
|
||||||
|
|
Loading…
Reference in a new issue