export def now [] { date now | date format "%Y-%m-%dT%H:%M:%S%.3f" } export def format-message [ message: string, format: string prefix: string, ansi ] { [ ["%MSG%" $message] ["%DATE%" (now)] ["%LEVEL%" $prefix] ["%ANSI_START%" $ansi] ["%ANSI_STOP%" (ansi reset)] ] | reduce --fold $format { |it, acc| $acc | str replace --all $it.0 $it.1 } }