aboutsummaryrefslogtreecommitdiff
path: root/core/log
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-06-21 01:17:05 +0100
committergingerBill <bill@gingerbill.org>2023-06-21 01:17:05 +0100
commit9b54b99bf696a65bc5c8358b2a5ace1f6dc4fdcc (patch)
tree1e20f43aa33209caf9015d9b63384633eed455a4 /core/log
parent67ca9166d36375fd42725c16ca3933d4c91ebfee (diff)
Use positional and named arguments within the core library
Diffstat (limited to 'core/log')
-rw-r--r--core/log/log.odin26
-rw-r--r--core/log/log_allocator.odin54
2 files changed, 40 insertions, 40 deletions
diff --git a/core/log/log.odin b/core/log/log.odin
index a699247b8..f3554791b 100644
--- a/core/log/log.odin
+++ b/core/log/log.odin
@@ -76,43 +76,43 @@ nil_logger :: proc() -> Logger {
}
debugf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
- logf(level=.Debug, fmt_str=fmt_str, args=args, location=location)
+ logf(.Debug, fmt_str, ..args, location=location)
}
infof :: proc(fmt_str: string, args: ..any, location := #caller_location) {
- logf(level=.Info, fmt_str=fmt_str, args=args, location=location)
+ logf(.Info, fmt_str, ..args, location=location)
}
warnf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
- logf(level=.Warning, fmt_str=fmt_str, args=args, location=location)
+ logf(.Warning, fmt_str, ..args, location=location)
}
errorf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
- logf(level=.Error, fmt_str=fmt_str, args=args, location=location)
+ logf(.Error, fmt_str, ..args, location=location)
}
fatalf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
- logf(level=.Fatal, fmt_str=fmt_str, args=args, location=location)
+ logf(.Fatal, fmt_str, ..args, location=location)
}
debug :: proc(args: ..any, sep := " ", location := #caller_location) {
- log(level=.Debug, args=args, sep=sep, location=location)
+ log(.Debug, ..args, sep=sep, location=location)
}
info :: proc(args: ..any, sep := " ", location := #caller_location) {
- log(level=.Info, args=args, sep=sep, location=location)
+ log(.Info, ..args, sep=sep, location=location)
}
warn :: proc(args: ..any, sep := " ", location := #caller_location) {
- log(level=.Warning, args=args, sep=sep, location=location)
+ log(.Warning, ..args, sep=sep, location=location)
}
error :: proc(args: ..any, sep := " ", location := #caller_location) {
- log(level=.Error, args=args, sep=sep, location=location)
+ log(.Error, ..args, sep=sep, location=location)
}
fatal :: proc(args: ..any, sep := " ", location := #caller_location) {
- log(level=.Fatal, args=args, sep=sep, location=location)
+ log(.Fatal, ..args, sep=sep, location=location)
}
panic :: proc(args: ..any, location := #caller_location) -> ! {
- log(level=.Fatal, args=args, location=location)
+ log(.Fatal, ..args, location=location)
runtime.panic("log.panic", location)
}
panicf :: proc(fmt_str: string, args: ..any, location := #caller_location) -> ! {
- logf(level=.Fatal, fmt_str=fmt_str, args=args, location=location)
+ logf(.Fatal, fmt_str, ..args, location=location)
runtime.panic("log.panicf", location)
}
@@ -127,7 +127,7 @@ log :: proc(level: Level, args: ..any, sep := " ", location := #caller_location)
if level < logger.lowest_level {
return
}
- str := fmt.tprint(args=args, sep=sep) //NOTE(Hoej): While tprint isn't thread-safe, no logging is.
+ str := fmt.tprint(..args, sep=sep) //NOTE(Hoej): While tprint isn't thread-safe, no logging is.
logger.procedure(logger.data, level, str, logger.options, location)
}
diff --git a/core/log/log_allocator.odin b/core/log/log_allocator.odin
index f4d1841db..934f0d643 100644
--- a/core/log/log_allocator.odin
+++ b/core/log/log_allocator.odin
@@ -38,60 +38,60 @@ log_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
switch mode {
case .Alloc:
logf(
- level=la.level,
- fmt_str = "%s%s>>> ALLOCATOR(mode=.Alloc, size=%d, alignment=%d)",
- args = {la.prefix, padding, size, alignment},
+ la.level,
+ "%s%s>>> ALLOCATOR(mode=.Alloc, size=%d, alignment=%d)",
+ la.prefix, padding, size, alignment,
location = location,
)
case .Alloc_Non_Zeroed:
logf(
- level=la.level,
- fmt_str = "%s%s>>> ALLOCATOR(mode=.Alloc_Non_Zeroed, size=%d, alignment=%d)",
- args = {la.prefix, padding, size, alignment},
+ la.level,
+ "%s%s>>> ALLOCATOR(mode=.Alloc_Non_Zeroed, size=%d, alignment=%d)",
+ la.prefix, padding, size, alignment,
location = location,
)
case .Free:
if old_size != 0 {
logf(
- level=la.level,
- fmt_str = "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p, size=%d)",
- args = {la.prefix, padding, old_memory, old_size},
+ la.level,
+ "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p, size=%d)",
+ la.prefix, padding, old_memory, old_size,
location = location,
)
} else {
logf(
- level=la.level,
- fmt_str = "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p)",
- args = {la.prefix, padding, old_memory},
+ la.level,
+ "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p)",
+ la.prefix, padding, old_memory,
location = location,
)
}
case .Free_All:
logf(
- level=la.level,
- fmt_str = "%s%s<<< ALLOCATOR(mode=.Free_All)",
- args = {la.prefix, padding},
+ la.level,
+ "%s%s<<< ALLOCATOR(mode=.Free_All)",
+ la.prefix, padding,
location = location,
)
case .Resize:
logf(
- level=la.level,
- fmt_str = "%s%s>>> ALLOCATOR(mode=.Resize, ptr=%p, old_size=%d, size=%d, alignment=%d)",
- args = {la.prefix, padding, old_memory, old_size, size, alignment},
+ la.level,
+ "%s%s>>> ALLOCATOR(mode=.Resize, ptr=%p, old_size=%d, size=%d, alignment=%d)",
+ la.prefix, padding, old_memory, old_size, size, alignment,
location = location,
)
case .Query_Features:
logf(
- level=la.level,
- fmt_str = "%s%ALLOCATOR(mode=.Query_Features)",
- args = {la.prefix, padding},
+ la.level,
+ "%s%ALLOCATOR(mode=.Query_Features)",
+ la.prefix, padding,
location = location,
)
case .Query_Info:
logf(
- level=la.level,
- fmt_str = "%s%ALLOCATOR(mode=.Query_Info)",
- args = {la.prefix, padding},
+ la.level,
+ "%s%ALLOCATOR(mode=.Query_Info)",
+ la.prefix, padding,
location = location,
)
}
@@ -103,9 +103,9 @@ log_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
defer la.locked = false
if err != nil {
logf(
- level=la.level,
- fmt_str = "%s%ALLOCATOR ERROR=%v",
- args = {la.prefix, padding, error},
+ la.level,
+ "%s%ALLOCATOR ERROR=%v",
+ la.prefix, padding, error,
location = location,
)
}