Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1fb6c0d0e | ||
|
|
4f4aad2cd4 | ||
|
|
d0f5236c8e | ||
|
|
2b95813d98 |
@@ -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
|
||||
|
||||
@@ -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")
|
||||
["é"]
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
Reference in New Issue
Block a user