Sounds good to me, a PR is welcome! We should actually change Logger.enable to use the new Logger.put_process_level, especially because we have two meta-levels called :none and :all.
On Tue, Mar 1, 2022 at 1:11 PM Stefan Chrobot <ste...@chrobot.io> wrote: > Hi, I'd like to propose an addition of put_process_level(pid, level) into > the Logger module to allow controlling the runtime logging level on a > per-process basis. > > Our app runs multiple background processing jobs that are performing data > sync. This means that the jobs run "forever". We're running a job (OTP > process) for each user. While we have metrics and alerts to understand when > a new user is hitting some bumps, we'd like to have detailed logs to help > debug any potential issues. The issues are mostly data-dependent and are > happening in the initial phase of the sync. After that, the issues rarely > ever happen and so the detailed logs are pretty useless, but they still > consume resources. > > We could address our use case with something like the following: > > new? = DateTime.diff(DateTime.utc_now(), sync_start) > @threshold > Logger.put_process_level(self(), if new?, do: :debug, else: :warn) > > The implementation should be pretty straightforward and resemble the > implementation of Logger.enable/1. > > Looking forward to your thoughts. > > > Best, > Stefan > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CACzMe7YxiOYc9esU68Db%2Bq7zwfixg2cJyYwb5X2tXdj6V52efw%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CACzMe7YxiOYc9esU68Db%2Bq7zwfixg2cJyYwb5X2tXdj6V52efw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2Bx6e2VvVwiZ-1zuVFX043%3DuXRDRwAA3FQ9n4zyWWArLw%40mail.gmail.com.