int gfuiMenuGetAlignment(const char* pszHAlign) //, const char* pszVAlign) { std::string strAlign(pszHAlign); if (strlen(pszHAlign) == 0) strAlign += "left"; // Default horizontal alignment // if (pszVAlign) // { // strAlign += '.'; // strAlign += pszVAlign; // if (!pszVAlign || strlen(pszVAlign) == 0) // strAlign += "bottom"; // Default bottom alignment // const TMapAlign::const_iterator itAlign = MapAlign.find(strAlign); // if (itAlign != MapAlign.end()) // return (*itAlign).second; // else // return GFUI_ALIGN_HL_VB; // Default alignment. // } // else { const TMapHorizAlign::const_iterator itHorizAlign = MapHorizAlign.find(strAlign); if (itHorizAlign != MapHorizAlign.end()) return (*itHorizAlign).second; else return GFUI_ALIGN_HL; // Default horizontal alignement = left. } }
void IROM SysLog(SysLogLevel level, const char* file, const char* function, const char * format, ...) { char *p; buffer[0] = 0; va_list args; va_start(args, format); if (GetMutex(&logMutex) == 0) { for (p = "$$$:"; *p != 0; p++) uart0WriteWait(*p); for (p = file; *p != 0; p++) uart0WriteWait(*p); for (p = "$$$"; *p != 0; p++) uart0WriteWait(*p); for (p = function; *p != 0; p++) uart0WriteWait(*p); // uart0WriteBytes(":",1); // uart0WriteBytes(function,strlen(function)); // os_printf_plus(" Syslog called by %s ",function); conflicts += 1000; va_end(args); return; } uint32_t time = SysMillis(); ets_vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); char dst[40]; dst[0] = '\0'; strAlign(dst, 18, file, strlen(file)); strAlign(&dst[18], 18, function, strlen(function)); // if (level > LOG_INFO) { // put log in mqtt buffer // ets_sprintf(lastLog, "%s:%s:%s", SysLogLevelStr[level], dst, buffer); // } ets_snprintf(lastLog, sizeof(lastLog), "%10u | %s | %s\n", time, dst, buffer); uart0WriteBytes(lastLog, strlen(lastLog)); // os_delay_us(1000); ets_delay_us(10000); // os_printf_plus(); ReleaseMutex(&logMutex); }