/** * Contains the logging framework used for logging errors during compilation. */ #ifndef LOG_H #define LOG_H #include "location.h" /** * A method that can log an error. */ typedef void LogError(const char* msg); /** * Sets the destination for log errors. */ void log_set_output(LogError* destination); /** * Logs an error to the destination. */ void log_error(const char* msg); /** * Logs a pretty error with additional information about the line where the error occurred. * * The @p msg parameter can contain format specifiers like printf, and the additional arguments will be formatted into the message. * It additionally supports the `%S` format specifier, which can be used to format a `String` structure from `string.h`. * * @param loc The location where the error occurred. * @param to_column The column number where the error ends. * @param msg The error message to log. This can contain format specifiers like printf, and the additional arguments will be formatted into the message. * @param ... Additional arguments to format into the error message. */ void log_on_line(Location* loc, int to_column, const char* msg, ...); #endif