[PR #1296] Local Tz logs #1242

Open
opened 2026-02-27 09:11:27 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/lldap/lldap/pull/1296
Author: @vic1707
Created: 9/16/2025
Status: 🔄 Open

Base: mainHead: TZ-logs


📝 Commits (7)

📊 Changes

8 files changed (+65 additions, -30 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 app/src/components/create_user.rs (+3 -1)
📝 app/src/components/group_table.rs (+2 -1)
📝 app/src/components/user_details_form.rs (+28 -17)
📝 app/src/components/user_table.rs (+2 -1)
📝 app/src/lib.rs (+19 -0)
📝 server/Cargo.toml (+1 -1)
📝 server/src/logging.rs (+9 -9)

📄 Description

Fixes: #1290

Following the discussion we had in #1290, here's a proposition to make lldap logs abide by desired timezone.
This PR introduces a new LLDAP_LOCAL_TZ_LOG env variable to make the logs use the defined timezone instead of default UTC.

Due to how tracing_subscriber works, enabling LLDAP_LOCAL_TZ_LOG gives the same kind of logs as when LLDAP_RAW_LOG is enabled for simplicity as the with_timer method cannot be used without a tracing_subscriber::fmt::Layer<S> inner object (doc). But another layer can be made if that behavior isn't desired.

This changes uses the chrono feature from tracing-subscriber instead of local-time because the later only yielded <unknown time> for the timestamp (apparently due to a time crate issue, see https://github.com/tokio-rs/tracing/issues/2715 for reference.


Results:
New LLDAP_LOCAL_TZ_LOG
image

Unchanged LLDAP_RAW_LOG
image

Unchanged default behavior
image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/lldap/lldap/pull/1296 **Author:** [@vic1707](https://github.com/vic1707) **Created:** 9/16/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `TZ-logs` --- ### 📝 Commits (7) - [`8055e45`](https://github.com/lldap/lldap/commit/8055e45283f590ab0fddec1d23722e650b7e9269) needs `chrono` feature - [`095c325`](https://github.com/lldap/lldap/commit/095c3252c351df5577fbf011aa8350cee32fa21a) add new `LLDAP_LOCAL_TZ_LOG` env - [`8b724e5`](https://github.com/lldap/lldap/commit/8b724e54c496f2e7915354a2c876354080e5a4d6) wip - [`eb8e1fc`](https://github.com/lldap/lldap/commit/eb8e1fcf3cadd069f74ede38e858aba112e3b1dc) fix frontend timezone - [`d644c8c`](https://github.com/lldap/lldap/commit/d644c8c565653c8dded16ea6321c095aab60f9f9) centralize frontend timezone fix - [`c43ff85`](https://github.com/lldap/lldap/commit/c43ff8522499b9f014b7229414b859b26931ff65) refactor attribute formatting - [`e36c4b4`](https://github.com/lldap/lldap/commit/e36c4b4981339cbbb3649180f5844d715945e13a) specify date format explicitely ### 📊 Changes **8 files changed** (+65 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `app/src/components/create_user.rs` (+3 -1) 📝 `app/src/components/group_table.rs` (+2 -1) 📝 `app/src/components/user_details_form.rs` (+28 -17) 📝 `app/src/components/user_table.rs` (+2 -1) 📝 `app/src/lib.rs` (+19 -0) 📝 `server/Cargo.toml` (+1 -1) 📝 `server/src/logging.rs` (+9 -9) </details> ### 📄 Description Fixes: #1290 Following the discussion we had in #1290, here's a proposition to make lldap logs abide by desired timezone. This PR introduces a new `LLDAP_LOCAL_TZ_LOG` env variable to make the logs use the defined timezone instead of default UTC. Due to how `tracing_subscriber` works, enabling `LLDAP_LOCAL_TZ_LOG` gives the same kind of logs as when `LLDAP_RAW_LOG` is enabled for simplicity as the `with_timer` method cannot be used without a `tracing_subscriber::fmt::Layer<S>` inner object ([doc](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Layer.html#method.with_timer)). But another layer can be made if that behavior isn't desired. This changes uses the `chrono` feature from `tracing-subscriber` instead of `local-time` because the later only yielded `<unknown time>` for the timestamp (apparently due to a `time` crate issue, see https://github.com/tokio-rs/tracing/issues/2715 for reference. --- Results: New `LLDAP_LOCAL_TZ_LOG` <img width="3108" height="888" alt="image" src="https://github.com/user-attachments/assets/9bed596e-a74b-4b49-8e3d-80504b096650" /> Unchanged `LLDAP_RAW_LOG` <img width="3108" height="888" alt="image" src="https://github.com/user-attachments/assets/822d6159-eec5-4fa6-a2a5-a34fc0047e0f" /> Unchanged default behavior <img width="3108" height="888" alt="image" src="https://github.com/user-attachments/assets/2cd1fcbc-0b0c-4a9d-8168-bafd2077e90e" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#1242
No description provided.