summaryrefslogtreecommitdiff
path: root/src/mod_http_upload_quota.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2019-09-23 15:17:20 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2019-09-23 15:17:20 +0300
commit5770946f03ba669ea867b787fbd546333a8a3814 (patch)
tree73a03717ac5d4c31e12b92c1aba3b407f3c5329c /src/mod_http_upload_quota.erl
parentFix unicode formatting in ACME module (diff)
Correctly handle unicode in log messages
Diffstat (limited to 'src/mod_http_upload_quota.erl')
-rw-r--r--src/mod_http_upload_quota.erl34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/mod_http_upload_quota.erl b/src/mod_http_upload_quota.erl
index 0861351d..b4c2203c 100644
--- a/src/mod_http_upload_quota.erl
+++ b/src/mod_http_upload_quota.erl
@@ -155,24 +155,24 @@ handle_cast({handle_slot_request, #jid{user = U, server = S} = JID, Path, Size},
end,
NewSize = case {HardQuota, SoftQuota} of
{0, 0} ->
- ?DEBUG("No quota specified for ~s",
+ ?DEBUG("No quota specified for ~ts",
[jid:encode(JID)]),
undefined;
{0, _} ->
- ?WARNING_MSG("No hard quota specified for ~s",
+ ?WARNING_MSG("No hard quota specified for ~ts",
[jid:encode(JID)]),
enforce_quota(Path, Size, OldSize, SoftQuota, SoftQuota);
{_, 0} ->
- ?WARNING_MSG("No soft quota specified for ~s",
+ ?WARNING_MSG("No soft quota specified for ~ts",
[jid:encode(JID)]),
enforce_quota(Path, Size, OldSize, HardQuota, HardQuota);
_ when SoftQuota > HardQuota ->
- ?WARNING_MSG("Bad quota for ~s (soft: ~p, hard: ~p)",
+ ?WARNING_MSG("Bad quota for ~ts (soft: ~p, hard: ~p)",
[jid:encode(JID),
SoftQuota, HardQuota]),
enforce_quota(Path, Size, OldSize, SoftQuota, SoftQuota);
_ ->
- ?DEBUG("Enforcing quota for ~s",
+ ?DEBUG("Enforcing quota for ~ts",
[jid:encode(JID)]),
enforce_quota(Path, Size, OldSize, SoftQuota, HardQuota)
end,
@@ -191,7 +191,7 @@ handle_info(sweep, #state{server_host = ServerHost,
docroot = DocRoot,
max_days = MaxDays} = State)
when is_integer(MaxDays), MaxDays > 0 ->
- ?DEBUG("Got 'sweep' message for ~s", [ServerHost]),
+ ?DEBUG("Got 'sweep' message for ~ts", [ServerHost]),
case file:list_dir(DocRoot) of
{ok, Entries} ->
BackThen = secs_since_epoch() - (MaxDays * 86400),
@@ -204,7 +204,7 @@ handle_info(sweep, #state{server_host = ServerHost,
delete_old_files(UserDir, BackThen)
end, UserDirs);
{error, Error} ->
- ?ERROR_MSG("Cannot open document root ~s: ~s",
+ ?ERROR_MSG("Cannot open document root ~ts: ~ts",
[DocRoot, ?FORMAT(Error)])
end,
{noreply, State};
@@ -214,14 +214,14 @@ handle_info(Info, State) ->
-spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok.
terminate(Reason, #state{server_host = ServerHost, timers = Timers}) ->
- ?DEBUG("Stopping upload quota process for ~s: ~p", [ServerHost, Reason]),
+ ?DEBUG("Stopping upload quota process for ~ts: ~p", [ServerHost, Reason]),
ejabberd_hooks:delete(http_upload_slot_request, ServerHost, ?MODULE,
handle_slot_request, 50),
lists:foreach(fun timer:cancel/1, Timers).
-spec code_change({down, _} | _, state(), _) -> {ok, state()}.
code_change(_OldVsn, #state{server_host = ServerHost} = State, _Extra) ->
- ?DEBUG("Updating upload quota process for ~s", [ServerHost]),
+ ?DEBUG("Updating upload quota process for ~ts", [ServerHost]),
{ok, State}.
%%--------------------------------------------------------------------
@@ -295,20 +295,20 @@ gather_file_info(Dir) ->
size = Size}} ->
[{Path, Size, Time} | Acc];
{ok, _Info} ->
- ?DEBUG("Won't stat(2) non-regular file ~s",
+ ?DEBUG("Won't stat(2) non-regular file ~ts",
[Path]),
Acc;
{error, Error} ->
- ?ERROR_MSG("Cannot stat(2) ~s: ~s",
+ ?ERROR_MSG("Cannot stat(2) ~ts: ~ts",
[Path, ?FORMAT(Error)]),
Acc
end
end, [], Entries);
{error, enoent} ->
- ?DEBUG("Directory ~s doesn't exist", [Dir]),
+ ?DEBUG("Directory ~ts doesn't exist", [Dir]),
[];
{error, Error} ->
- ?ERROR_MSG("Cannot open directory ~s: ~s", [Dir, ?FORMAT(Error)]),
+ ?ERROR_MSG("Cannot open directory ~ts: ~ts", [Dir, ?FORMAT(Error)]),
[]
end.
@@ -316,16 +316,16 @@ gather_file_info(Dir) ->
del_file_and_dir(File) ->
case file:delete(File) of
ok ->
- ?INFO_MSG("Removed ~s", [File]),
+ ?INFO_MSG("Removed ~ts", [File]),
Dir = filename:dirname(File),
case file:del_dir(Dir) of
ok ->
- ?DEBUG("Removed ~s", [Dir]);
+ ?DEBUG("Removed ~ts", [Dir]);
{error, Error} ->
- ?DEBUG("Cannot remove ~s: ~s", [Dir, ?FORMAT(Error)])
+ ?DEBUG("Cannot remove ~ts: ~ts", [Dir, ?FORMAT(Error)])
end;
{error, Error} ->
- ?WARNING_MSG("Cannot remove ~s: ~s", [File, ?FORMAT(Error)])
+ ?WARNING_MSG("Cannot remove ~ts: ~ts", [File, ?FORMAT(Error)])
end.
-spec secs_since_epoch() -> non_neg_integer().