fixed: `os.env` bug; added `logf` when `conv.format` is present
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 1 Sep 2023 17:10:34 +0000 (12:10 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 1 Sep 2023 17:10:34 +0000 (12:10 -0500)
core/conv/format.onyx
core/runtime/platform/onyx/env.onyx

index b86c94b6a8774492b80f6d8a309062b3bb7f9be6..5438be6e4603372939436769e4d9682f4cb25fb8 100644 (file)
@@ -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.
index 20424e8c0e4d19423b8e7259f1ec3af8306a1ab5..7dba5ddc8d61326294dbefd373eb38b41e343161 100644 (file)
@@ -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];