Commit Graph
316 Commits
Author SHA1 Message Date
Andrea Leopardi e077123c43 Improve the documentation for Logger (#9205) 2019-07-09 13:39:26 +02:00
Fernando Tapia Rico b31cb34a7b Do not emit undefined warnings in old Erlang/OTP versions (#9193) 2019-07-05 09:16:52 +02:00
José Valim 1586801de9 Add catch all for bad supervisor names
Otherwise if a different supervisor implementation,
such as a `ConsumerSupervisor` in GenStage, pass a
different name by accident, logging would fail.

Closes #8126.
2019-06-26 14:32:17 +02:00
José Valim 98e60a8425 Add v1.10-ready deprecations 2019-06-04 17:28:08 +02:00
José Valim ce41a70b2e Update registered process lists, closes #9103 2019-05-31 19:24:17 +02:00
José Valim 43a4c850c4 Don't discard Logger messages from other nodes
It is important to leave a trail of what executed
in both systems.
2019-05-24 22:21:08 +02:00
Fernando Tapia Rico 030e0c7b53 Do not explicitly recompile regexes, fallback to binary matching
Regexes used to be precompiled to binary values during code
compilation. These binary values may be incompatible with
different operating systems and OTP releases. That's why
an explicit `Regex.recompile/1` or `Regex.recompile!/1` was
required.

Regexes now fallback to binary matching if the precompiled
binary is not compatible with the runtime version.
2019-05-21 10:41:19 +02:00
Mitchell Henke 5f6113ba90 Translate process crash on node in Logger (#9020) 2019-05-07 10:20:50 +02:00
José Valim 1f5ad68302 Use :persistent_term for Logger config (#8977)
Closes #8592.
2019-04-24 09:28:31 +02:00
Christophe De Troyer d269a7bfcd Update documentation of Logger (#8866)
Add some information about the precedence of the logger levels.
2019-03-08 22:45:37 +01:00
José Valim e90ebaecff Improve error on unknown backends 2019-03-05 14:16:33 +01:00
Eksperimental 99d919e0c8 Use "code point" instead of "codepoint" (#8774)
That's the term it is used in the Unicode standard.
2019-02-06 11:21:03 +01:00
Tobiasz Małecki f865289130 Logger documentation improvement (#8679) 2019-01-22 21:13:08 +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 5b349504f4 Move simple_one_for_one deprecations to v1.10 2018-12-21 13:49:12 +01:00
José Valim 0c1df34645 Standardize more TODOs 2018-12-21 13:42:54 +01:00
José Valim d85ed42765 Update removal and deprecation annotations
In particular, all deprecated code would be removed on v2.0,
so we don't need to annotate dperecated code with a TODO to
remove it on v2.0.
2018-12-21 13:27:06 +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
Fernando Tapia Rico 4bceca4583 Improve docs of Logger.BackendSupervisor (#8280)
[ci skip]
2018-10-14 10:44:40 +02:00
José Valim f702b0dc4f Rename Logger.WatcherSupervisor to Logger.BackendSupervisor
This removes some layers of indirection and makes the code
simpler to follow.
2018-10-13 23:50:16 +02:00
Eksperimental 52ac93dbf5 Use "shut down" when it is a verb (#8269) 2018-10-10 09:35:31 +02:00
Magnus 81fa99d1bf Fix Logger spec for functions working with backends (#8117)
`Logger.add_backend/1,2` and `Logger.remove_backend/1,2` are specced
to only allow atoms as backends, while `Logger.configure_backend/2`
allows backend to be of the more general `backend` type. But both
`add_backend` and `remove_backend` work fine with the more generic
`backend` type, so the specs should be extended to cover that type.

The specs were introduced with c24a13ebf8, while the spec for
`configure_backends` was introduced in aeefd59b15 (with a small fix in
b98421fe51).
2018-08-21 15:14:02 +02:00
Adam Kirk 831d4fb8f0 Fix type in logger.ex doc sample (#8096) 2018-08-16 23:57:09 +02:00
Luke Imhoff b37220ccfa Fix typos in literals (strings/charlists) (#8057)
* misisng -> missing

* Fix typo in callback reference

* curently -> currently

* overriden -> overridden

* intested on -> interested in

* unecessary -> unnecessary

* resued -> reused

I don't think lawyers are involved with compiling.

* Additonally -> Additionally

* preferrable -> preferable

* chuncks -> chunks

* non-sensical -> nonsensical

* mutiple -> multiple
2018-08-06 07:56:02 +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
Arkadiusz Gil d7ea4ae448 Ignore unknown child info in Logger.Translator (#7892)
This prevents Logger application from crashing when supervisors report
children progress with fields unknown to Logger.Translator.

Closes #7889
2018-07-12 20:06:59 +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
Eksperimental f2ff2c8c8c General corrections (#7870)
* Modules/types are mentioned in singular, not plural

* General improvements in the documentation
2018-07-11 09:56:47 +02:00
Fernando Tapia Rico 8847bc7a9e Add missing colon in Logger documentation (#7853) 2018-07-10 21:03:23 +02:00
José Valim 34a4a49af0 Update TODO and CHANGELOG 2018-07-10 19:35:23 +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 8d95a19f02 Update docs and CHANGELOG 2018-07-09 12:28:53 +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 094eb6a86d Add missing backtick to logger docs 2018-06-23 19:12:09 +02:00
Fernando Tapia Rico c3b0caa8c9 Correct grammar in Logger documentation (#7784)
[ci skip]
2018-06-22 14:23:47 +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 9411636d12 Move did_you_mean for undefined function error to Exception.blame 2018-06-21 18:47:42 +02:00
José Valim 5246eeabf6 Fix error_handler tests on Erlang/OTP 20 and earlier 2018-06-21 09:31:03 +02:00