From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <g.goller@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 2D204F587
 for <pbs-devel@lists.proxmox.com>; Fri, 29 Sep 2023 13:09:17 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 15E301F776
 for <pbs-devel@lists.proxmox.com>; Fri, 29 Sep 2023 13:09:17 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Fri, 29 Sep 2023 13:09:15 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BB74744754
 for <pbs-devel@lists.proxmox.com>; Fri, 29 Sep 2023 13:09:15 +0200 (CEST)
Message-ID: <b981c430-9b17-38b3-f054-b2d17d0e7a5c@proxmox.com>
Date: Fri, 29 Sep 2023 13:09:15 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.0
Content-Language: en-US
To: Wolfgang Bumiller <w.bumiller@proxmox.com>,
 Dominik Csapak <d.csapak@proxmox.com>
Cc: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>, Thomas Lamprecht <t.lamprecht@proxmox.com>
References: <20230821111938.110298-1-g.goller@proxmox.com>
 <cf4369be-147c-46a9-a332-6b3cbb18f500@proxmox.com>
 <jafju2ed6q5kuktplrslu6jde3aznhovy6yc7cwdifzdsl6h3v@25okbn7av7yr>
From: Gabriel Goller <g.goller@proxmox.com>
In-Reply-To: <jafju2ed6q5kuktplrslu6jde3aznhovy6yc7cwdifzdsl6h3v@25okbn7av7yr>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.356 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -1.473 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pbs-devel] [PATCH proxmox-backup] api: Outsource the logger
 initialization to the router
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Fri, 29 Sep 2023 11:09:17 -0000


On 9/29/23 11:49, Wolfgang Bumiller wrote:
> On Fri, Sep 29, 2023 at 11:35:06AM +0200, Dominik Csapak wrote:
>> [..]
> On the one hand `proxmox-router` is used for both the API daemons and by
> our schema-based CLI parser, and we already have `cli::init_cli_logger`
> in there.
> On the other hand, there's no guarantee that all daemons will use this
> crate, if they don't need any schema/CLI parsing, but then again this
> can still be initialized specially there...
>
> Basically, I don't specifically object to having a common helper for
> a "this is how our daemons usually do logging" type of deal, but it may
> still make more sense in proxmox-rest-server.
I agree, it does more sense in the proxmox-rest-server crate.
> Regardless of where we put it, for our log refactoring, we'd need this
> to return a logger instance, rather than actually setting the logger,
> because our API daemons will need a *custom* logger to deal with the
> workers, which in turn needs access to the logger created *here*.

Yeah, we can do that, we will just have to return the `syslog::BasicLogger`
and call `log::set_boxed_logger(..)` in the api/proxy `run()` function.

Should we also return the max_log_level somehow, maybe in a tupel?
Currently I am already setting it in the `init_syslog_logger` function
using log::set_max_loglevel(..)`.

> The custom logger would then definitely go into `proxmox-rest-server`,
> so the syslog portion may as well live there, depending on which we'd
> consider more "consistent" with the CLI portion being in
> `proxmox-router` - the CLI tools definitely won't want to pull in
> `proxmox-rest-server`, so moving the cli logger setup there doesn't make
> sense.