Files
core/ASCOfficeXlsFile2/source/XlsFormat/Logging/Logger.cpp
Elen.Subbotina 29c989e784 чтение xls файлов
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58816 954022d7-b5bf-4e40-9824-e11837661b57
2016-05-20 23:19:50 +03:00

48 lines
1.1 KiB
C++

#include "precompiled_xls.h"
#include "Logger.h"
Logger::Logger(const std::string& log_file)
: m_log(log_file.c_str())
{
}
Logger::~Logger()
{
}
void Logger::writeLine(const std::string& type, const std::string& str)
{
time_t now;
tm local;
time(&now);
localtime_s(&local, &now);
static wchar_t time_stamp[16];
swprintf_s(time_stamp, 15, L"%02d:%02d:%02d ", local.tm_hour, local.tm_min, local.tm_sec);
m_log << time_stamp << std::wstring(type.begin(),type.end()) << ": " << std::wstring(str.begin(),str.end()) << std::endl;
std::cout << time_stamp << type << ": " << str << std::endl;
}
void Logger::writeLine(const std::wstring& type, const std::wstring& str)
{
time_t now;
tm local;
time(&now);
localtime_s(&local, &now);
static wchar_t time_stamp[16];
swprintf_s(time_stamp, 15, L"%02d:%02d:%02d ", local.tm_hour, local.tm_min, local.tm_sec);
m_log << time_stamp << type << L": " << str << std::endl;
std::wcout << time_stamp << type << L": " << str << std::endl;
}
Logger& Logger::getLogger()
{
static Logger logger("AVSOfficeXlsFile.log");
return logger;
}