/*
 * ghost_rtlog.cpp
 *
 */

#include "ghost_playback.h"

#include "rtlog.h"

class GhostRtLogger: public GhostLogger
{
public:
	void vPrint(Level level, const char* fmt, va_list args) override
	{
		int log_level=rtlog_info;
		switch(level)
		{
		default:
			break;
		case GhostLogger::debug:
			log_level=rtlog_debug;
			break;
		case GhostLogger::trace:
			log_level=rtlog_trace;
			break;
		case GhostLogger::success:
			log_level=rtlog_success;
			break;
		case GhostLogger::warning:
			log_level=rtlog_warning|rtlog_breaking_news;
			break;
		case GhostLogger::error:
			log_level=rtlog_error|rtlog_breaking_news;
			break;
		case GhostLogger::fatal:
		case GhostLogger::fail:
			log_level=rtlog_fatal|rtlog_breaking_news;
			break;
		}

		rtlog_vprintf("GHOST", log_level/*|rtlog_breaking_news*/, fmt, args);
	}
};

static GhostRtLogger ghostRtLogger;

void Ghost::rtLoggerInstall()
{
	Ghost::setLoggerInterface(&ghostRtLogger);
}

