#include <deerith/core/log.h>

#include "detail/log.h"

namespace deerith {
	namespace log {
		std::shared_ptr<spdlog::logger> core_logger;
		std::shared_ptr<spdlog::logger> graphics_logger;
	} // namespace log

	void log::init() {
		spdlog::set_pattern("%^[%T] %n: %v%$");

		core_logger = spdlog::stdout_color_mt("core");
		graphics_logger = spdlog::stdout_color_mt("graphics");

		core_logger->set_level(spdlog::level::level_enum::trace);
		graphics_logger->set_level(spdlog::level::level_enum::trace);
	}

	void log::shutdown() {
		core_logger.reset();
		graphics_logger.reset();

		spdlog::drop_all();
	}

	spdlog::logger* log::get_core_logger() {
		return core_logger.get();
	}

	spdlog::logger* log::get_graphics_logger() {
		return graphics_logger.get();
	}
} // namespace deerith