48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
|
|
#ifndef CARROT_LOGGING_H
|
|
#define CARROT_LOGGING_H
|
|
|
|
#include <utility.h>
|
|
|
|
typedef enum
|
|
{
|
|
CARROT_PARSER_ERROR_SEVERITY_NOTE,
|
|
CARROT_PARSER_ERROR_SEVERITY_WARNING,
|
|
CARROT_PARSER_ERROR_SEVERITY_ERROR,
|
|
CARROT_PARSER_ERROR_SEVERITY_UNRECOVERABLE_ERROR
|
|
|
|
} carrot_error_severity_e;
|
|
|
|
typedef enum
|
|
{
|
|
CARROT_PARSER_LOG_ITEM,
|
|
CARROT_SYNTAX_LOG_ITEM
|
|
|
|
} carrot_log_item_type_e;
|
|
|
|
typedef struct carrot_log carrot_log_s;
|
|
typedef struct carrot_log_item carrot_log_item_s;
|
|
typedef struct carrot_log_message carrot_log_message_s;
|
|
|
|
struct carrot_log_message
|
|
{
|
|
carrot_error_severity_e severity;
|
|
cstr_s text;
|
|
};
|
|
|
|
struct carrot_log
|
|
{
|
|
u32_t capacity;
|
|
u32_t length;
|
|
carrot_log_message_s *items;
|
|
};
|
|
|
|
carrot_log_s carrot_create_log ();
|
|
|
|
void carrot_issue_note (carrot_log_s *log, char *message);
|
|
void carrot_issue_warning (carrot_log_s *log, char *message);
|
|
void carrot_issue_error (carrot_log_s *log, char *message);
|
|
void carrot_issue_unrecoverable_error (carrot_log_s *log, char *message);
|
|
|
|
#endif // CARROT_LOGGING_H
|