changed projects structure

This commit is contained in:
2026-07-27 16:46:46 +01:00
parent e94b26690f
commit 0f97ae9293
9 changed files with 69 additions and 48 deletions
+13
View File
@@ -0,0 +1,13 @@
package js_console
foreign import "console_api"
@(default_calling_convention="contextless")
foreign console_api {
// you can pass values to the JS side too.
trace :: proc(str: string) ---
debug :: proc(str: string) ---
info :: proc(str: string) ---
warn :: proc(str: string) ---
error :: proc(str: string) ---
}
+27
View File
@@ -0,0 +1,27 @@
package js_console
import "core:log"
// Beware that .FATAL is logged as .Error as it is not supported by this interface
// Unknown log levels will be logged by calling 'console.trace'
js_console_logger_proc :: proc(data: rawptr, level: log.Level, text: string, options: log.Options, location := #caller_location) {
// right now options are ignored, maybe revisit it later
switch level {
case .Debug: debug(text)
case .Info: info(text)
case .Warning: warn(text)
case .Error: error(text)
case .Fatal: error(text)
case: trace(text)
}
}
create_js_console_logger :: proc() -> log.Logger {
return log.Logger{
lowest_level = .Debug,
procedure = js_console_logger_proc,
options = {},
data = nil
}
}