Some things that are gonna get fixed with v2:

On 10/11/23 16:01, Gabriel Goller wrote:
[..]
+
+tokio::task_local! {
+    pub static LOGGER: RefCell<Option<FileLogger>>;
+    pub static WARN_COUNTER: RefCell<Option<u64>>;
+}
Move the `task_local!` stuff to the lib.rs file, that is
probably cleaner...
[..]
+
+pub fn init_logger(
+    env_var_name: &str,
+    default_log_level: LevelFilter,
+    application_name: &str,
+) -> Result<(), anyhow::Error> {
+    let mut log_level = default_log_level;
+    if let Ok(v) = env::var(env_var_name) {
+        if let Ok(l) = v.parse::<LevelFilter>() {
+            log_level = l;
+        }
+    }
+    let registry = tracing_subscriber::registry()
+        .with(FilelogLayer::new().with_filter(filter_fn(|metadata| {
+            metadata.fields().field("tasklog").is_some()
+        })))
+        .with(SyslogLayer::new(application_name.to_string()).with_filter(log_level));
+
We also need the `.with_filter(log_level)` on the `FilelogLayer`, so
that the PBS_LOG variable also sets the log level on the task logs.
+    tracing::subscriber::set_global_default(registry)?;
+
+    LogTracer::init()?;

Use `init_with_filter` here, so that we also set the loglevel on the (underlying) `log`
implementation. Like that a `log::info` call for example doesn't even
forward the message to `tracing`.

+    Ok(())
+}
[..]