Move DEBUG() from Utils.h into new ZNCDebug.h

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2011-04-03 10:41:27 +02:00
parent 0e0ab34773
commit ac5c021c93
9 changed files with 81 additions and 50 deletions
+6 -13
View File
@@ -9,6 +9,7 @@
#include "Utils.h"
#include "MD5.h"
#include "main.h"
#include "ZNCDebug.h"
#include <errno.h>
#ifdef HAVE_LIBSSL
#include <openssl/ssl.h>
@@ -24,14 +25,6 @@
using std::stringstream;
bool CUtils::stdoutIsTTY = true;
bool CUtils::debug =
#ifdef _DEBUG
true;
#else
false;
#endif
CUtils::CUtils() {}
CUtils::~CUtils() {}
@@ -271,7 +264,7 @@ bool CUtils::GetInput(const CString& sPrompt, CString& sRet, const CString& sDef
}
void CUtils::PrintError(const CString& sMessage) {
if (stdoutIsTTY)
if (CDebug::StdoutIsTTY())
fprintf(stdout, "\033[1m\033[34m[\033[31m ** \033[34m]\033[39m\033[22m %s\n", sMessage.c_str());
else
fprintf(stdout, "%s\n", sMessage.c_str());
@@ -279,7 +272,7 @@ void CUtils::PrintError(const CString& sMessage) {
}
void CUtils::PrintPrompt(const CString& sMessage) {
if (stdoutIsTTY)
if (CDebug::StdoutIsTTY())
fprintf(stdout, "\033[1m\033[34m[\033[33m ?? \033[34m]\033[39m\033[22m %s: ", sMessage.c_str());
else
fprintf(stdout, "[ ?? ] %s: ", sMessage.c_str());
@@ -287,7 +280,7 @@ void CUtils::PrintPrompt(const CString& sMessage) {
}
void CUtils::PrintMessage(const CString& sMessage, bool bStrong) {
if (stdoutIsTTY) {
if (CDebug::StdoutIsTTY()) {
if (bStrong)
fprintf(stdout, "\033[1m\033[34m[\033[33m ** \033[34m]\033[39m\033[22m \033[1m%s\033[22m\n",
sMessage.c_str());
@@ -301,7 +294,7 @@ void CUtils::PrintMessage(const CString& sMessage, bool bStrong) {
}
void CUtils::PrintAction(const CString& sMessage) {
if (stdoutIsTTY)
if (CDebug::StdoutIsTTY())
fprintf(stdout, "\033[1m\033[34m[\033[32m \033[34m]\033[39m\033[22m %s... ", sMessage.c_str());
else
fprintf(stdout, "%s... ", sMessage.c_str());
@@ -309,7 +302,7 @@ void CUtils::PrintAction(const CString& sMessage) {
}
void CUtils::PrintStatus(bool bSuccess, const CString& sMessage) {
if (stdoutIsTTY) {
if (CDebug::StdoutIsTTY()) {
if (!sMessage.empty()) {
if (bSuccess) {
fprintf(stdout, "%s", sMessage.c_str());