From 21768bd3e39432f7b09bf86804dae167dac297fb Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 1 Sep 2023 12:10:34 -0500 Subject: [PATCH] fixed: `os.env` bug; added `logf` when `conv.format` is present --- core/conv/format.onyx | 10 ++++++++++ core/runtime/platform/onyx/env.onyx | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/conv/format.onyx b/core/conv/format.onyx index b86c94b6..5438be6e 100644 --- a/core/conv/format.onyx +++ b/core/conv/format.onyx @@ -203,6 +203,16 @@ str_format :: format str_format_va :: format_va + +#inject +builtin.logf :: (level: builtin.Log_Level, format: str, va: ..any) { + use core {conv} + + buf: [2048] u8; + log(level, conv.format_va(buf, format, cast([] any) va)); +} + + #doc """ Formats a string using the provided arguments and format specified string. This has many overloads to make it easy to work with. diff --git a/core/runtime/platform/onyx/env.onyx b/core/runtime/platform/onyx/env.onyx index 20424e8c..7dba5ddc 100644 --- a/core/runtime/platform/onyx/env.onyx +++ b/core/runtime/platform/onyx/env.onyx @@ -8,7 +8,7 @@ __get_all_env :: () -> [] Pair(str, str) { } __get_env :: (key: str) -> ? str { - buf: [512] u8; + #persist buf: [512] u8; len := __lookup_env(key, buf); if len > 0 do return buf[0 .. len]; -- 2.25.1