diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-06-07 21:10:18 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-06-07 21:10:18 +0200 |
commit | 6d7bff2476459049f4f554291a680e0f6003ea66 (patch) | |
tree | 4202e9f1cd843197648fec93b48a5bc88407dc2e /mmc_updater/src/Log.cpp | |
parent | 977e11ef8d6780b173ad5ca6d13e29e721d0c6a0 (diff) | |
download | MultiMC-6d7bff2476459049f4f554291a680e0f6003ea66.tar MultiMC-6d7bff2476459049f4f554291a680e0f6003ea66.tar.gz MultiMC-6d7bff2476459049f4f554291a680e0f6003ea66.tar.lz MultiMC-6d7bff2476459049f4f554291a680e0f6003ea66.tar.xz MultiMC-6d7bff2476459049f4f554291a680e0f6003ea66.zip |
GH-1060 remove updater code
Diffstat (limited to 'mmc_updater/src/Log.cpp')
-rw-r--r-- | mmc_updater/src/Log.cpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/mmc_updater/src/Log.cpp b/mmc_updater/src/Log.cpp deleted file mode 100644 index d4e5a214..00000000 --- a/mmc_updater/src/Log.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "Log.h" - -#include "Platform.h" -#include "StringUtils.h" -#include "ProcessUtils.h" - -#include <string.h> -#include <iostream> - -Log m_globalLog; - -Log* Log::instance() -{ - return &m_globalLog; -} - -Log::Log() -{ -} - -Log::~Log() -{ -} - -void Log::open(const std::string& path) -{ - m_mutex.lock(); - m_output.open(path.c_str(),std::ios_base::out | std::ios_base::app); - m_mutex.unlock(); -} - -void Log::writeToStream(std::ostream& stream, Type type, const char* text) -{ - // Multiple processes may be writing to the same log file during - // an update. No attempt is made to synchronize access to the file. - // - // Under Unix, appends to a single file on a local FS by multiple writers should be atomic - // provided that the length of 'text' is less than PIPE_BUF - // - switch (type) - { - case Info: - stream << "INFO "; - break; - case Warn: - stream << "WARN "; - break; - case Error: - stream << "ERROR "; - break; - } - stream << '(' << intToStr(ProcessUtils::currentProcessId()) << ") " << text << std::endl; -} - -void Log::write(Type type, const char* text) -{ - m_mutex.lock(); - writeToStream(std::cerr,type,text); - if (m_output.is_open()) - { - writeToStream(m_output,type,text); - } - m_mutex.unlock(); -} - |