log: decouple py3status logging#2333
Conversation
8c85f5f to
5fe169f
Compare
|
Ready for review, but do not merge. |
ea4186c to
8e38864
Compare
|
Thanks @lasers on the principle I like it very much. Will try to review soon (vacations) |
ultrabug
left a comment
There was a problem hiding this comment.
not tested yet, just pure code review, looking promising so far!
|
Wanting to make it clear in the logs about detecting available modules: Your suggestions had been largely included. |
78b7862 to
34b5b63
Compare
|
Now we've been that far it looks like:
|
567385c to
a3fe00a
Compare
Dead, but I wasn't sure if we should remove it. Now dead and gone.
OK. Added. New arg also added Cleaning up i3status, other files, and especially module importing code to make it easy/compact to log. Additional code in Renaming variables Ready for review again.Same benchmarks as last two. Nothing significant changed. |
|
So far so good, tried with journald and it's really an improvement! I'm wondering about those logs tho, looks like we catch modules' loaded modules own logs but without referencing them: This comes from my google_calendar module but we only see it as I will give the logfile option a try |
|
Tested logfile, do user really expect to have BOTH syslog and the defined logfile being fed by py3status logs? I did not but maybe it's just I'm old and confused :) |
Nothing turned up in grepping The real culrpit is
Prefix added to make sure it only happens on py3status files. I also modified py3staus modules to have
AFAIK, same behavior. Logfile isn't in use by default.... Styling / formatting for both syslog and logfile are being assigned to stay backward compatibility with |
735ee79 to
ad0ae0b
Compare
0683e1d to
5171eac
Compare
I like modules.sysdata |
I think we should default to syslog but if log-file is used we should only use that log file; so make it exclusive |
Done. |
|
Tested OK, almost there mate will do another code review ASAP |
|
My turn with AI One thing I'd still raise, since this commit touches exactly these lines: _setup_logging() starts from init_logging_config = dict(LOGGING_CONFIG) — a shallow copy. _deep_merge(), the handler insertion, and the root-handlers rewrite all mutate the nested dicts, which are shared with the module-level LOGGING_CONFIG constant. In a single normal run that's invisible, but if _setup_logging() ever runs twice in one process (tests, restarts-in-process), state from the first call pollutes the constant. It's a pre-existing wart inherited from master, but since this commit is rewriting the handler-wiring logic anyway, switching to copy.deepcopy(LOGGING_CONFIG) would be a one-line hardening with zero downside. wdyt? sounds reasonable tho not super necessary |
|
I think it is not necessary because since we only run it once (to set up logging config) per process. Also, this is what happened with your |
|
Right now, we only have to keep an eye out on trivial typos, inconsistency style, less-than-ideal or redundant messages. Code for loading-once/logging entry-point modules is ugly because it's sharing code with path-included modules and maybe default modules too, but it gets the logging part done reasonably nice without loading repeatedly. One day, I may want to see if we can make it more lean/clean in future. I don't have more to do with this. Don't forget to review feedback/mergeability on all those other PRs too. |
|
I agree, sounds reasonable like this indeed thanks for the hard work. Will give it a last try and start merging |
|
Thank you so much, let's move on! |
Working with codex off this #2327 (comment)
Direct logging avoids this.
Addressed.
Lint ruled added -- https://docs.astral.sh/ruff/rules/logging-f-string/
See above.
self.py3.log()is now for user-facing module logging. We also could removeself.py3_wrapper.log()in favor of direct logging... for performance reasons since we don't really need wrapper / additional checks.I haven't looked into this.
Added in
self.py3.log().self.py3.log()__name__) rather than piping everything throughself.py3.log()/self.py3_wrapper.log()functions.Here's the benchmarks.
Replaces / Closes #2327