diff --git a/uppsrc/Core/Diag.h b/uppsrc/Core/Diag.h index 120038374..3181e6a66 100644 --- a/uppsrc/Core/Diag.h +++ b/uppsrc/Core/Diag.h @@ -167,13 +167,13 @@ struct DebugLogBlock // USRLOG -struct IniBool; namespace Ini { -extern IniBool user_log; +struct Bool; +extern Bool user_log; }; -#define USRLOG(x) LOG_(Config::user_log, x) +#define USRLOG(x) LOG_(Ini::user_log, x) // Crash support diff --git a/uppsrc/Core/Log.cpp b/uppsrc/Core/Log.cpp index e9d49bc11..f82860ba4 100644 --- a/uppsrc/Core/Log.cpp +++ b/uppsrc/Core/Log.cpp @@ -447,111 +447,8 @@ void SetVppLogName(const String& file) { ReopenLog(); } -namespace Config { -INI_BOOL(user_log, false, "Activates logging of user actions"); +namespace Ini { + INI_BOOL(user_log, false, "Activates logging of user actions"); }; -Stream& BugLog() -{ - return VppLog(); -/* - if(snobuglog) - return NilStream(); - static LogStream *s; - if(!s) { - INTERLOCKED - if(!s) { - static byte lb[sizeof(LogStream)]; - s = new(lb) LogStream; - char h[200]; - sTime(h, ".buglog"); - s->Create(h, false); - } - } - return *s; -*/ -} - -bool susrlog; -bool susrlogpersistent; - -void ActivateUsrLog() -{ - VppLog(); - susrlog = true; -} - -void ActivatePersistentUsrLog() -{ - ActivateUsrLog(); - susrlogpersistent = true; -} - -Stream& UsrLog() -{ - return susrlog ? (Stream&)VppLog() : NilStream(); -} - -Stream& UsrLog(const char *line) -{ - if(!susrlog) - return NilStream(); - return UsrLog() << line << "\r\n"; -} - -Stream& UsrLogT(int indent, const char *line) -{ - if(!susrlog) - return NilStream(); - Time tm = GetSysTime(); - char h[256]; - sprintf(h, "%02d:%02d:%02d ", tm.hour, tm.minute, tm.second); - Stream& s = VppLog() << h; - while(indent--) - s << " "; - s << line << "\r\n"; - return s; -} - -Stream& UsrLogT(const char *line) -{ - return UsrLogT(0, line); -} - -bool IsUsrLog() -{ - return susrlog; -} - -void DeleteUsrLog() -{ - if(susrlogpersistent) { - if(susrlog) - VppLog() << "log is persistent"; - } - else { -// if(susrlog && !StdLogStream().Delete()) -// LOG("Unable to delete UsrLog, " << GetLastErrorMessage()); - susrlog = false; - } -} -/* -void sTime(char *h, const char *ext) -{ - Time t = GetSysTime(); - char th[200]; - sprintf(th, ".%d-%02d-%02d-%02d-%02d-%02d", t.year, t.month, t.day, t.hour, t.minute, t.second); - strcat(th, ext); - sLogFile(h, th); -} -*/ -bool snobuglog; - -void DeactivateBugLog() -{ - snobuglog = true; -} - - - END_UPP_NAMESPACE diff --git a/uppsrc/CtrlCore/CtrlKbd.cpp b/uppsrc/CtrlCore/CtrlKbd.cpp index 8a03a3d43..88ab16c9c 100644 --- a/uppsrc/CtrlCore/CtrlKbd.cpp +++ b/uppsrc/CtrlCore/CtrlKbd.cpp @@ -69,7 +69,7 @@ bool Ctrl::DispatchKey(dword keycode, int count) if(!focusCtrl) return false; Ptr p = focusCtrl; - if(Config::user_log) { + if(Ini::user_log) { String kl; dword k = keycode; const char *l = ""; @@ -94,7 +94,7 @@ bool Ctrl::DispatchKey(dword keycode, int count) { LLOG("Ctrl::DispatchKey(" << FormatIntHex(keycode) << ", " << GetKeyDesc(keycode) << "): eaten in " << Desc(p)); - if(Config::user_log) + if(Ini::user_log) USRLOG(" -> " << Desc(p)); eventCtrl = focusCtrl; return true; @@ -123,7 +123,7 @@ bool Ctrl::HotKey(dword key) { if(ctrl->IsOpen() && ctrl->IsVisible() && ctrl->IsEnabled() && ctrl->HotKey(key)) { - if(Config::user_log && s_hotkey) { + if(Ini::user_log && s_hotkey) { USRLOG(" HOT-> " << UPP::Name(ctrl)); s_hotkey = false; } diff --git a/uppsrc/CtrlCore/CtrlMouse.cpp b/uppsrc/CtrlCore/CtrlMouse.cpp index 0324af0b6..a8d859e20 100644 --- a/uppsrc/CtrlCore/CtrlMouse.cpp +++ b/uppsrc/CtrlCore/CtrlMouse.cpp @@ -30,7 +30,7 @@ dword GetMouseFlags() { void Ctrl::LogMouseEvent(const char *f, const Ctrl *ctrl, int event, Point p, int zdelta, dword keyflags) { - if(!Config::user_log) + if(!Ini::user_log) return; String txt = f; txt += (event & BUTTON) == RIGHT ? "RIGHT" : (event & BUTTON) == MIDDLE ? "MIDDLE" : "LEFT";