extern "C" jint Java_com_acsoftware_android_domophone_LibLP_nSetLogsOn(JNIEnv* env, jobject thiz, int on) { if (on!=0) { linphone_core_enable_logs_with_cb(linphone_android_ortp_log_handler); } else { linphone_core_disable_logs(); } return 1; }
void CorePlugin::enableLog() { #ifdef DEBUG #ifdef WIN32 WCHAR szPath[MAX_PATH]; WCHAR szFileName[MAX_PATH]; WCHAR* szAppName = TEXT(FBSTRING_PluginFileName); DWORD dwBufferSize = MAX_PATH; SYSTEMTIME stLocalTime; GetLocalTime(&stLocalTime); GetTempPath(dwBufferSize, szPath); //ExpandEnvironmentStrings(L"%SYSTEMDRIVE%", szPath, MAX_PATH); //StringCchCat(szPath, MAX_PATH, L"\\TEMP\\"); StringCchPrintf(szFileName, MAX_PATH, L"%s\\%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.log", szPath, szAppName, stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay, stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond, GetCurrentProcessId(), GetCurrentThreadId()); s_log_file = _wfopen(szFileName, L"w+"); #endif //WIN32 #endif //DEBUG linphone_core_enable_logs_with_cb(CorePlugin::log); }