Notifications
Clear all

Text logging to a file

batFix
(@batfix)
Reputable Member

Very useful feature for us:

- make available text logging to a file with all modes when you start any process and values what did you set and what NBLA reading from the DUT, what we see on a screen;

- the logging should be triggered by check dedicated checkbox somewhere , perhaps at Device Control tab.

 

It's professional feature, it would be good manifold :

- it will show all actions and a sequence of those what a customer did for the DUT

- it will keep track of parameters

- it could allow recreate graphs from the log files without catching and posting pictures here, when something changed unexpectedly or shows [not]periodically  once in a long interval

- etc.

Lets Make NLBA Great ! Together.

Quote
Topic starter Posted : 11/06/2021 6:06 pm
Nicusor
(@azzido)
Member Admin

Such a logging system requires a good time to develop. It will end up with a higher device price and I cannot do it soon.

NLBA Laptop Battery Analyzer with Chip Reset & Repair Option

ReplyQuote
Posted : 11/06/2021 7:51 pm
batFix
(@batfix)
Reputable Member

As I proposed before, I've time and skills to help develop such feature.

Lets Make NLBA Great ! Together.

ReplyQuote
Topic starter Posted : 11/06/2021 8:22 pm
batFix
(@batfix)
Reputable Member

Some snippets from my other program:

char[MAX_PATH] LogName ;

// get txt log filename from Program.INI file

BOOL Log = GetPrivateProfileInt ( "Options", "Log", FALSE , txtLogName );


if(Log )
{
// build fname & open .LOG file
char TimeDateStr[128];
_tzset();
struct tm newtime;
__time32_t aclock;
_time32( &aclock ); // Get time in seconds.
_localtime32_s( &newtime, &aclock ); // Convert time to struct tm form.
sprintf_s(TimeDateStr,sizeof(TimeDateStr),"%04u%02u%02u_%02u%02u%02u",
1900+newtime.tm_year, 1+newtime.tm_mon, newtime.tm_mday,
newtime.tm_hour, newtime.tm_min, newtime.tm_sec
);
sprintf_s (LogFname, "%s_%s.log", ReportDir, TimeDateStr );

if( errno_t rc = fopen_s(&fhLog, LogFname,"wt"))
{
perror("LOG");
getchar();
return rc;
}
else
{
printf("LOG file: <%s>\n", LogFname);
//#ifdef _DEBUG

//struct stat buf;
//fstat(fileno(fhLog), &buf);
//printf ("File size %u\n", buf.st_size);
//#endif

fprintf(fhLog,
"...<header>...,%s\n", serialNumber);
}

}

Lets Make NLBA Great ! Together.

ReplyQuote
Topic starter Posted : 29/09/2021 11:26 am
batFix
(@batfix)
Reputable Member
// printout to the log

void printingToLog(char[] txt)

{

char TimeDateStr[128];
_tzset();
struct tm newtime;
__time32_t aclock;
_time32( &aclock ); // Get time in seconds.
_localtime32_s( &newtime, &aclock ); // Convert time to struct tm form.
sprintf_s(TimeDateStr,sizeof(TimeDateStr),"%0u:%02u, %02u/%02u/%04u",
newtime.tm_hour, newtime.tm_min,
newtime.tm_mday, 1+newtime.tm_mon, 1900+newtime.tm_year);





if(fhLog)
{
fprintf(fhLog,"%s: %s\n", TimeDateStr, txt);

}

...

printingToLog("Selected \"Battery Info\" Tab\n"),

....

printingToLog("Pressed \"Start Reading\" button \n"),

...

printingToLog("Voltage: 3010mV \n"),

printingToLog("Current: 3000mA \n"),

// etc

..

.

Lets Make NLBA Great ! Together.

ReplyQuote
Topic starter Posted : 29/09/2021 11:39 am
Share: