Merge pull request 'Log Colors' (#8) from logger/colors into main
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
@@ -14,10 +14,9 @@ typedef enum level_color {
|
||||
} level_color;
|
||||
|
||||
void send_to_console(const char *message, level_color color) {
|
||||
// TODO: Make use of the color we are passing in so that we can color the
|
||||
// output on the console
|
||||
const char *color_strings[] = {"41;97", "0;91", "0;93", "0;94", "0;92"};
|
||||
|
||||
printf("%s", message);
|
||||
printf("\033[%sm%s\033[0m\n", color_strings[color], message);
|
||||
}
|
||||
|
||||
void send_to_error_log(const char *message) {
|
||||
@@ -48,7 +47,7 @@ void log_output(log_level level, const char *message, ...) {
|
||||
|
||||
// Now we prepend the message with our message level
|
||||
char log_message[msg_length];
|
||||
sprintf(log_message, "%s%s\n", level_strings[level], format_message);
|
||||
sprintf(log_message, "%s%s", level_strings[level], format_message);
|
||||
|
||||
// Now we call the appropriate function depending on the level
|
||||
if (level <= 1) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include <stdio.h> // printf()
|
||||
#include <stdlib.h> // malloc() free()
|
||||
#include <string.h>
|
||||
#include <string.h> // memset()
|
||||
|
||||
#include "../defines.h"
|
||||
#include "../logger/logger.h"
|
||||
#include "zone.h"
|
||||
|
||||
typedef struct ZoneHeader {
|
||||
@@ -32,7 +33,7 @@ void *zoneAlloc(Zone *zone, size_t sizeBytes) {
|
||||
ZoneHeader *zone_header = (ZoneHeader *)zone - sizeof(ZoneHeader);
|
||||
|
||||
if (zone_header->cur_size + sizeBytes > zone_header->capacity) {
|
||||
printf("Could not allocate, not enough space.");
|
||||
QERROR("Could not allocate, not enough space.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user