mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
*uppsrc: LOG related fixes
git-svn-id: svn://ultimatepp.org/upp/trunk@5094 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f10aabc3c4
commit
41e19caac5
6 changed files with 17 additions and 31 deletions
|
|
@ -1,5 +1,10 @@
|
|||
#include "Core.h"
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
#include <mmsystem.h>
|
||||
#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*/;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <mmsystem.h>
|
||||
#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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue