Basically there is a shared library from android phone that creates log file .bin
, but inside contents are text so changing extension to .txt
makes it readable.
However size is limited to 3mb after this it starts to rotate the text, i have source code for the shared library and trying to find what line of code is responsible for rotating the text or where the size is specified.
functions from OsUtils
static CAMX_INLINE INT VSNPrintF(
CHAR* pDst,
SIZE_T sizeDst,
const CHAR* pFormat,
va_list argptr)
{
INT numCharWritten = 0;
#if defined(_LINUX)
numCharWritten = vsnprintf(pDst, sizeDst, pFormat, argptr);
#elif defined(_WIN32)
numCharWritten = vsnprintf_s(pDst, sizeDst, _TRUNCATE, pFormat, argptr);
#elif defined(ANDROID)
numCharWritten = vsnprintf(pDst, sizeDst, pFormat, argptr);
#else
CAMX_STATIC_ASSERT_MESSAGE(FALSE, "Unsupported Target");
#endif // defined(_LINUX)
return numCharWritten;
}
static CAMX_INLINE INT SNPrintF(
CHAR* pDst,
SIZE_T sizeDst,
const CHAR* pFormat,
...)
{
INT numCharWritten;
va_list args;
va_start(args, pFormat);
numCharWritten = VSNPrintF(pDst, sizeDst, pFormat, args);
va_end(args);
return numCharWritten;
}
FILE* OsUtils::FOpen(
const CHAR* pFilename,
const CHAR* pMode)
{
return fopen(pFilename, pMode);
}
VOID OsUtils::GetDateTime(
CamxDateTime* pDateTime)
{
CAMX_ASSERT(NULL != pDateTime);
struct timeval timeValue;
struct tm* pTimeInfo = NULL;
INT result = 0;
result = gettimeofday(&timeValue, NULL);
if (0 == result)
{
pTimeInfo = localtime(&timeValue.tv_sec);
if (NULL != pTimeInfo)
{
pDateTime->seconds = static_cast<UINT32>(pTimeInfo->tm_sec);
pDateTime->microseconds = static_cast<UINT32>(timeValue.tv_usec);
pDateTime->minutes = static_cast<UINT32>(pTimeInfo->tm_min);
pDateTime->hours = static_cast<UINT32>(pTimeInfo->tm_hour);
pDateTime->dayOfMonth = static_cast<UINT32>(pTimeInfo->tm_mday);
pDateTime->month = static_cast<UINT32>(pTimeInfo->tm_mon);
pDateTime->year = static_cast<UINT32>(pTimeInfo->tm_year);
pDateTime->weekday = static_cast<UINT32>(pTimeInfo->tm_wday);
pDateTime->yearday = static_cast<UINT32>(pTimeInfo->tm_yday);
pDateTime->dayLightSavingTimeFlag = static_cast<UINT32>(pTimeInfo->tm_isdst);
}
}
}
INT OsUtils::FPrintF(
FILE* pFile,
const CHAR* pFormat,
...)
{
INT result;
va_list argptr;
va_start(argptr, pFormat);
result = vfprintf(pFile, pFormat, argptr);
va_end(argptr);
return result;
}
CamxResult OsUtils::FClose(
FILE* pFile)
{
CamxResult result = CamxResultSuccess;
if (0 != fclose(pFile))
{
result = CamxResultEFailed;
}
return result;
}
I searched all code base of application globally with IDE for debugLogFilename as this is name of setting that define log file name and pDebugLogFile based on the code is also used and only following lines of code mention this variables.
//i added this line for clarity of explanation
m_pStaticSettings->debugLogFilename=Log_file
if ('' != m_pStaticSettings->debugLogFilename[0])
{
FILE* pDebugLogFile = NULL;
CHAR filename[FILENAME_MAX] = {0};
OsUtils::SNPrintF(filename, sizeof(filename),
"%s%s%s.bin",
ConfigFileDirectory, PathSeparator, m_pStaticSettings->debugLogFilename);
pDebugLogFile = OsUtils::FOpen(filename, "w");
newLogInfo.pDebugLogFile = pDebugLogFile;
}
else
{
newLogInfo.pDebugLogFile = NULL;
}
m_debugLogInfo.pDebugLogFile = pNewLogInfo->pDebugLogFile;
if (NULL != g_logInfo.pDebugLogFile)
{
OsUtils::FClose(g_logInfo.pDebugLogFile);
g_logInfo.pDebugLogFile = NULL;
}
if (NULL != g_logInfo.pDebugLogFile)
{
CamxDateTime systemDateTime;
OsUtils::GetDateTime(&systemDateTime);
OsUtils::FPrintF(g_logInfo.pDebugLogFile, "%02d-%02d %02d:%02d:%02d:%03d %sn", systemDateTime.month,
systemDateTime.dayOfMonth, systemDateTime.hours, systemDateTime.minutes, systemDateTime.seconds,
systemDateTime.microseconds / 1000, logText);
}
if (NULL != CamX::g_logInfo.pDebugLogFile)
{
CamX::OsUtils::FPrintF(CamX::g_logInfo.pDebugLogFile, "%sn", assertText);
}