wallet/src/ILog.cpp
Cheng bba593180e
displays names in alphabetic order
sanity test of pubkey mysteriously fails in display_wallet, yet identical test with same values succeeds in unit_test
need to create a view once sanity test passes.
then need to refresh display on edit/add name
need to make a second try at integrating release v3.2.2.1
2023-09-29 08:14:29 +10:00

58 lines
3.1 KiB
C++

#include "stdafx.h"
void ILogFatalError(const char* sz) {
wxLogFatalError(_wx("%s"), _wx(sz));
} // which is like wxLogError(), but also terminates the program with the exit code 3 (using abort() standard function).Unlike for all the other logging functions, this function can't be overridden by a log target.
void ILogError(const char* sz) {
wxLogError(_wx("%s"), _wx(sz));
}
//is the function to use for error messages, i.e.the messages that must be shown to the user.The default processing is to pop up a message box to inform the user about it.
void ILogWarning(const char* sz) {
wxLogWarning(_wx("%s"), _wx(sz));
} //for warnings.They are also normally shown to the user, but don't interrupt the program work.
void ILogMessage(const char* sz) {
wxLogMessage(_wx("%s"), _wx(sz));
} // is for all normal, informational messages.*/
void ILogVerbose(const char* sz) {
wxLogVerbose(_wx("%s"), _wx(sz));
}
; // is for verbose output.Normally, it is suppressed, but might be activated if the user wishes to know more details about the program progress(another, but possibly confusing name for the same function is wxLogInfo).
void ILogDebug(const char* sz) {
wxLogDebug(_wx("%s"), _wx(sz));
} //is the right function for debug output. It only does anything at all in the
//debug mode(when the preprocessor symbol WXDEBUG is defined) and expands to
//nothing in release mode(otherwise).Note that under Windows, you must either
//run the program under debugger or use a 3rd party program such as DebugView
void queue_error_message(const char* psz) {
// Used where throwing immediately would be disastrous, as in a destructor.
auto event = new wxCommandEvent(wxEVT_MENU, myID_ERRORMESSAGE);
event->SetString(_wx(psz));
// wxQueueEvent(singletonFrame->GetMenuBar(), event);
wxQueueEvent(singletonApp, event);
}
void queue_fatal_error(const char* psz) {
// Used where throwing immediately would be disastrous, as in a destructor or when constructing the main frame
if (!errorCode)errorCode = 10;
queue_error_message(psz); // Message continues to display,
// even after App window that contains the frame has closed
singletonFrame->Close(); // Generates close event, which is handled as usual after this returns
// Main window closes after the close message is handled, but App still running, displaying the message
// put up by queue_error_message. When that message is closed, App finally terminates.
}
MyException::MyException(const char* sz, int i, const char* func__, const char* FILE__) noexcept :
// usage
// throw MyException("Expected wallet file not found", __LINE__, __func__, __FILE__);
err_number(i) {
err = std::format(R"|({}
line {}, function {}, file {})|", sz, i, func__, FILE__);
}
MyException::MyException(MyException e, int i, const char* func, const char* file) noexcept :
err(std::format(R"|({}
line {}, function {}, file {})|", e.what(), i, func, file)), err_number(e.what_num()) {}
MyException::MyException(std::exception e, int i, const char* func, const char* file) noexcept:
err(std::format(R"|({}
line {}, function {}, file {})|", e.what(), i, func, file)), err_number(i) {}