Output logging changed to use standard C++ stream now
This commit is contained in:
parent
bdf071f5d7
commit
7410c6e611
@ -26,7 +26,7 @@
|
|||||||
class wxUpdCheckInitializer : public wxInitializer
|
class wxUpdCheckInitializer : public wxInitializer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
FILE *m_pLogFile;
|
std::ofstream m_log;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxConfig m_config;
|
wxConfig m_config;
|
||||||
@ -35,12 +35,10 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
wxUpdCheckInitializer();
|
wxUpdCheckInitializer();
|
||||||
virtual ~wxUpdCheckInitializer();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
wxUpdCheckInitializer::wxUpdCheckInitializer() :
|
wxUpdCheckInitializer::wxUpdCheckInitializer() :
|
||||||
m_pLogFile(NULL),
|
|
||||||
m_config(wxT(UPDATER_CFG_APPLICATION) wxT("\\Updater"), wxT(UPDATER_CFG_VENDOR)),
|
m_config(wxT(UPDATER_CFG_APPLICATION) wxT("\\Updater"), wxT(UPDATER_CFG_VENDOR)),
|
||||||
wxInitializer()
|
wxInitializer()
|
||||||
{
|
{
|
||||||
@ -57,19 +55,9 @@ wxUpdCheckInitializer::wxUpdCheckInitializer() :
|
|||||||
if (!wxDirExists(m_path))
|
if (!wxDirExists(m_path))
|
||||||
wxMkdir(m_path);
|
wxMkdir(m_path);
|
||||||
|
|
||||||
m_pLogFile = fopen(m_path + wxT(UPDATER_LOG_FILE), "w+");
|
m_log.open((LPCTSTR)(m_path + wxT("Updater-") wxT(UPDATER_CFG_APPLICATION) wxT(".log")), std::ios_base::out | std::ios_base::trunc);
|
||||||
if (m_pLogFile)
|
if (m_log.is_open())
|
||||||
delete wxLog::SetActiveTarget(new wxLogStderr(m_pLogFile));
|
delete wxLog::SetActiveTarget(new wxLogStream(&m_log));
|
||||||
} else
|
|
||||||
m_pLogFile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxUpdCheckInitializer::~wxUpdCheckInitializer()
|
|
||||||
{
|
|
||||||
if (m_pLogFile != NULL) {
|
|
||||||
delete wxLog::SetActiveTarget(NULL);
|
|
||||||
fclose(m_pLogFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,3 +39,4 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user