mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-23 07:16:15 +00:00
Replace report functionality
This commit is contained in:
parent
f7055db542
commit
14c10db490
5 changed files with 50 additions and 43 deletions
|
@ -21,28 +21,38 @@
|
||||||
|
|
||||||
namespace NLMISC {
|
namespace NLMISC {
|
||||||
|
|
||||||
enum TReportResult { ReportDebug, ReportIgnore, ReportQuit, ReportError };
|
#if FINAL_VERSION
|
||||||
|
#define NL_REPORT_SYNCHRONOUS false
|
||||||
|
#define NL_REPORT_DEFAULT NLMISC::ReportAbort
|
||||||
|
#else
|
||||||
|
#define NL_REPORT_SYNCHRONOUS true
|
||||||
|
#define NL_REPORT_DEFAULT NLMISC::ReportBreak
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Display a custom message box.
|
enum TReportResult
|
||||||
|
{
|
||||||
|
// See also crash_report_widget.h EReturnValue
|
||||||
|
ReportAlwaysIgnore = 21,
|
||||||
|
ReportIgnore = 22,
|
||||||
|
ReportAbort = 23,
|
||||||
|
ReportBreak = 24
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Display a crash report
|
||||||
*
|
*
|
||||||
* \param title set the title of the report. If empty, it'll display "NeL Crash Report" or the default title set by setReportWindowTitle.
|
* \param title set the title of the report. If empty, it'll display "NeL report"
|
||||||
* \param header message displayed before the edit text box. If empty, it displays the default message.
|
* \param subject extended title of the report
|
||||||
* \param body message displayed in the edit text box. This string will be sent by email.
|
* \param body message displayed in the edit text box. This string will be sent to the crash report tool
|
||||||
* \param debugButton 0 for disabling it, 1 for enable with default behaviors (generate a breakpoint), 2 for enable with no behavior
|
* \param attachment binary file to attach. This is a filename
|
||||||
|
* \param synchronous use system() and wait for the crash tool exit code, passes -dev flag; otherwise return defaultResult immediately
|
||||||
|
* \param sendReport hide 'dont send' button, or auto enable 'send report' checkbox
|
||||||
*
|
*
|
||||||
*
|
* \return the button clicked or defaultResult
|
||||||
*
|
|
||||||
* \return the button clicked or error
|
|
||||||
*/
|
*/
|
||||||
TReportResult report(const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const std::string &attachedFile = "");
|
TReportResult report(const std::string &title, const std::string &subject, const std::string &body, const std::string &attachment, bool synchronous, bool sendReport, TReportResult defaultResult);
|
||||||
|
|
||||||
/// Set the Url of the web service used to post crash reports to
|
/// Set the Url of the web service used to post crash reports to. String is copied
|
||||||
void setReportPostUrl(const std::string &postUrl);
|
void setReportPostUrl(const char *postUrl);
|
||||||
|
|
||||||
/// DEPRECATED
|
|
||||||
/** call this in the main of your appli to enable email: setReportEmailFunction (sendEmail);
|
|
||||||
*/
|
|
||||||
void setReportEmailFunction(void *emailFunction);
|
|
||||||
|
|
||||||
} // NLMISC
|
} // NLMISC
|
||||||
|
|
||||||
|
|
|
@ -553,8 +553,8 @@ public:
|
||||||
{
|
{
|
||||||
// yoyo: allow only to send the crash report once. Because users usually click ignore,
|
// yoyo: allow only to send the crash report once. Because users usually click ignore,
|
||||||
// which create noise into list of bugs (once a player crash, it will surely continues to do it).
|
// which create noise into list of bugs (once a player crash, it will surely continues to do it).
|
||||||
bool i = false;
|
report(progname + shortExc, subject, _Reason, NL_CRASH_DUMP_FILE, true, !isCrashAlreadyReported(), ReportAbort);
|
||||||
report (progname+shortExc, "", subject, _Reason, true, 1, true, 1, !isCrashAlreadyReported(), i, NL_CRASH_DUMP_FILE);
|
// TODO: Does this need to be synchronous? Why does this not handle the report result?
|
||||||
|
|
||||||
// no more sent mail for crash
|
// no more sent mail for crash
|
||||||
setCrashAlreadyReported(true);
|
setCrashAlreadyReported(true);
|
||||||
|
|
|
@ -689,36 +689,32 @@ void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *m
|
||||||
// which create noise into list of bugs (once a player crash, it will surely continues to do it).
|
// which create noise into list of bugs (once a player crash, it will surely continues to do it).
|
||||||
std::string filename = getLogDirectory() + NL_CRASH_DUMP_FILE;
|
std::string filename = getLogDirectory() + NL_CRASH_DUMP_FILE;
|
||||||
|
|
||||||
if (ReportDebug == report (args.ProcessName + " NeL " + toString(logTypeToString(args.LogType, true)), "", subject, body, true, 2, true, 1, !isCrashAlreadyReported(), IgnoreNextTime, filename.c_str()))
|
TReportResult reportResult = report(args.ProcessName + " NeL " + toString(logTypeToString(args.LogType, true)),
|
||||||
|
subject, body, filename, NL_REPORT_SYNCHRONOUS, !isCrashAlreadyReported(), NL_REPORT_DEFAULT);
|
||||||
|
|
||||||
|
switch (reportResult)
|
||||||
{
|
{
|
||||||
|
case ReportAlwaysIgnore:
|
||||||
|
IgnoreNextTime = true;
|
||||||
|
break;
|
||||||
|
case ReportBreak:
|
||||||
INelContext::getInstance().setDebugNeedAssert(true);
|
INelContext::getInstance().setDebugNeedAssert(true);
|
||||||
|
break;
|
||||||
|
case ReportAbort:
|
||||||
|
# ifdef NL_OS_WINDOWS
|
||||||
|
# ifndef NL_COMP_MINGW
|
||||||
|
// disable the Windows popup telling that the application aborted and disable the dr watson report.
|
||||||
|
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no more sent mail for crash
|
// no more sent mail for crash
|
||||||
setCrashAlreadyReported(true);
|
setCrashAlreadyReported(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* // Check the envvar NEL_IGNORE_ASSERT
|
|
||||||
if (getenv ("NEL_IGNORE_ASSERT") == NULL)
|
|
||||||
{
|
|
||||||
// Ask the user to continue, debug or ignore
|
|
||||||
int result = MessageBox (NULL, ss2.str().c_str (), logTypeToString(args.LogType, true), MB_ABORTRETRYIGNORE | MB_ICONSTOP);
|
|
||||||
if (result == IDABORT)
|
|
||||||
{
|
|
||||||
// Exit the program now
|
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
else if (result == IDRETRY)
|
|
||||||
{
|
|
||||||
// Give the debugger a try
|
|
||||||
DebugNeedAssert = true;
|
|
||||||
}
|
|
||||||
else if (result == IDIGNORE)
|
|
||||||
{
|
|
||||||
// Continue, do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/ }
|
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "stdmisc.h"
|
#include "stdmisc.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "nel/misc/common.h"
|
#include "nel/misc/common.h"
|
||||||
|
|
|
@ -606,7 +606,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
|
||||||
|
|
||||||
ListeningPort = servicePort;
|
ListeningPort = servicePort;
|
||||||
|
|
||||||
setReportEmailFunction ((void*)sendEmail);
|
// setReportEmailFunction ((void*)sendEmail);
|
||||||
// setDefaultEmailParams ("gw.nevrax.com", "", "cado@nevrax.com");
|
// setDefaultEmailParams ("gw.nevrax.com", "", "cado@nevrax.com");
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue