Compare commits

...
4 Commits
Author SHA1 Message Date
Schnittchen a1fb6c0d0e Use System.os_time as reference in Mix.Utils.last_modified_and_size/1 (#8502) 2018-12-11 12:51:54 +01:00
Ivan Mironov 4f4aad2cd4 Fix direct Logger.log call in case of compile_time_purge_matching logger option (#8391) 2018-11-20 17:43:27 +01:00
Alan Walton d0f5236c8e Fix misleading doc string (#8355)
naive_datetime_to_iso_days takes a datetime without time zone
2018-11-02 16:57:05 +01:00
Alan Walton 2b95813d98 Fix copy/paste error in doc string (#8356)
Doc string for split/3 seems to have been copied from contains?/1, with references left behind to true and false return values.
2018-11-02 14:16:21 +01:00
5 changed files with 20 additions and 10 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ defmodule Calendar do
@callback time_to_string(hour, minute, second, microsecond) :: String.t()
@doc """
Converts the given datetime (with time zone) into the `t:iso_days/0` format.
Converts the given datetime (without time zone) into the `t:iso_days/0` format.
"""
@callback naive_datetime_to_iso_days(year, month, day, hour, minute, second, microsecond) ::
iso_days
+2 -2
View File
@@ -389,13 +389,13 @@ defmodule String do
Note this function can split within or across grapheme boundaries.
For example, take the grapheme "é" which is made of the characters
"e" and the acute accent. The following returns `true`:
"e" and the acute accent. The following returns the acute accent separately:
iex> String.split(String.normalize("é", :nfd), "e")
["", "́"]
However, if "é" is represented by the single character "e with acute"
accent, then it will return `false`:
accent, then it will return "e with acute":
iex> String.split(String.normalize("é", :nfc), "e")
["é"]
+1 -1
View File
@@ -789,7 +789,7 @@ defmodule Logger do
metadata = Keyword.merge(caller, metadata)
{metadata, metadata}
else
{metadata,
{[],
quote do
Keyword.merge(unquote(caller), unquote(metadata))
end}
+15 -5
View File
@@ -252,11 +252,13 @@ defmodule LoggerTest do
test "remove unused calls at compile time based on matching metadata" do
Logger.configure(
compile_time_application: :sample_app,
compile_time_purge_matching: [
[module: LoggerTest.PurgeMatching, function: "two_filters/0"],
[function: "one_filter/0"],
[custom: true],
[function: "level_filter/0", level_lower_than: :info]
[function: "level_filter/0", level_lower_than: :warn],
[application: :sample_app, level_lower_than: :info]
]
)
@@ -274,12 +276,16 @@ defmodule LoggerTest do
end
def level_filter do
Logger.debug("debug_filter")
Logger.info("info_filter")
Logger.warn("warn_filter")
end
def works do
Logger.debug("works")
Logger.info("works")
end
def log(level, metadata \\ []) do
Logger.log(level, "ok", metadata)
end
end
@@ -287,9 +293,13 @@ defmodule LoggerTest do
assert capture_log(fn -> assert PurgeMatching.one_filter() == :ok end) == ""
assert capture_log(fn -> assert PurgeMatching.two_filters() == :ok end) == ""
assert capture_log(fn -> assert PurgeMatching.custom_filters() == :ok end) == ""
assert capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "info_filter"
refute capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "debug_filter"
assert capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "warn_filter"
refute capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "info_filter"
capture_log(fn -> assert PurgeMatching.log(:info) == :ok end)
capture_log(fn -> assert PurgeMatching.log(:debug) == :ok end)
after
Logger.configure(compile_time_application: nil)
Logger.configure(compile_time_purge_matching: [])
end
+1 -1
View File
@@ -176,7 +176,7 @@ defmodule Mix.Utils do
(1970-01-01 00:00:00).
"""
def last_modified_and_size(path) do
now = System.system_time(:second)
now = System.os_time(:second)
case :elixir_utils.read_posix_mtime_and_size(path) do
{:ok, mtime, size} when mtime > now ->