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

Reply via email to