Got logging setup
There is an issue with the tracked allocators made for the host module. I'll need to see later whats going on, for now it doesn't matter.
This commit is contained in:
31
code/assert.odin
Normal file
31
code/assert.odin
Normal file
@ -0,0 +1,31 @@
|
||||
package sectr
|
||||
|
||||
import "base:runtime"
|
||||
import "core:os"
|
||||
|
||||
ensure :: proc( condition : b32, msg : string, location := #caller_location )
|
||||
{
|
||||
if ! condition {
|
||||
return
|
||||
}
|
||||
log( msg, LogLevel.Warning, location )
|
||||
runtime.debug_trap()
|
||||
}
|
||||
|
||||
// TODO(Ed) : Setup exit codes!
|
||||
fatal :: proc ( msg : string, exit_code : int = -1, location := #caller_location )
|
||||
{
|
||||
log( msg, LogLevel.Fatal, location )
|
||||
runtime.debug_trap()
|
||||
os.exit( exit_code )
|
||||
}
|
||||
|
||||
verify :: proc ( condition : b32, msg : string, exit_code : int = -1, location := #caller_location )
|
||||
{
|
||||
if ! condition {
|
||||
return
|
||||
}
|
||||
log( msg, LogLevel.Fatal, location )
|
||||
runtime.debug_trap()
|
||||
os.exit( exit_code )
|
||||
}
|
Reference in New Issue
Block a user