forked from AkkomaGang/akkoma
Merge branch 'feld-Logger' into 'develop'
Logging cleanup See merge request pleroma/pleroma!76
This commit is contained in:
commit
9b97b023c5
12 changed files with 22 additions and 22 deletions
|
@ -417,7 +417,7 @@ def get_or_fetch_by_ap_id(ap_id) do
|
|||
_ ->
|
||||
case OStatus.make_user(ap_id) do
|
||||
{:ok, user} -> user
|
||||
_ -> {:error, "Could not fetch by ap id"}
|
||||
_ -> {:error, "Could not fetch by AP id"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -301,7 +301,7 @@ def fetch_and_prepare_user_from_ap_id(ap_id) do
|
|||
{:ok, data} <- Poison.decode(body) do
|
||||
user_data_from_user_object(data)
|
||||
else
|
||||
e -> Logger.error("Could not user at fetch #{ap_id}, #{inspect(e)}")
|
||||
e -> Logger.error("Could not decode user at fetch #{ap_id}, #{inspect(e)}")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -321,7 +321,7 @@ def make_user_from_nickname(nickname) do
|
|||
with {:ok, %{"ap_id" => ap_id}} when not is_nil(ap_id) <- WebFinger.finger(nickname) do
|
||||
make_user_from_ap_id(ap_id)
|
||||
else
|
||||
_e -> {:error, "No ap id in webfinger"}
|
||||
_e -> {:error, "No AP id in WebFinger"}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ def inbox(%{assigns: %{valid_signature: true}} = conn, params) do
|
|||
def inbox(conn, params) do
|
||||
headers = Enum.into(conn.req_headers, %{})
|
||||
if !(String.contains?(headers["signature"] || "", params["actor"])) do
|
||||
Logger.info("Signature not from author, relayed message, ignoring.")
|
||||
Logger.info("Signature not from author, relayed message, ignoring")
|
||||
else
|
||||
Logger.info("Signature error.")
|
||||
Logger.info("Signature error")
|
||||
Logger.info("Could not validate #{params["actor"]}")
|
||||
Logger.info(inspect(conn.req_headers))
|
||||
end
|
||||
|
|
|
@ -48,10 +48,10 @@ def handle(:publish, activity) do
|
|||
with actor when not is_nil(actor) <- User.get_cached_by_ap_id(activity.data["actor"]) do
|
||||
{:ok, actor} = WebFinger.ensure_keys_present(actor)
|
||||
if ActivityPub.is_public?(activity) do
|
||||
Logger.info(fn -> "Sending #{activity.data["id"]} out via websub" end)
|
||||
Logger.info(fn -> "Sending #{activity.data["id"]} out via WebSub" end)
|
||||
Websub.publish(Pleroma.Web.OStatus.feed_path(actor), actor, activity)
|
||||
|
||||
Logger.info(fn -> "Sending #{activity.data["id"]} out via salmon" end)
|
||||
Logger.info(fn -> "Sending #{activity.data["id"]} out via Salmon" end)
|
||||
Pleroma.Web.Salmon.publish(actor, activity)
|
||||
end
|
||||
|
||||
|
@ -61,7 +61,7 @@ def handle(:publish, activity) do
|
|||
end
|
||||
|
||||
def handle(:verify_websub, websub) do
|
||||
Logger.debug(fn -> "Running websub verification for #{websub.id} (#{websub.topic}, #{websub.callback})" end)
|
||||
Logger.debug(fn -> "Running WebSub verification for #{websub.id} (#{websub.topic}, #{websub.callback})" end)
|
||||
@websub.verify(websub)
|
||||
end
|
||||
|
||||
|
@ -71,7 +71,7 @@ def handle(:incoming_doc, doc) do
|
|||
end
|
||||
|
||||
def handle(:incoming_ap_doc, params) do
|
||||
Logger.info("Handling incoming ap activity")
|
||||
Logger.info("Handling incoming AP activity")
|
||||
with {:ok, _user} <- ap_enabled_actor(params["actor"]),
|
||||
nil <- Activity.get_by_ap_id(params["id"]),
|
||||
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
|
||||
|
@ -105,7 +105,7 @@ def handle(:publish_single_websub, %{xml: xml, topic: topic, callback: callback,
|
|||
|
||||
def handle(type, _) do
|
||||
Logger.debug(fn -> "Unknown task: #{type}" end)
|
||||
{:error, "Don't know what do do with this"}
|
||||
{:error, "Don't know what to do with this"}
|
||||
end
|
||||
|
||||
def enqueue(type, payload, priority \\ 1) do
|
||||
|
|
|
@ -36,7 +36,7 @@ def validate_conn(conn) do
|
|||
if validate_conn(conn, public_key) do
|
||||
true
|
||||
else
|
||||
Logger.debug("Could not validate, re-fetching user and trying one more time.")
|
||||
Logger.debug("Could not validate, re-fetching user and trying one more time")
|
||||
# Fetch user anew and try one more time
|
||||
with actor_id <- conn.params["actor"],
|
||||
{:ok, _user} <- ActivityPub.make_user_from_ap_id(actor_id),
|
||||
|
|
|
@ -40,8 +40,8 @@ def use_token(%Authorization{used: false, valid_until: valid_until} = auth) do
|
|||
if NaiveDateTime.diff(NaiveDateTime.utc_now, valid_until) < 0 do
|
||||
Repo.update(use_changeset(auth, %{used: true}))
|
||||
else
|
||||
{:error, "token expired"}
|
||||
{:error, "Token expired"}
|
||||
end
|
||||
end
|
||||
def use_token(%Authorization{used: true}), do: {:error, "already used"}
|
||||
def use_token(%Authorization{used: true}), do: {:error, "Already used"}
|
||||
end
|
||||
|
|
|
@ -291,8 +291,8 @@ def get_atom_url(body) do
|
|||
[[_, match]] = Regex.scan(@gs_classic_regex, body)
|
||||
{:ok, match}
|
||||
true ->
|
||||
Logger.debug(fn -> "Couldn't find atom link in #{inspect(body)}" end)
|
||||
{:error, "Couldn't find the atom link"}
|
||||
Logger.debug(fn -> "Couldn't find Atom link in #{inspect(body)}" end)
|
||||
{:error, "Couldn't find the Atom link"}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ defp send_to_user(%{info: %{"salmon" => salmon}}, feed, poster) do
|
|||
with {:ok, %{status_code: code}} <- poster.(salmon, feed, [{"Content-Type", "application/magic-envelope+xml"}], timeout: 10000, recv_timeout: 20000, hackney: [pool: :default]) do
|
||||
Logger.debug(fn -> "Pushed to #{salmon}, code #{code}" end)
|
||||
else
|
||||
e -> Logger.debug(fn -> "Pushing salmon to #{salmon} failed, #{inspect(e)}" end)
|
||||
e -> Logger.debug(fn -> "Pushing Salmon to #{salmon} failed, #{inspect(e)}" end)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -178,7 +178,7 @@ def publish(%{info: %{"keys" => keys}} = user, %{data: %{"type" => type}} = acti
|
|||
remote_users(activity)
|
||||
|> Enum.each(fn(remote_user) ->
|
||||
Task.start(fn ->
|
||||
Logger.debug(fn -> "sending salmon to #{remote_user.ap_id}" end)
|
||||
Logger.debug(fn -> "Sending Salmon to #{remote_user.ap_id}" end)
|
||||
send_to_user(remote_user, feed, poster)
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -100,7 +100,7 @@ def find_lrdd_template(domain) do
|
|||
with {:ok, %{body: body}} <- @httpoison.get("https://#{domain}/.well-known/host-meta", []) do
|
||||
get_template_from_xml(body)
|
||||
else
|
||||
e -> {:error, "Can't find lrdd template: #{inspect(e)}"}
|
||||
e -> {:error, "Can't find LRDD template: #{inspect(e)}"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -122,7 +122,7 @@ def finger(account) do
|
|||
{:ok, data}
|
||||
else
|
||||
e ->
|
||||
Logger.debug(fn -> "Couldn't finger #{account}." end)
|
||||
Logger.debug(fn -> "Couldn't finger #{account}" end)
|
||||
Logger.debug(fn -> inspect(e) end)
|
||||
{:error, e}
|
||||
end
|
||||
|
|
|
@ -98,7 +98,7 @@ def incoming_subscription_request(user, %{"hub.mode" => "subscribe"} = params) d
|
|||
|
||||
{:ok, websub}
|
||||
else {:error, reason} ->
|
||||
Logger.debug("Couldn't create subscription.")
|
||||
Logger.debug("Couldn't create subscription")
|
||||
Logger.debug(inspect(reason))
|
||||
|
||||
{:error, reason}
|
||||
|
|
|
@ -20,7 +20,7 @@ def websub_subscription_request(conn, %{"nickname" => nickname} = params) do
|
|||
|
||||
# TODO: Extract this into the Websub module
|
||||
def websub_subscription_confirmation(conn, %{"id" => id, "hub.mode" => "subscribe", "hub.challenge" => challenge, "hub.topic" => topic} = params) do
|
||||
Logger.debug("Got websub confirmation")
|
||||
Logger.debug("Got WebSub confirmation")
|
||||
Logger.debug(inspect(params))
|
||||
lease_seconds = if params["hub.lease_seconds"] do
|
||||
String.to_integer(params["hub.lease_seconds"])
|
||||
|
|
|
@ -21,7 +21,7 @@ def parse_document(text) do
|
|||
doc
|
||||
catch
|
||||
:exit, _error ->
|
||||
Logger.debug("Couldn't parse xml: #{inspect(text)}")
|
||||
Logger.debug("Couldn't parse XML: #{inspect(text)}")
|
||||
:error
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue