Commit Graph
157 Commits
Author SHA1 Message Date
José Valim 98e60a8425 Add v1.10-ready deprecations 2019-06-04 17:28:08 +02:00
Mitchell Henke 5f6113ba90 Translate process crash on node in Logger (#9020) 2019-05-07 10:20:50 +02:00
José Valim e90ebaecff Improve error on unknown backends 2019-03-05 14:16:33 +01:00
José Valim 6377b324ee Use a descentralized mode computation for Logger (#8567)
Previous logger versions would always compute the mode on the Logger
handler which meant that, if any other Logger handler blocked, either because
it was waiting on IO, the system is overloaded or due to long computations, a
burst of messages could make the Logger message queue grow quite large
until it notices it should change its mode.

This commit changes the computation to use a counter which is offset by
the current message length queue. This makes the following script go from
tens of thousands messages in the Logger inbox to only hundreds (assuming
a `sync_threshold` of 100) when writing a rate limited stdio with
`mix run foo.exs | pv -p -L 1k 1>/dev/null`:

```elixir
require Logger

# monitor memory
# :observer.start()

defmodule Loop do
  def run() do
    Logger.info(inspect(:crypto.strong_rand_bytes(1024)))
    Process.sleep(10)
    run()
  end
end

for _i <- 1..100 do
  spawn(fn ->
    Loop.run()
  end)
end

defmodule OtherLoop do
  def run() do
    IO.inspect(:stderr, Process.info(Process.whereis(Logger), :message_queue_len), [])
    IO.inspect(:stderr, :ets.tab2list(Logger.Config), [])
    Process.sleep(100)
    run()
  end
end

OtherLoop.run()
```
2019-01-05 17:31:54 +01:00
Bruce Park 8aeeb86dfe Improve Protocol.UndefinedError message... (#8579)
when passing the module name of a struct

Addresses https://github.com/elixir-lang/elixir/issues/8532
2019-01-02 13:08:37 +01:00
José Valim 95934e56c4 Add $callers tracking to Task (#8510)
This allows us to track which process invoked the Task
besides its ancestors in the supervision tree.

Closes #7995
2018-12-11 19:05:53 +01:00
José Valim ae644808dd No longer persist dynamically added logger backends (#8424)
Otherwise it is impossible to dynamically remove them,
which partially defeats the point of adding them dynamically
in the first place.

Therefore this commit moves the whole dynamic backend
management to the user.

Closes #8213
2018-11-26 14:36:11 +01:00
Ivan Mironov 0e8cd17043 Fix direct Logger.log call in case of compile_time_purge_matching logger option (#8391) 2018-11-20 17:43:56 +01:00
Eksperimental 52ac93dbf5 Use "shut down" when it is a verb (#8269) 2018-10-10 09:35:31 +02:00
José Valim 16e6aa6ca0 Optimize metadata merging and ensure no nil leakage (#7927)
Closes #7926
2018-07-18 19:35:13 +02:00
José Valim 36643e21ac Make sure Logger is flushed before reattaching, closes #7903 2018-07-14 22:33:40 +02:00
José Valim 94f3d60a26 Hard deprecate previously deprecated APIs 2018-07-12 12:44:03 +02:00
José Valim 35ac568044 Require Erlang/OTP 20+ 2018-07-12 12:12:00 +02:00
José Valim 1fe7847f0e Replace compile_time_purge_level by compile_time_purge_matching (#7847)
Now that we support a more general `compile_time_purge_matching`,
we can deprecate `compile_time_purge_level`. We chose the name
`:level_lower_than` rather than `:level` for the matching key
since all other matches are exact.
2018-07-10 19:28:52 +02:00
José Valim 02a327d3c4 Include initial_call and registered_name in metadata (#7844) 2018-07-09 14:27:30 +02:00
José Valim fd27c2053f Run the formatter on translator tests 2018-07-08 22:47:13 +02:00
José Valim c7d3552767 Include Logger metadata in crash reports 2018-07-08 22:37:36 +02:00
José Valim 680631ae7a Add the test specific backend once 2018-07-08 22:11:17 +02:00
José Valim 13c80f0834 Reformat multiline logger calls 2018-07-08 21:40:34 +02:00
José Valim 991db52707 Unify proc_lib handling in tasks 2018-07-08 21:30:44 +02:00
Mitchell Henke 045aa012f1 Include crash_reason in Logger translator metadata
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-07-08 21:30:42 +02:00
José Valim f730125b44 Only evaluate Logger macro arguments when the message will be logged (#7768)
This means that the arguments won't be evaluated if the
message has a lower level than the logger one or if the
logger mode is set to discard.

Closes #7046.
2018-06-21 23:49:31 +02:00
José Valim f17c1a6881 Add metadata based compile time logger purging (#7777) 2018-06-21 19:28:11 +02:00
José Valim 5246eeabf6 Fix error_handler tests on Erlang/OTP 20 and earlier 2018-06-21 09:31:03 +02:00
José Valim cc7d491061 Log to stderr if there are no logger backends, closes #7640 2018-06-21 09:13:24 +02:00
Avraham Lembke 4b357bf079 Avoid calling truncate_n/2 if truncate is :infinity (#7701) 2018-05-26 19:28:56 +02:00
José Valim 2c770ba9d6 Erlang/OTP 21 logger integration (#7649) 2018-05-07 14:45:17 +02:00
Aleksei Magusev 24a958db0a Improve test for DynamicSupervisor with :extra_arguments 2018-04-18 00:03:27 +02:00
Henning L 8a824aa42d Add missing translator_inspect_opts option (#7540) 2018-04-08 15:51:41 +02:00
José Valim ae89ac8525 Keep thresholds separate from state on Logger.Config
This reduces the amount of data read from ETS everytime we log.
2018-04-07 10:01:34 +02:00
Henning L 584799809a Add missing discard_threshold option (#7533) 2018-04-04 18:32:13 +02:00
Andrea Leopardi c2e92c2847 Handle bad chardata lookalikes in Logger (#7478) 2018-03-24 14:08:19 +01:00
Andrea Leopardi 5947ed751e Improve documentation and specs for Logger.Formatter (#7475) 2018-03-22 18:30:51 +01:00
José Valim 0126cdd253 Ensure proper reports from named DynamicSupervisor, closes #7425 2018-03-07 12:28:52 +01:00
Jens Fischer f1c0fc8b5c Fix DynamicSupervisor error report when restarting child (#7377) 2018-02-20 21:19:56 -08:00
Bram Verburg f0ad7edf41 Fix DynamicSupervisor error report 2018-02-06 16:36:26 +01:00
tontytwo 4f9143843b Document how to force logger to be :sync (#7264) 2018-01-27 18:47:36 -02:00
José Valim edb52b7ca5 Use a simpler approach to avoid unused variable warnings in Logger 2018-01-24 10:15:49 +01:00
José Valim 3b2b09d473 Add discard_threshold to Logger (#7193) 2018-01-11 10:07:10 +01:00
José Valim bfdc3c20b3 Merge compile-time logger metadata, closes #7033 2017-11-15 09:17:21 -02:00
José Valim 25dbbef634 Warn if init/1 is not implemented in GenServer
This brings GenServer closer to the implementation in OTP
and aligns all behaviours to require the init/1 callback.

Closes #6998.
2017-11-03 18:49:07 +01:00
José Valim 7f8136915f Treat => and : as operators in the formatter
This means that the right side will break on its own line
when it doesn't fit and be indented by two spaces.

Closes #6976.
2017-10-26 12:43:02 +02:00
José Valim de311ae84b Update codebase with latest formatter rules 2017-10-25 19:39:25 +02:00
Frank McGeough e478440c2d Run formatter on lib/logger/test/logger/translator_test.exs (#6908) 2017-10-11 22:16:00 +02:00
José Valim 97ad07b7ab Make sure to not break guards on clauses with comments 2017-10-11 21:25:21 +02:00
José Valim 2f5e6a2fd4 Format more low hanging fruit files 2017-10-10 19:12:17 +02:00
Josh Price c71e448db7 Run the code formatter on LoggerTest (#6776) 2017-10-10 09:08:19 +02:00
José Valim 17f7f47e3c Fix the build 2017-10-09 20:52:50 +02:00
Omar Bahareth 415adb3f3e Run the code formatter on Logger.Backends.ConsoleTest (#6742) 2017-10-09 19:38:39 +02:00
Alessandro Nuzzo 2d7e9f8974 Run the code formatter on Logger.Case (#6700) 2017-10-09 17:13:00 +02:00