Skip to content

Commit 67caa3e

Browse files
author
José Valim
committed
Fix padding in Logger
1 parent d09cd17 commit 67caa3e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/logger/lib/logger/utils.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ defmodule Logger.Utils do
258258
[Integer.to_string(yy), ?-, pad2(mm), ?-, pad2(dd)]
259259
end
260260

261-
defp pad3(int) when int < 100 and int > 10, do: [?0, Integer.to_string(int)]
262-
defp pad3(int) when int < 10, do: [?0, ?0, Integer.to_string(int)]
261+
defp pad3(int) when int < 10, do: [?0, ?0, Integer.to_string(int)]
262+
defp pad3(int) when int < 100, do: [?0, Integer.to_string(int)]
263263
defp pad3(int), do: Integer.to_string(int)
264264

265265
defp pad2(int) when int < 10, do: [?0, Integer.to_string(int)]

lib/logger/test/logger/utils_test.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,8 @@ defmodule Logger.UtilsTest do
9292
test "format_time" do
9393
time = {12, 30, 10, 1}
9494
assert format_time(time) == ["12", ?:, "30", ?:, "10", ?., [?0, ?0, "1"]]
95+
96+
time = {12, 30, 10, 10}
97+
assert format_time(time) == ["12", ?:, "30", ?:, "10", ?., [?0, "10"]]
9598
end
9699
end

0 commit comments

Comments
 (0)