Add multi_logger.odin; Fix os_windows.odin

This commit is contained in:
gingerBill
2020-06-19 11:49:08 +01:00
parent c9d3b95b0d
commit 240fc65d4d
2 changed files with 29 additions and 3 deletions
+26
View File
@@ -0,0 +1,26 @@
package log
Multi_Logger_Data :: struct {
loggers: []Logger,
}
create_multi_logger :: proc(logs: ..Logger) -> Logger {
data := new(Multi_Logger_Data);
data.loggers = make([]Logger, len(logs));
copy(data.loggers, logs);
return Logger{multi_logger_proc, data, Level.Debug, nil};
}
destroy_multi_logger :: proc(log : ^Logger) {
free(log.data);
log^ = nil_logger();
}
multi_logger_proc :: proc(logger_data: rawptr, level: Level, text: string,
options: Options, location := #caller_location) {
data := cast(^Multi_Logger_Data)logger_data;
for log in data.loggers {
log.procedure(log.data, level, text, log.options, location);
}
}
+3 -3
View File
@@ -76,13 +76,13 @@ open :: proc(path: string, mode: int = O_RDONLY, perm: int = 0) -> (Handle, Errn
case O_RDWR: access = win32.FILE_GENERIC_READ | win32.FILE_GENERIC_WRITE;
}
if mode&O_CREATE != 0 {
access |= win32.FILE_GENERIC_WRITE;
}
if mode&O_APPEND != 0 {
access &~= win32.FILE_GENERIC_WRITE;
access |= win32.FILE_APPEND_DATA;
}
if mode&O_CREATE != 0 {
access |= win32.FILE_GENERIC_WRITE;
}
share_mode := u32(win32.FILE_SHARE_READ|win32.FILE_SHARE_WRITE);
sa: ^win32.Security_Attributes = nil;