#include "logger.h"
#include "../basic/scene_graph.h"


# include <QMessageBox>



SceneGraph* Logger::canvas_ = NULL;


void Logger::init(SceneGraph *canvas) {
	canvas_ = canvas;
}


SceneGraph& Logger::output(const std::string& msg) {
	if (canvas_ == NULL) {
		QMessageBox::warning((QWidget*)canvas_, "PcdViewer", "Logger is NOT initialized!");
		return *canvas_;
	}

	canvas_->output(msg);
	return *canvas_;
}

std::string Logger::endl() {
	if (canvas_ == NULL) {
		QMessageBox::warning((QWidget*)canvas_, "PcdViewer", "Logger is NOT initialized!");
		return "";
	}

	return ("\n");
}