Commit Graph
21 Commits
Author SHA1 Message Date
Jonatan Männchen 980500551c Inline Licence Info & Copyright for non-test files (#14256) 2025-02-07 21:11:09 +01:00
José Valim ac15a185fc Add always_evaluate_messages to Logger
Closes #12497
Closes #12480
2023-05-04 12:59:26 +02:00
Andrea Leopardi 253e3ab640 Expose :logger's global metadata (#12413) 2023-02-17 11:21:41 +01:00
José Valim 318dd5297b Introduce default_formatter and default_handler config for Logger (#12400)
We now fully integrate with Erlang/OTP logger.

  * Logger.Formatter can now instantiate a compatible Erlamg/OTP logger formatter

  * The default_handler configures the default handler

  * The default_formatter configures the default formatter

  * Backends front-end will be moved to logger_backends package,
    but the implementation will still be shipped as part of Elixir
2023-02-15 17:31:18 +01:00
Łukasz Jan Niemier f128ae3d7a Use Erlang's logger as main logging implementation (#9333) 2019-11-01 15:53:05 +01:00
José Valim 89a57a876c Allow start_options to be configured on Logger (#9438) 2019-10-24 00:03:50 +02:00
José Valim d65f8bb6e4 Add v1.10-ready deprecations 2019-06-04 17:28:08 +02:00
José Valim d2cb89e92b Update registered process lists, closes #9103 2019-05-31 19:24:17 +02:00
José Valim 41756b6e9d 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
José Valim 4589e050b0 Add metadata based compile time logger purging (#7777) 2018-06-21 19:28:11 +02:00
José Valim 2c54554f18 Add discard_threshold to Logger (#7193) 2018-01-11 10:07:10 +01:00
José Valim 65c378dfac Format first file and mix.exs scripts 2017-10-08 19:34:44 +02:00
Aleksei Magusev d582db9a88 Use MixProject instead of Mixfile in mix.exs files 2017-08-20 21:40:23 +02:00
Wojtek Mach b3e9022e34 Use new mix.exs style in docs, core apps mix.exs and generated README (#6215) 2017-06-12 10:05:41 +02:00
James Fish 6506f6e679 Add application to logger metadata 2015-08-13 11:24:52 +01:00
José Valim b3d83756eb Support translator_inspect_opts
This allow developers to configure how state and message
are formatted when translating OTP errors and reports.

Closes #2880
2015-08-10 15:33:21 +02:00
José Valim 179ecb16f7 Get rid of Logger timeout config, closes #2724 2014-08-29 08:01:03 -04:00
José Valim 555e3321b1 Allow configurable timeout and catch exits on logger 2014-08-23 14:09:11 -04:00
José Valim 533bb49176 Load handlers inside supervisor as they are now dynamic 2014-08-08 13:21:55 +02:00
James Fish 361ee5b6f2 Add SASL log forwarding option to Logger 2014-08-05 21:22:50 +01:00
José Valim 58cb340eb7 Add Logger 2014-07-30 19:46:26 +02:00