mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 16:48:18 +00:00
Minor code clean-up
This commit is contained in:
+15
-10
@@ -23,18 +23,18 @@ Option :: enum {
|
||||
|
||||
Options :: bit_set[Option];
|
||||
Full_Timestamp_Opts :: Options{
|
||||
Option.Date,
|
||||
Option.Time
|
||||
.Date,
|
||||
.Time
|
||||
};
|
||||
Location_Header_Opts :: Options{
|
||||
Option.Short_File_Path,
|
||||
Option.Long_File_Path,
|
||||
Option.Line,
|
||||
Option.Procedure,
|
||||
.Short_File_Path,
|
||||
.Long_File_Path,
|
||||
.Line,
|
||||
.Procedure,
|
||||
};
|
||||
Location_File_Opts :: Options{
|
||||
Option.Short_File_Path,
|
||||
Option.Long_File_Path
|
||||
.Short_File_Path,
|
||||
.Long_File_Path
|
||||
};
|
||||
|
||||
Logger_Proc :: #type proc(data: rawptr, level: Level, text: string, options: Options, location := #caller_location);
|
||||
@@ -64,8 +64,12 @@ destroy_multi_logger ::proc(log : ^Logger) {
|
||||
multi_logger_proc :: proc(logger_data: rawptr, level: Level, text: string,
|
||||
options: Options, location := #caller_location) {
|
||||
data := cast(^Multi_Logger_Data)logger_data;
|
||||
if data.loggers == nil || len(data.loggers) == 0 do return;
|
||||
for log in data.loggers do log.procedure(log.data, level, text, log.options, location);
|
||||
if data.loggers == nil || len(data.loggers) == 0 {
|
||||
return;
|
||||
}
|
||||
for log in data.loggers {
|
||||
log.procedure(log.data, level, text, log.options, location);
|
||||
}
|
||||
}
|
||||
|
||||
nil_logger_proc :: proc(data: rawptr, level: Level, text: string, options: Options, location := #caller_location) {
|
||||
@@ -76,6 +80,7 @@ nil_logger :: proc() -> Logger {
|
||||
return Logger{nil_logger_proc, nil, nil};
|
||||
}
|
||||
|
||||
// TODO(bill): Should these be redesigned so that they are do not rely upon `package fmt`?
|
||||
debug :: proc(fmt_str : string, args : ..any, location := #caller_location) do logf(level=Level.Debug, fmt_str=fmt_str, args=args, location=location);
|
||||
info :: proc(fmt_str : string, args : ..any, location := #caller_location) do logf(level=Level.Info, fmt_str=fmt_str, args=args, location=location);
|
||||
warn :: proc(fmt_str : string, args : ..any, location := #caller_location) do logf(level=Level.Warning, fmt_str=fmt_str, args=args, location=location);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package mem
|
||||
|
||||
|
||||
|
||||
nil_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, flags: u64 = 0, loc := #caller_location) -> rawptr {
|
||||
|
||||
Reference in New Issue
Block a user