Mercurial > mercurial > hgweb_mover2.cgi
comparison src/main.cpp @ 35:405e08552527 v2.4 v2.6
auto-detect on/off
author | pyon@macmini |
---|---|
date | Thu, 17 Nov 2011 21:03:30 +0900 |
parents | c540dc3eabe5 |
children |
comparison
equal
deleted
inserted
replaced
34:51e522f34598 | 35:405e08552527 |
---|---|
1 // Filename : main.cpp | 1 // Filename : main.cpp |
2 // Last Change: 26-Oct-2011. | 2 // Last Change: 16-Nov-2011. |
3 // | 3 // |
4 | 4 |
5 #include "common.h" | 5 #include "common.h" |
6 #include "main.h" | 6 #include "main.h" |
7 #include "myframe.h" | 7 #include "myframe.h" |
88 } | 88 } |
89 | 89 |
90 void MyApp::InitLog() | 90 void MyApp::InitLog() |
91 { | 91 { |
92 wxDateTime now = wxDateTime::Now(); | 92 wxDateTime now = wxDateTime::Now(); |
93 log_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("log"); | |
94 | |
95 if ( wxFileExists( log_file ) ) { | |
96 wxString log_bak = log_file + wxT(".bak"); | |
97 wxRenameFile( log_file, log_bak, true ); | |
98 } | |
99 | |
93 wxTextFile logfile; | 100 wxTextFile logfile; |
94 logfile.Open(wxT("log")); | 101 logfile.Create( log_file ); |
95 logfile.Clear(); | |
96 logfile.AddLine( now.Format(wxT("%Y-%m-%d %H:%M:%S ")) + wxT("[Application start...]") ); | 102 logfile.AddLine( now.Format(wxT("%Y-%m-%d %H:%M:%S ")) + wxT("[Application start...]") ); |
97 logfile.Write(); | 103 logfile.Write(); |
98 logfile.Close(); | 104 logfile.Close(); |
99 } | 105 } |
106 | |
100 void MyApp::WriteLog( wxString msg ) | 107 void MyApp::WriteLog( wxString msg ) |
101 { | 108 { |
102 wxDateTime now = wxDateTime::Now(); | 109 wxDateTime now = wxDateTime::Now(); |
103 wxTextFile logfile; | 110 wxTextFile logfile; |
104 logfile.Open(wxT("log")); | 111 logfile.Open( log_file ); |
105 logfile.AddLine( now.Format(wxT("%Y-%m-%d %H:%M:%S ")) + msg ); | 112 logfile.AddLine( now.Format(wxT("%Y-%m-%d %H:%M:%S ")) + msg ); |
106 logfile.Write(); | 113 logfile.Write(); |
107 logfile.Close(); | 114 logfile.Close(); |
108 } | 115 } |
109 | 116 |