mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Respect user-defined $env.NU_LOG_FORMAT
and $env.NU_LOG_DATE_FORMAT
(#13692)
Fixes nushell/nushell#13689 # Description Respect user-defined `$env.NU_LOG_FORMAT` and `$env.NU_LOG_DATE_FORMAT` Additionally I fixed `nu_with_std!()` macro (it was not working correctly) # User-Facing Changes Users now may set `$env.NU_LOG_FORMAT` and `$env.NU_LOG_DATE_FORMAT` in `env.nu` and it will work even if `use std` is used after that. # Tests + Formatting Added a couple of tests for the new functionality. # After Submitting
This commit is contained in:
@ -36,8 +36,8 @@ export def log-short-prefix [] {
|
||||
}
|
||||
}
|
||||
export-env {
|
||||
$env.NU_LOG_FORMAT = $"%ANSI_START%%DATE%|%LEVEL%|%MSG%%ANSI_STOP%"
|
||||
$env.NU_LOG_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S%.3f"
|
||||
$env.NU_LOG_FORMAT = $env.NU_LOG_FORMAT? | default "%ANSI_START%%DATE%|%LEVEL%|%MSG%%ANSI_STOP%"
|
||||
$env.NU_LOG_DATE_FORMAT = $env.NU_LOG_DATE_FORMAT? | default "%Y-%m-%dT%H:%M:%S%.3f"
|
||||
}
|
||||
|
||||
def log-types [] {
|
||||
|
Reference in New Issue
Block a user