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.
This commit is contained in:
Gaëtan 2023-10-04 18:53:46 +02:00 committed by GitHub
parent 8c507dc984
commit bc1b2fa5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,8 @@ export-env {
} }
$env.NU_LOG_FORMAT = $"%ANSI_START%%DATE%|%LEVEL%|(ansi u)%MSG%%ANSI_STOP%" $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 [] { def log-types [] {
@ -139,7 +141,7 @@ def current-log-level [] {
} }
def now [] { 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 [ def handle-log [