2 ==============================================================================
4 This file is part of the S.F.Tracker
5 Copyright 2005-7 by Satoshi Fujiwara.
7 S.F.Tracker can be redistributed and/or modified under the terms of the
8 GNU General Public License, as published by the Free Software Foundation;
9 either version 2 of the License, or (at your option) any later version.
11 S.F.Tracker is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with S.F.Tracker; if not, visit www.gnu.org/licenses or write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 Boston, MA 02111-1307 USA
21 ==============================================================================
24 * @author S.F. (Satoshi Fujiwara)
29 #define _CRTDBG_MAP_ALLOC
31 #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
37 impl() : m_log_file("sftracker.log",std::ios_base::out | std::ios_base::trunc ){};
38 ~impl() {m_log_file.close();}
40 void write(const boost::wformat & fmt)
45 void write(const std::wistream & st)
48 //mutex_type::scoped_lock lock_(m_mutex);
49 m_log_file << st << std::endl;
51 boost::gregorian::date dt = boost::gregorian::day_clock::local_day();
55 void write(const std::wstring & mes)
60 void write(const TCHAR * mes)
62 //mutex_type::scoped_lock lock_(m_mutex);
63 m_log_file << mes << std::endl;
67 std::wofstream m_log_file;
71 logger::logger() : m_impl(new logger::impl())
74 void logger::write(const boost::wformat & fmt)
79 void logger::write(const std::wstring & mes)
84 void logger::write(const TCHAR * mes)
89 void logger::write(const std::wistream & st)
99 void debug_out(const char * file_name,const int line,boost::wformat& fmt)
101 OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % fmt).str().c_str());
104 void debug_out(const char * file_name,const int line,const std::wstring& str)
106 OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % str).str().c_str());
109 void debug_out(const char * file_name,const int line,const char* str)
111 OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % sf::code_converter<char,wchar_t>(str)).str().c_str());
114 void debug_outW(const char * file_name,const int line,const wchar_t* str)
116 OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % str).str().c_str());