mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-02-10 18:05:16 +08:00
[win-linux] updatesvc: log formatting and version output
This commit is contained in:
@ -45,6 +45,7 @@
|
||||
#define DECL_VERSION __attribute__((section(".version_info"), unused))
|
||||
|
||||
volatile static const char DECL_VERSION version[] = VER_STRING;
|
||||
static const char gSvcVersion[] = "Service version: " VER_STRING;
|
||||
|
||||
void strToNum(const char *str, int &num)
|
||||
{
|
||||
@ -59,8 +60,10 @@ int main(int argc, char *argv[])
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "--run-as-app") == 0) {
|
||||
NS_Utils::parseCmdArgs(argc, argv);
|
||||
if (NS_Utils::cmdArgContains("--log"))
|
||||
if (NS_Utils::cmdArgContains("--log")) {
|
||||
NS_Logger::AllowWriteLog();
|
||||
NS_Logger::WriteLog(gSvcVersion);
|
||||
}
|
||||
std::locale::global(std::locale(""));
|
||||
Translator lang(NS_Utils::GetAppLanguage(), "/langs/langs.iss");
|
||||
CSocket socket(0, INSTANCE_SVC_PORT);
|
||||
|
||||
@ -613,7 +613,7 @@ namespace NS_Logger
|
||||
if (!file.is_open()) {
|
||||
return;
|
||||
}
|
||||
file << log << std::endl;
|
||||
file << log << string("\n") << std::endl;
|
||||
file.close();
|
||||
}
|
||||
if (showMessage)
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
SERVICE_STATUS gSvcStatus;
|
||||
SERVICE_STATUS_HANDLE gSvcStatusHandle;
|
||||
HANDLE gSvcStopEvent = NULL;
|
||||
static const WCHAR gSvcVersion[] = _T("Service version: " VER_STRING);
|
||||
|
||||
|
||||
VOID WINAPI SvcMain(DWORD argc, LPTSTR *argv);
|
||||
@ -99,8 +100,10 @@ int __cdecl _tmain (int argc, TCHAR *argv[])
|
||||
if (lstrcmpi(argv[1], _T("--run-as-app")) == 0) {
|
||||
NS_Utils::setRunAsApp();
|
||||
NS_Utils::parseCmdArgs(argc, argv);
|
||||
if (NS_Utils::cmdArgContains(_T("--log")))
|
||||
if (NS_Utils::cmdArgContains(_T("--log"))) {
|
||||
NS_Logger::AllowWriteLog();
|
||||
NS_Logger::WriteLog(gSvcVersion);
|
||||
}
|
||||
std::locale::global(std::locale(""));
|
||||
Translator lang(NS_Utils::GetAppLanguage().c_str(), IDT_TRANSLATIONS);
|
||||
CSocket socket(0, INSTANCE_SVC_PORT);
|
||||
@ -162,8 +165,10 @@ int __cdecl _tmain (int argc, TCHAR *argv[])
|
||||
VOID WINAPI SvcMain(DWORD argc, LPTSTR *argv)
|
||||
{
|
||||
NS_Utils::parseCmdArgs(argc, argv);
|
||||
if (NS_Utils::cmdArgContains(_T("--log")))
|
||||
if (NS_Utils::cmdArgContains(_T("--log"))) {
|
||||
NS_Logger::AllowWriteLog();
|
||||
NS_Logger::WriteLog(gSvcVersion);
|
||||
}
|
||||
|
||||
gSvcStatusHandle = RegisterServiceCtrlHandler(SERVICE_NAME, SvcCtrlHandler);
|
||||
if (gSvcStatusHandle == NULL) {
|
||||
|
||||
@ -723,7 +723,7 @@ namespace NS_Logger
|
||||
if (!file.is_open()) {
|
||||
return;
|
||||
}
|
||||
file << log << std::endl;
|
||||
file << log << wstring(L"\n") << std::endl;
|
||||
file.close();
|
||||
}
|
||||
if (showMessage)
|
||||
|
||||
Reference in New Issue
Block a user