diff --git a/uppsrc/Core/Debug.cpp b/uppsrc/Core/Debug.cpp index ecd7a37af..dd928ff8b 100644 --- a/uppsrc/Core/Debug.cpp +++ b/uppsrc/Core/Debug.cpp @@ -1,5 +1,10 @@ #include "Core.h" +#ifdef PLATFORM_WIN32 +#include +#endif + + NAMESPACE_UPP #define LTIMING(x) // TIMING(x) @@ -232,9 +237,8 @@ LONG __stdcall sDumpHandler(LPEXCEPTION_POINTERS ep) { sprintf(h, "CRASH: %d-%02d-%02d %02d:%02d:%02d code: 0x%X address: 0x%p", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, er->ExceptionCode, er->ExceptionAddress); - UsrLogT("============ CRASH ================================================"); - UsrLogT(h); - BugLog() << h << "\r\n"; + RLOG("============ CRASH ================================================"); + RLOG(h); return sPrev ? (*sPrev)(ep) : 0 /*EXCEPTION_CONTINUE_SEARCH*/; } diff --git a/uppsrc/Core/Log.cpp b/uppsrc/Core/Log.cpp index 64087de6e..1e8ec87d4 100644 --- a/uppsrc/Core/Log.cpp +++ b/uppsrc/Core/Log.cpp @@ -85,7 +85,7 @@ void LogOut::Create(bool append) filesize = 0; #ifdef PLATFORM_WIN32 - hfile = CreateFile(ToSysChrSet(filename), + hfile = CreateFile(ToSysChrSet(filepath), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, @@ -198,7 +198,7 @@ void LogOut::Line(const char *s, int len, int depth) } if(options & LOG_DBG) { *p = 0; - ::OutputDebugString((LPCSTR)buffer); + ::OutputDebugString((LPCSTR)h); } #else if(options & LOG_FILE) @@ -326,10 +326,6 @@ void InitBlockEnd__(const char *fn, int line) { #endif -#ifdef PLATFORM_WIN32 -#include -#endif - #ifdef PLATFORM_WIN32 static void sLogFile(char *fn, const char *app = ".log") { @@ -443,6 +439,7 @@ Stream& UppLog() { } Stream& VppLog() { + return UppLog(); } void SetVppLogName(const String& file) { diff --git a/uppsrc/CtrlCore/TopWin32.cpp b/uppsrc/CtrlCore/TopWin32.cpp index 8fe777d5c..b48908dba 100644 --- a/uppsrc/CtrlCore/TopWin32.cpp +++ b/uppsrc/CtrlCore/TopWin32.cpp @@ -205,7 +205,7 @@ void TopWindow::Open(HWND hwnd) GuiLock __; if(dokeys && (!GUI_AKD_Conservative() || GetAccessKeysDeep() <= 1)) DistributeAccessKeys(); - UsrLogT(3, "OPEN " + Desc(this)); + USRLOG(" OPEN " << Desc(this)); LLOG("TopWindow::Open, owner HWND = " << FormatIntHex((int)hwnd, 8) << ", Active = " << FormatIntHex((int)::GetActiveWindow(), 8)); IgnoreMouseUp(); SyncCaption(); diff --git a/uppsrc/Sql/Session.cpp b/uppsrc/Sql/Session.cpp index 03fa2cd05..540fb8c4a 100644 --- a/uppsrc/Sql/Session.cpp +++ b/uppsrc/Sql/Session.cpp @@ -11,8 +11,6 @@ SqlSession::SqlSession() { trace = NULL; traceslow = INT_MAX / 4; - logerrors = false; - usrlog = false; tracetime = false; dialect = 255; errorcode_number = Null; @@ -73,8 +71,6 @@ void SqlSession::SetError(String error, String stmt, int code, const char *sco errorclass = clss; String err; err << "ERROR " << error << "(" << code << "): " << stmt << '\n'; - if(logerrors) - BugLog() << err; if(GetTrace()) *GetTrace() << err; } diff --git a/uppsrc/Sql/Sql.cpp b/uppsrc/Sql/Sql.cpp index e479035cb..985d17133 100644 --- a/uppsrc/Sql/Sql.cpp +++ b/uppsrc/Sql/Sql.cpp @@ -107,8 +107,6 @@ bool Sql::Execute() { session.SetStatement(cn->statement); session.SetStatus(SqlSession::BEFORE_EXECUTING); cn->starttime = GetTickCount(); - if(session.usrlog) - UsrLogT(9, cn->statement); Stream *s = session.GetTrace(); if(s) { #ifndef NOAPPSQL @@ -215,17 +213,12 @@ bool Sql::Fetch() { session.SetStatus(SqlSession::END_FETCHING_MANY); } Stream *s = session.GetTrace(); - if((int)total > session.traceslow) { - BugLog() << total << " ms: " << cn->statement << UPP::EOL; - if(s) - *s << total << " ms: " << cn->statement << UPP::EOL; - } - else - if((int)fetch > session.traceslow) { - BugLog() << fetch << " ms further fetch: " << cn->statement << UPP::EOL; - if(s) - *s << fetch << " ms further fetch: " << cn->statement << UPP::EOL; - } + if(s) + if((int)total > session.traceslow) + *s << "SLOW SQL: " << total << " ms: " << cn->statement << UPP::EOL; + else + if((int)fetch > session.traceslow) + *s << "SLOW SQL: " << fetch << " ms further fetch: " << cn->statement << UPP::EOL; cn->starttime = INT_MAX; return b; } diff --git a/uppsrc/Sql/Sqls.h b/uppsrc/Sql/Sqls.h index ab479a107..20673e723 100644 --- a/uppsrc/Sql/Sqls.h +++ b/uppsrc/Sql/Sqls.h @@ -301,9 +301,7 @@ protected: friend class Sql; Stream *trace; - bool logerrors; bool tracetime; - bool usrlog; int traceslow; int dialect; int exectime; @@ -360,8 +358,6 @@ public: void TraceTime(bool b = true) { tracetime = b; } bool IsTraceTime() const { return tracetime; } - SqlSession& LogErrors(bool b = true) { logerrors = true; return *this; } - SqlSession& UsrLog(bool b = true) { usrlog = true; return *this; } SqlSession& TraceSlow(int ms = 5000) { traceslow = ms; return *this; } SqlSession& ThrowOnError(bool b = true) { throwonerror = b; return *this; }