mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-02-10 18:05:16 +08:00
[win] online-installer: fix logging
This commit is contained in:
@ -827,6 +827,7 @@ CDownloader* MainWindow::startDownload(const std::wstring &install_type, const s
|
||||
{
|
||||
wstring appcast_url = NS_Utils::cmdArgContains(_T("--appcast-dev-channel")) ? _T(URL_INSTALL_DEV) : _T(URL_INSTALL);
|
||||
wstring tmp_path = NS_File::toNativeSeparators(NS_File::generateTmpFileName(L".json"));
|
||||
NS_Logger::WriteLog(_T("\nAppcast URL:\n") + appcast_url);
|
||||
CDownloader *dnl = new CDownloader();
|
||||
dnl->onComplete([=](ulong error) {
|
||||
if (error == ERROR_SUCCESS) {
|
||||
@ -846,10 +847,10 @@ CDownloader* MainWindow::startDownload(const std::wstring &install_type, const s
|
||||
JsonObject package_type = win.value(install_type).toObject();
|
||||
tstring url = package_type.value(_T("url")).toTString();
|
||||
tstring url2 = package_type.value(_T("url2")).toTString();
|
||||
NS_Logger::WriteLog(_T("Primary package URL: ") + url + _T("\nSecondary package URL: ") + url2);
|
||||
NS_Logger::WriteLog(_T("\nPrimary package URL:\n") + url + _T("\nSecondary package URL:\n") + url2);
|
||||
if ((url.empty() || !dnl->isUrlAccessible(url)) && !url2.empty())
|
||||
url = url2;
|
||||
|
||||
NS_Logger::WriteLog(_T("\nDownload from URL:\n") + url);
|
||||
// tstring hash = package_type.value(_T("md5")).toTString();
|
||||
// std::transform(hash.begin(), hash.end(), hash.begin(), ::tolower);
|
||||
NS_File::removeFile(tmp_path);
|
||||
|
||||
@ -28,7 +28,7 @@ bool isValidLocaleCharacter(wchar_t c)
|
||||
wstring getPrimaryLang(const wstring &lang, bool withScript = false)
|
||||
{
|
||||
if (lang.empty()) {
|
||||
NS_Logger::WriteLog(_T("An error occurred: ") + wstring(_T(__FUNCTION__)));
|
||||
NS_Logger::WriteLog(_T("An error occurred:\n") + wstring(_T(__FUNCTION__)));
|
||||
return L"en";
|
||||
}
|
||||
std::wistringstream iss(lang);
|
||||
@ -40,7 +40,7 @@ wstring getPrimaryLang(const wstring &lang, bool withScript = false)
|
||||
std::getline(iss, script, L'_');
|
||||
return (script.length() == 4) ? primlang + L"_" + script : primlang;
|
||||
}
|
||||
NS_Logger::WriteLog(_T("An error occurred: ") + wstring(_T(__FUNCTION__)));
|
||||
NS_Logger::WriteLog(_T("An error occurred:\n") + wstring(_T(__FUNCTION__)));
|
||||
return L"en";
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ Translator::Translator(unsigned long langId, int resourceId)
|
||||
} else
|
||||
NS_Logger::WriteLog(ADVANCED_ERROR_MESSAGE);
|
||||
|
||||
NS_Logger::WriteLog(_T("Current locale: ") + langName);
|
||||
NS_Logger::WriteLog(_T("\nCurrent locale:\n") + langName);
|
||||
|
||||
HMODULE hInst = GetModuleHandle(NULL);
|
||||
if (HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(resourceId), RT_RCDATA)) {
|
||||
@ -86,7 +86,7 @@ Translator::Translator(unsigned long langId, int resourceId)
|
||||
if (!translations.empty()) {
|
||||
parseTranslations();
|
||||
if (!is_translations_valid)
|
||||
NS_Logger::WriteLog(_T("Cannot parse translations, error in string: ") + error_substr + L" <---");
|
||||
NS_Logger::WriteLog(_T("Cannot parse translations, error in string:\n") + error_substr + L" <---");
|
||||
} else
|
||||
NS_Logger::WriteLog(_T("Error: translations is empty."));
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ namespace NS_File
|
||||
{
|
||||
std::wifstream file(filePath.c_str(), std::ios_base::in);
|
||||
if (!file.is_open()) {
|
||||
NS_Logger::WriteLog(L"An error occurred while opening: " + filePath);
|
||||
NS_Logger::WriteLog(L"An error occurred while opening:\n" + filePath);
|
||||
return false;
|
||||
}
|
||||
wstring line;
|
||||
|
||||
@ -43,7 +43,7 @@ using std::to_wstring;
|
||||
using std::list;
|
||||
|
||||
#define ERROR_LAUNCH 0x20000000
|
||||
#define DEFAULT_ERROR_MESSAGE _T("An error occurred: ") + \
|
||||
#define DEFAULT_ERROR_MESSAGE _T("An error occurred:\n") + \
|
||||
wstring(_T(__FUNCTION__)) + _T(" Line: ") + to_wstring(__LINE__)
|
||||
#define ADVANCED_ERROR_MESSAGE DEFAULT_ERROR_MESSAGE + \
|
||||
_T(" ") + NS_Utils::GetLastErrorAsString()
|
||||
|
||||
Reference in New Issue
Block a user