diff options
author | jenkins4kodi <jenkins4kodi@users.noreply.github.com> | 2019-02-09 23:19:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-09 23:19:28 +0100 |
commit | dc013552b0710b60146bf5693938dbb22bbff3dd (patch) | |
tree | 808ab2e3318ee3ba85b297c0a06680eaa9921f22 | |
parent | fee377153bae32c850a2291717b9e52e7eeac0b5 (diff) | |
parent | 0505f451a1f36730a2b1cc9ed6310c0ff0dba4e9 (diff) |
Merge pull request #15457 from JimmyS83/master
-rw-r--r-- | xbmc/platform/posix/utils/PosixInterfaceForCLog.cpp | 7 | ||||
-rw-r--r-- | xbmc/platform/posix/utils/PosixInterfaceForCLog.h | 2 | ||||
-rw-r--r-- | xbmc/platform/win32/utils/Win32InterfaceForCLog.cpp | 5 | ||||
-rw-r--r-- | xbmc/platform/win32/utils/Win32InterfaceForCLog.h | 2 | ||||
-rw-r--r-- | xbmc/utils/log.cpp | 9 |
5 files changed, 17 insertions, 8 deletions
diff --git a/xbmc/platform/posix/utils/PosixInterfaceForCLog.cpp b/xbmc/platform/posix/utils/PosixInterfaceForCLog.cpp index 8510dadd79..ce4c5aa5b5 100644 --- a/xbmc/platform/posix/utils/PosixInterfaceForCLog.cpp +++ b/xbmc/platform/posix/utils/PosixInterfaceForCLog.cpp @@ -83,13 +83,16 @@ void CPosixInterfaceForCLog::PrintDebugString(const std::string &debugString) #endif // _DEBUG } -void CPosixInterfaceForCLog::GetCurrentLocalTime(int &hour, int &minute, int &second, double &milliseconds) +void CPosixInterfaceForCLog::GetCurrentLocalTime(int& year, int& month, int& day, int &hour, int& minute, int& second, double& milliseconds) { struct tm localTime; struct timeval tv; if (gettimeofday(&tv, nullptr) != -1 && localtime_r(&tv.tv_sec, &localTime) != NULL) { + year = localTime.tm_year + 1900; + month = localTime.tm_mon + 1; + day = localTime.tm_mday; hour = localTime.tm_hour; minute = localTime.tm_min; second = localTime.tm_sec; @@ -97,7 +100,7 @@ void CPosixInterfaceForCLog::GetCurrentLocalTime(int &hour, int &minute, int &se } else { - hour = minute = second = 0; + year = month = day = hour = minute = second = 0; milliseconds = 0.0; } } diff --git a/xbmc/platform/posix/utils/PosixInterfaceForCLog.h b/xbmc/platform/posix/utils/PosixInterfaceForCLog.h index 128b59b002..4e0f6c6646 100644 --- a/xbmc/platform/posix/utils/PosixInterfaceForCLog.h +++ b/xbmc/platform/posix/utils/PosixInterfaceForCLog.h @@ -21,7 +21,7 @@ public: void CloseLogFile(void); bool WriteStringToLog(const std::string& logString); void PrintDebugString(const std::string& debugString); - static void GetCurrentLocalTime(int& hour, int& minute, int& second, double& millisecond); + static void GetCurrentLocalTime(int& year, int& month, int& day, int& hour, int& minute, int& second, double& millisecond); private: FILEWRAP* m_file; }; diff --git a/xbmc/platform/win32/utils/Win32InterfaceForCLog.cpp b/xbmc/platform/win32/utils/Win32InterfaceForCLog.cpp index 9c0bb79199..3f49c32402 100644 --- a/xbmc/platform/win32/utils/Win32InterfaceForCLog.cpp +++ b/xbmc/platform/win32/utils/Win32InterfaceForCLog.cpp @@ -105,10 +105,13 @@ void CWin32InterfaceForCLog::PrintDebugString(const std::string& debugString) #endif // _DEBUG } -void CWin32InterfaceForCLog::GetCurrentLocalTime(int& hour, int& minute, int& second, double& millisecond) +void CWin32InterfaceForCLog::GetCurrentLocalTime(int& year, int& month, int& day, int& hour, int& minute, int& second, double& millisecond) { SYSTEMTIME time; GetLocalTime(&time); + year = time.wYear; + month = time.wMonth; + day = time.wDay; hour = time.wHour; minute = time.wMinute; second = time.wSecond; diff --git a/xbmc/platform/win32/utils/Win32InterfaceForCLog.h b/xbmc/platform/win32/utils/Win32InterfaceForCLog.h index b8ec4edf5e..6baf61a316 100644 --- a/xbmc/platform/win32/utils/Win32InterfaceForCLog.h +++ b/xbmc/platform/win32/utils/Win32InterfaceForCLog.h @@ -21,7 +21,7 @@ public: void CloseLogFile(void); bool WriteStringToLog(const std::string& logString); void PrintDebugString(const std::string& debugString); - static void GetCurrentLocalTime(int& hour, int& minute, int& second, double& millisecond); + static void GetCurrentLocalTime(int& year, int& month, int& day, int& hour, int& minute, int& second, double& millisecond); private: HANDLE m_hFile; }; diff --git a/xbmc/utils/log.cpp b/xbmc/utils/log.cpp index 72b326a5e3..d163727bdd 100644 --- a/xbmc/utils/log.cpp +++ b/xbmc/utils/log.cpp @@ -188,17 +188,20 @@ void CLog::PrintDebugString(const std::string& line) bool CLog::WriteLogString(int logLevel, const std::string& logString) { - static const char* prefixFormat = "%02d:%02d:%02d.%03d T:%" PRIu64" %7s: "; + static const char* prefixFormat = "%02d-%02d-%02d %02d:%02d:%02d.%03d T:%" PRIu64" %7s: "; std::string strData(logString); /* fixup newline alignment, number of spaces should equal prefix length */ StringUtils::Replace(strData, "\n", "\n "); - int hour, minute, second; + int year, month, day, hour, minute, second; double millisecond; - g_logState.m_platform.GetCurrentLocalTime(hour, minute, second, millisecond); + g_logState.m_platform.GetCurrentLocalTime(year, month, day, hour, minute, second, millisecond); strData = StringUtils::Format(prefixFormat, + year, + month, + day, hour, minute, second, |