From: Brendan Hansen Date: Fri, 1 Sep 2023 17:10:34 +0000 (-0500) Subject: fixed: `os.env` bug; added `logf` when `conv.format` is present X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=21768bd3e39432f7b09bf86804dae167dac297fb;p=onyx.git fixed: `os.env` bug; added `logf` when `conv.format` is present --- 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];