aboutsummaryrefslogtreecommitdiff
path: root/core/log
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-09-23 17:17:14 +0100
committergingerBill <bill@gingerbill.org>2020-09-23 17:17:14 +0100
commitfc4fdd588e5bd0c45d04c792267a0f4434c6a38e (patch)
tree59bcddc60248dd78ed1155dd7a6ae7ae3de2e07e /core/log
parent4844dd4d96f0921f44e70c9960d3e4476aad7115 (diff)
Remove usage of `do` in core library
Diffstat (limited to 'core/log')
-rw-r--r--core/log/file_console_logger.odin25
1 files changed, 18 insertions, 7 deletions
diff --git a/core/log/file_console_logger.odin b/core/log/file_console_logger.odin
index 757bb5ff5..de491950d 100644
--- a/core/log/file_console_logger.odin
+++ b/core/log/file_console_logger.odin
@@ -43,7 +43,9 @@ create_file_logger :: proc(h: os.Handle, lowest := Level.Debug, opt := Default_F
destroy_file_logger :: proc(log: ^Logger) {
data := cast(^File_Console_Logger_Data)log.data;
- if data.file_handle != os.INVALID_HANDLE do os.close(data.file_handle);
+ if data.file_handle != os.INVALID_HANDLE {
+ os.close(data.file_handle);
+ }
free(data);
}
@@ -75,8 +77,8 @@ file_console_logger_proc :: proc(logger_data: rawptr, level: Level, text: string
t := time.now();
y, m, d := time.date(t);
h, min, s := time.clock(t);
- if .Date in options do fmt.sbprintf(&buf, "%d-%02d-%02d ", y, m, d);
- if .Time in options do fmt.sbprintf(&buf, "%02d:%02d:%02d", h, min, s);
+ if .Date in options { fmt.sbprintf(&buf, "%d-%02d-%02d ", y, m, d); }
+ if .Time in options { fmt.sbprintf(&buf, "%02d:%02d:%02d", h, min, s); }
fmt.sbprint(&buf, "] ");
}
}
@@ -89,7 +91,9 @@ file_console_logger_proc :: proc(logger_data: rawptr, level: Level, text: string
fmt.sbprintf(&buf, "[{}] ", os.current_thread_id());
}
- if data.ident != "" do fmt.sbprintf(&buf, "[%s] ", data.ident);
+ if data.ident != "" {
+ fmt.sbprintf(&buf, "[%s] ", data.ident);
+ }
//TODO(Hoej): When we have better atomics and such, make this thread-safe
fmt.fprintf(h, "%s %s\n", strings.to_string(buf), text);
}
@@ -110,14 +114,21 @@ do_level_header :: proc(opts: Options, level: Level, str: ^strings.Builder) {
}
if .Level in opts {
- if .Terminal_Color in opts do fmt.sbprint(str, col);
+ if .Terminal_Color in opts {
+ fmt.sbprint(str, col);
+ }
fmt.sbprint(str, Level_Headers[level]);
- if .Terminal_Color in opts do fmt.sbprint(str, RESET);
+ if .Terminal_Color in opts {
+ fmt.sbprint(str, RESET);
+ }
}
}
do_location_header :: proc(opts: Options, buf: ^strings.Builder, location := #caller_location) {
- if Location_Header_Opts & opts != nil do fmt.sbprint(buf, "["); else do return;
+ if Location_Header_Opts & opts == nil {
+ return;
+ }
+ fmt.sbprint(buf, "[");
file := location.file_path;
if .Short_File_Path in opts {