Skip to content

chore: add timestamp in logging#1084

Open
maudetes wants to merge 1 commit into
mainfrom
chore/add-timestamp-to-logging
Open

chore: add timestamp in logging#1084
maudetes wants to merge 1 commit into
mainfrom
chore/add-timestamp-to-logging

Conversation

@maudetes
Copy link
Copy Markdown
Contributor

@maudetes maudetes commented May 19, 2026

Part of datagouv/data.gouv.fr#2015

We don't currently have any timestamp in logging, this PR prefix logs with a timestamp.
To raise an error, go to: http://dev.local:3000/users/does-not-exist

I think this solution is ugly, but at the moment I did not find a good approach that don't require adding an extra dependency.
Any other better idea?

@maudetes maudetes requested review from ThibaudDauce and nicolaskempf57 and removed request for ThibaudDauce May 19, 2026 13:41
Comment thread plugins/logger.ts
let __logger_plugin_initialized = false

export default defineNuxtPlugin(() => {
if (process.env.NODE_ENV === 'production' && !__logger_plugin_initialized) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer early returns for this kind of stuff but not mandatory:

Suggested change
if (process.env.NODE_ENV === 'production' && !__logger_plugin_initialized) {
if (__logger_plugin_initialized) return
if (process.env.NODE_ENV !== 'production') return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants