aboutsummaryrefslogtreecommitdiff
path: root/core/log
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-03-05 20:34:30 +0000
committergingerBill <bill@gingerbill.org>2020-03-05 20:34:30 +0000
commite92fdb4a99bf9d27009dd35fdd074ff14facfc03 (patch)
treee74c13d12da216f2548db0a8359e491263dc6acd /core/log
parent2fe0eaf2adf952867d4ce4fba53b4b3ac75e1ba5 (diff)
`x if cond else y` and `x when cond else y` expressions
Diffstat (limited to 'core/log')
-rw-r--r--core/log/file_console_logger.odin2
-rw-r--r--core/log/log.odin2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/log/file_console_logger.odin b/core/log/file_console_logger.odin
index 89e88d75e..3136f967b 100644
--- a/core/log/file_console_logger.odin
+++ b/core/log/file_console_logger.odin
@@ -64,7 +64,7 @@ file_console_logger_proc :: proc(logger_data: rawptr, level: Level, text: string
data := cast(^File_Console_Logger_Data)logger_data;
h : os.Handle;
if(data.file_handle != os.INVALID_HANDLE) do h = data.file_handle;
- else do h = level <= Level.Error ? context.stdout : context.stderr;
+ else do h = context.stdout if level <= Level.Error else context.stderr;
backing: [1024]byte; //NOTE(Hoej): 1024 might be too much for a header backing, unless somebody has really long paths.
buf := strings.builder_from_slice(backing[:]);
diff --git a/core/log/log.odin b/core/log/log.odin
index 899f9274e..291d9b739 100644
--- a/core/log/log.odin
+++ b/core/log/log.odin
@@ -125,6 +125,6 @@ log :: proc(level : Level, args : ..any, location := #caller_location) {
logf :: proc(level : Level, fmt_str : string, args : ..any, location := #caller_location) {
logger := context.logger;
if level < logger.lowest_level do return;
- str := len(args) > 0 ? fmt.tprintf(fmt_str, ..args) : fmt.tprint(fmt_str); //NOTE(Hoej): While tprint isn't thread-safe, no logging is.
+ str := fmt.tprintf(fmt_str, ..args) if len(args) > 0 else fmt.tprint(fmt_str); //NOTE(Hoej): While tprint isn't thread-safe, no logging is.
logger.procedure(logger.data, level, str, logger.options, location);
}