/TGame/TUtil/Log/LogTargetFile.cpp
http://awoe.googlecode.com/ · C++ · 38 lines · 32 code · 6 blank · 0 comment · 2 complexity · dc31102f84342eac3949ae1e93be9f42 MD5 · raw file
- #include "stdafx.h"
- #include "LogTargetFile.h"
- #include <fstream>
-
- namespace woe
- {
- LogTargetFile::LogTargetFile(const string& file)
- :log_file_name_(file)
- {
-
- }
-
- LogTargetFile::~LogTargetFile()
- {
-
- }
-
- bool LogTargetFile::initialize()
- {
- log_file_stream_.open(log_file_name_.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (log_file_stream_.good())
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- void LogTargetFile::doLog(const string& msg, const string& ll, const TimeStamp& ts)
- {
- if (log_file_stream_.good())
- {
- log_file_stream_<<ts.getSeconds()<<ts.getMilliSeconds()<<" -"<<ll <<"> "<<msg;
- }
- }
- }