summaryrefslogtreecommitdiffhomepage
path: root/windows
diff options
context:
space:
mode:
authorOdd Stranne <odd@mullvad.net>2019-08-05 13:17:45 +0200
committerOdd Stranne <odd@mullvad.net>2019-08-05 13:17:45 +0200
commitcf76d4873ff5a85ad96e087078cbc678cf36823d (patch)
tree26d5c431dcdedeaa7d5c53f6ff05f0ff8bc3b3ab /windows
parent2b5dc52e657786f2d4ecaa362da267f0408d9a64 (diff)
downloadmullvadvpn-cf76d4873ff5a85ad96e087078cbc678cf36823d.tar.xz
mullvadvpn-cf76d4873ff5a85ad96e087078cbc678cf36823d.zip
Change timestamp format in 'install.log'
Diffstat (limited to 'windows')
-rw-r--r--windows/nsis-plugins/src/log/logger.cpp28
-rw-r--r--windows/nsis-plugins/src/log/logger.h6
2 files changed, 13 insertions, 21 deletions
diff --git a/windows/nsis-plugins/src/log/logger.cpp b/windows/nsis-plugins/src/log/logger.cpp
index f22bf84bf1..8291b98032 100644
--- a/windows/nsis-plugins/src/log/logger.cpp
+++ b/windows/nsis-plugins/src/log/logger.cpp
@@ -48,22 +48,21 @@ void AnsiFileLogSink::log(const std::wstring &message)
void Logger::log(const std::wstring &message)
{
- m_logsink->log(Compose(message, Timestamp(), ordinal()));
+ m_logsink->log(Compose(message, Timestamp()));
}
void Logger::log(const std::wstring &message, const std::vector<std::wstring> &details)
{
const auto timestamp = this->Timestamp();
- const auto ordinal = this->ordinal();
- m_logsink->log(Compose(message, timestamp, ordinal));
+ m_logsink->log(Compose(message, timestamp));
//
// Write details with indentation.
//
for (const auto detail : details)
{
- m_logsink->log(Compose(detail, timestamp, ordinal, 4));
+ m_logsink->log(Compose(detail, timestamp, 4));
}
}
@@ -77,33 +76,30 @@ std::wstring Logger::Timestamp()
std::wstringstream ss;
ss << L'['
+ << std::right << std::setw(4) << std::setfill(L'0') << time.wYear
+ << L'-'
+ << std::right << std::setw(2) << std::setfill(L'0') << time.wMonth
+ << L'-'
+ << std::right << std::setw(2) << std::setfill(L'0') << time.wDay
+ << L' '
<< std::right << std::setw(2) << std::setfill(L'0') << time.wHour
<< L':'
<< std::right << std::setw(2) << std::setfill(L'0') << time.wMinute
<< L':'
<< std::right << std::setw(2) << std::setfill(L'0') << time.wSecond
+ << L'.'
+ << std::right << std::setw(3) << std::setfill(L'0') << time.wMilliseconds
<< L']';
return ss.str();
}
-std::wstring Logger::ordinal()
-{
- std::wstringstream ss;
-
- ss << std::right << std::setw(4) << std::setfill(L' ') << m_ordinal++;
-
- return ss.str();
-}
-
//static
-std::wstring Logger::Compose(const std::wstring &message, const std::wstring &timestamp,
- const std::wstring &ordinal, size_t indentation)
+std::wstring Logger::Compose(const std::wstring &message, const std::wstring &timestamp, size_t indentation)
{
std::wstringstream ss;
ss << timestamp << L' '
- << ordinal << L' '
<< std::wstring(indentation, L' ')
<< message;
diff --git a/windows/nsis-plugins/src/log/logger.h b/windows/nsis-plugins/src/log/logger.h
index 71054d0bdc..6f28e5c73a 100644
--- a/windows/nsis-plugins/src/log/logger.h
+++ b/windows/nsis-plugins/src/log/logger.h
@@ -51,12 +51,8 @@ private:
std::unique_ptr<ILogSink> m_logsink;
- size_t m_ordinal = 1;
-
static std::wstring Timestamp();
- std::wstring ordinal();
-
static std::wstring Compose(const std::wstring &message, const std::wstring &timestamp,
- const std::wstring &ordinal, size_t indentation = 0);
+ size_t indentation = 0);
};