#pragma once
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>

namespace spdlog {
	class logger;
}

namespace deerith {
	namespace log {
		spdlog::logger* get_core_logger();
		spdlog::logger* get_graphics_logger();
	}; // namespace log
} // namespace deerith

#define deerith_core_trace(...) deerith::log::get_core_logger()->trace(__VA_ARGS__)
#define deerith_core_info(...) deerith::log::get_core_logger()->info(__VA_ARGS__)
#define deerith_core_warn(...) deerith::log::get_core_logger()->warn(__VA_ARGS__)
#define deerith_core_error(...) deerith::log::get_core_logger()->error(__VA_ARGS__)

#define deerith_graphics_trace(...) deerith::log::get_graphics_logger()->trace(__VA_ARGS__)
#define deerith_graphics_info(...) deerith::log::get_graphics_logger()->info(__VA_ARGS__)
#define deerith_graphics_warn(...) deerith::log::get_graphics_logger()->warn(__VA_ARGS__)
#define deerith_graphics_error(...) deerith::log::get_graphics_logger()->error(__VA_ARGS__)

#define deerith_core_assert(condition, ...)                  \
	if (!(condition)) {                                      \
		deerith::log::get_core_logger()->error(__VA_ARGS__); \
		__builtin_trap();                                    \
	}

#define deerith_graphics_assert(condition, ...)                  \
	if (!(condition)) {                                          \
		deerith::log::get_graphics_logger()->error(__VA_ARGS__); \
		__builtin_trap();                                        \
	}
