Fixed compilation error in basalt_logger where it whined about or'ing together two enum values for the log level.
Fixed a compilation error where the log level mask was being shadowed by log level index in basalt_log and basalt_write. Fixed a bug where logger_add_stream was checking the lower 48-bits of the FILE* rather than the upper 16 were zero. Fixed a bug where logger_add_stream did not mark a stream as allocated in its flags. Fixed a bug where logger_remove_stream did not check if a stream was allocated. Addressed warnings of potential saftey issues when logging the prefixes as if they were format strings by having them be format-specified. I suspect this is marginally slower and realistically had no security risk in the first place but was fixed anyway.
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
#define BASALT_LOGGER_MAX_STREAMS 7
|
||||
#endif
|
||||
|
||||
typedef enum LOG_LEVEL {
|
||||
typedef u8 LOG_LEVEL;
|
||||
typedef enum LOG_LEVELS {
|
||||
LOG_FATAL = 1,
|
||||
LOG_ERROR = 2,
|
||||
LOG_WARN = 4,
|
||||
@@ -22,8 +23,9 @@ typedef enum LOG_LEVEL {
|
||||
LOG_MASK_INFO = LOG_WARN | LOG_INFO | LOG_OK,
|
||||
LOG_MASK_ALL = LOG_MASK_ERRORS | LOG_MASK_DEBUGGING | LOG_MASK_INFO,
|
||||
LOG_MASK_DEFAULT = LOG_MASK_ERRORS | LOG_MASK_INFO,
|
||||
} LOG_LEVEL;
|
||||
} LOG_LEVELS;
|
||||
|
||||
typedef u8 LOG_STREAM_FLAG;
|
||||
typedef enum LOG_STREAM_FLAGS {
|
||||
// Ignore this flag - it is internal to the library
|
||||
LOG_STREAM_FLAG_INTERNAL_ALLOCATED_BIT = 1,
|
||||
@@ -42,7 +44,7 @@ void initialize_logger();
|
||||
void terminate_logger ();
|
||||
|
||||
FILE* logger_stream_get_file(logger_stream_t* state);
|
||||
u8 logger_add_stream(FILE* output, LOG_LEVEL mask, LOG_STREAM_FLAGS flags);
|
||||
u8 logger_add_stream(FILE* output, LOG_LEVEL mask, LOG_STREAM_FLAG flags);
|
||||
void logger_remove_stream(u8 index);
|
||||
u8 logger_find_stream(FILE* target);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user