add libpike and some main testing

This commit is contained in:
2025-11-08 09:19:14 -05:00
parent e6ed3ed5d8
commit 10edb85219
4 changed files with 260 additions and 1 deletions

40
libpike/log/log.odin Normal file
View File

@@ -0,0 +1,40 @@
// SPDX-License-Identifer: MIT
/* log.odin
*
* Routines for logging
*
* Written by vx-clutch
*/
package log
import "core:fmt"
import "core:time"
import "../util"
RESET :: "\x1B[0m"
TIME :: "\x1B[0;32m"
LOCATION :: "\x1B[0;33m"
current_time :: proc() -> string {
t := time.now()
year, month, day := time.date(t)
hour, minute, second := time.clock(t)
return fmt.tprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second)
}
printl :: proc(msg: string, args: ..any, here := #caller_location) {
buf := current_time()
fmt.printf(
"%s[%12s]%s: %s:%d (%s)%s: ",
TIME,
buf,
LOCATION,
util.basename(here.file_path),
here.line,
here.procedure,
RESET,
)
fmt.printfln(msg, ..args)
}