#include "logout.h"
#include "QDebug"
#include "QTextCodec"
QString colorcode = "\033[";
int outputlevel = 4;
logout::logout(QObject *parent)
	: QObject(parent)
{
}

logout::~logout()
{
}

void logout::out(QString str,int level)
{
	if (level>outputlevel)
	{
		return;
	}
	QTextCodec *codec = QTextCodec::codecForName("GBK");//修改这两行
	int colorint;
	switch (level)
	{
	case 0:
	{
		

		break;
	}
	case 1:
	{
		
		qDebug() << "\033[32m";//绿色
		break;
	}
	case 2:
	{

		qDebug() << "\033[35m";//绿色
		break;
	}
	case 3:
	{

		qDebug() << "\033[31m";//红色
		break;
	}
	default:
	{	
	break;
	}
	}
	//str=codec->toUnicode(str.toStdString().c_str());
	qDebug() <<str;
	qDebug() << "\033[0m";
}

void logout::setoutlevel(int level /*= 4*/)
{
	outputlevel = level;

}
