From bc1b2fa5bd74ee1e52fc2a29dded766b1288593a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan?= Date: Wed, 4 Oct 2023 18:53:46 +0200 Subject: [PATCH] Allow specifying a custom date format in std log (#10603) # Description Allows the user to specify a custom date format for std log to use. # User-Facing Changes Added customization. --- crates/nu-std/std/log.nu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/nu-std/std/log.nu b/crates/nu-std/std/log.nu index 7cbf55c7df..1e2d222144 100644 --- a/crates/nu-std/std/log.nu +++ b/crates/nu-std/std/log.nu @@ -32,6 +32,8 @@ export-env { } $env.NU_LOG_FORMAT = $"%ANSI_START%%DATE%|%LEVEL%|(ansi u)%MSG%%ANSI_STOP%" + + $env.NU_LOG_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S%.3f" } def log-types [] { @@ -139,7 +141,7 @@ def current-log-level [] { } def now [] { - date now | format date "%Y-%m-%dT%H:%M:%S%.3f" + date now | format date $env.NU_LOG_DATE_FORMAT } def handle-log [