mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Merge pull request #704 from oskarnp/log_thread_id
Add .Thread_Id option to log package
This commit is contained in:
@@ -83,6 +83,12 @@ file_console_logger_proc :: proc(logger_data: rawptr, level: Level, text: string
|
|||||||
|
|
||||||
do_location_header(options, &buf, location);
|
do_location_header(options, &buf, location);
|
||||||
|
|
||||||
|
if .Thread_Id in options {
|
||||||
|
// NOTE(Oskar): not using context.thread_id here since that could be
|
||||||
|
// incorrect when replacing context for a thread.
|
||||||
|
fmt.sbprintf(&buf, "[{}] ", os.current_thread_id());
|
||||||
|
}
|
||||||
|
|
||||||
if data.ident != "" do fmt.sbprintf(&buf, "[%s] ", data.ident);
|
if data.ident != "" do fmt.sbprintf(&buf, "[%s] ", data.ident);
|
||||||
//TODO(Hoej): When we have better atomics and such, make this thread-safe
|
//TODO(Hoej): When we have better atomics and such, make this thread-safe
|
||||||
fmt.fprintf(h, "%s %s\n", strings.to_string(buf), text);
|
fmt.fprintf(h, "%s %s\n", strings.to_string(buf), text);
|
||||||
|
|||||||
@@ -279,7 +279,8 @@ Logger_Option :: enum {
|
|||||||
Long_File_Path,
|
Long_File_Path,
|
||||||
Line,
|
Line,
|
||||||
Procedure,
|
Procedure,
|
||||||
Terminal_Color
|
Terminal_Color,
|
||||||
|
Thread_Id
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger_Options :: bit_set[Logger_Option];
|
Logger_Options :: bit_set[Logger_Option];
|
||||||
|
|||||||
Reference in New Issue
Block a user