From: Lukas Wagner <l.wagner@proxmox.com>
To: Gabriel Goller <g.goller@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH proxmox-mail-forward 2/2] switch to proxmox-log
Date: Fri, 6 Dec 2024 13:07:51 +0100 [thread overview]
Message-ID: <598a4d45-8d26-4958-8240-4ba5db5d13bd@proxmox.com> (raw)
In-Reply-To: <ie46gzbi7lsetjnkd5t3hsnpbdiewzopuoolcfv2xu3srt5kpp@vinzhcx56m23>
On 2024-12-06 11:40, Gabriel Goller wrote:
>> fn main() {
>> - if let Err(err) = syslog::init(
>> - syslog::Facility::LOG_DAEMON,
>> - log::LevelFilter::Info,
>> - Some("proxmox-mail-forward"),
>> - ) {
>> + if let Err(err) = proxmox_log::init_logger("PROXMOX_LOG", LevelFilter::INFO) {
>> eprintln!("unable to initialize syslog: {err}");
>> }
>>
>
> Haven't looked at this crate yet, so I don't know where it's all used,
> but IMO the new `init_perlmod_logger` would be better? Because the
> `init_logger` function will always print to journald and check if a
> pbs task exists (which will never happen here afaiu).
> We can also add another simpler subscriber which will only log to
> journald (I can also do that, just let me know).
For context, this crate produces the 'proxmox-mail-forward' helper.
This binary is invoked by the local Postfix daemon in case an email is sent to the
local root user. The executable receives the mail via stdin and feeds it into our
notification stack.
So in this case we only really need need to be logging to journald. I see no harm
in writing logs to stderr as well though, so I think we don't necessarily need to
add another subscriber. As far as I know, Postfix just redirects the output to /dev/null.
>
> Btw now I release how stupid these function names are, I should rename
> them in the future eliding the `perlmod`, `cli` names. Something like
> `init_journald_and_tasks` and `init_stderr_and_journald`.
That would indeed be a bit more clear :D If you do that now, at least for the perlmod
function, I would rebase this commit onto yours.
Thanks!
--
- Lukas
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-12-06 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 10:10 [pve-devel] [PATCH proxmox 1/2] notify: smtp: add missing 'tracing' namespace prefix Lukas Wagner
2024-12-06 10:10 ` [pve-devel] [PATCH proxmox-mail-forward 2/2] switch to proxmox-log Lukas Wagner
2024-12-06 10:40 ` Gabriel Goller
2024-12-06 12:07 ` Lukas Wagner [this message]
2024-12-06 10:20 ` [pve-devel] [PATCH proxmox 1/2] notify: smtp: add missing 'tracing' namespace prefix Gabriel Goller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=598a4d45-8d26-4958-8240-4ba5db5d13bd@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=g.goller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox