#include "sw_log.h" #include static SW_Log *m_pLogInstance = NULL; QString SW_Log::m_appInfo = ""; void SW_Log::Create(const QString& appPath,const QString appInfo) { m_appInfo = appInfo; if(m_pLogInstance == NULL) { m_pLogInstance = new SW_Log; } } SW_Log* SW_Log::Get() { if(m_pLogInstance == NULL) { m_pLogInstance = new SW_Log; } return m_pLogInstance; } void SW_Log::Destroy() { SW_Log::Get()->warning("SW_Log::Destroy"); if (m_pLogInstance) { delete m_pLogInstance; m_pLogInstance = NULL; } } void SW_Log::error(const char *message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.error(message); qDebug() << message; } void SW_Log::error(const QString &message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.error(message.toStdString()); qDebug() << message; } void SW_Log::warning(const char *message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.warn(message); qDebug() << message; } void SW_Log::warning(const QString &message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.warn(message.toStdString()); qDebug() << message; } void SW_Log::debug(const char *message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.debug(message); qDebug() << message; } void SW_Log::debug(const QString &message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.debug(message.toStdString()); qDebug() << message; } void SW_Log::info(const char *message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.info(message); qDebug() << message; } void SW_Log::info(const QString &message) { // log4cpp::Category& root = log4cpp::Category::getRoot(); // root.info(message.toStdString()); qDebug() << message; } QString SW_Log::GetUserDir() { return m_userDir; } QString SW_Log::GetConfFile() { return m_confFile; } QString SW_Log::GetEnvUserDir() { return m_envUserDir; } SW_Log::SW_Log() { } SW_Log::~SW_Log() { // log4cpp::Category::shutdown(); }