Patch level : 12.0 nopatch

Files correlati     :
Commento        :

Aggiunto stack trace in caso di eccezione nel file stack.log
This commit is contained in:
Alessandro Bonazzi 2021-10-18 00:21:24 +02:00
parent b7a4218972
commit 41ee048a56
2 changed files with 19 additions and 9 deletions

View File

@ -587,13 +587,6 @@ void TApplication::run(
}
__set_trace();
const struct tm * timeloc = xvt_time_now();
TRACE("");
TRACE("----------");
TRACE("%s %s - %s %02d:%02d:%02d", argv[0], argv[1], today.string(), timeloc->tm_hour, timeloc->tm_min, timeloc->tm_sec);
TRACE("----------");
set_xvt_hooks();
_running = TRUE;

View File

@ -1,9 +1,12 @@
#include <checks.h>
#include <applicat.h>
#include <config.h>
#include <diction.h>
#include <dongle.h>
#include <keys.h>
#include <strings.h>
#include <utility.h>
#include <xvtility.h>
#ifdef WIN32
#define buildmsg() char msg[1024];va_list argptr;va_start(argptr,fmt);_vsnprintf_s(msg,sizeof(msg),_TRUNCATE,fmt,argptr);va_end(argptr);msg[1023] = '\0';
@ -342,6 +345,7 @@ void __set_trace()
{
__traceon = ini_get_bool(CONFIG_STUDIO, "Main", "TRACE");
}
// @doc EXTERNAL
// @msg __trace | Permette di mandare dei messaggi nel file trace.log
bool __trace(
@ -358,14 +362,27 @@ bool __trace(
if (__traceon)
{
if (f == nullptr)
fopen_s(&f, "trace.log", "a");
{
fopen_s(&f, "trace.log", fexist("trace.log") ? "a+tc" : "wtc");
if (f != nullptr)
{
const struct tm * timeloc = xvt_time_now();
beep();
beep();
fprintf(f, "\n");
fprintf(f, "----------\n");
fprintf(f, "%s %s - %s %02d:%02d:%02d\n", main_app().argv()[0], main_app().argv()[1], today.string(), timeloc->tm_hour, timeloc->tm_min, timeloc->tm_sec);
fprintf(f, "----------\n");
}
}
if (f != nullptr)
{
buildmsg();
fprintf(f, "%s\n", msg);
fflush(f);
}
return f != NULL;
return f != nullptr;
}
return true;
}