PageRenderTime 31ms CodeModel.GetById 18ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/TGame/TUtil/Log/LogTargetFile.cpp

http://awoe.googlecode.com/
C++ | 38 lines | 32 code | 6 blank | 0 comment | 2 complexity | dc31102f84342eac3949ae1e93be9f42 MD5 | raw file
 1#include "stdafx.h"
 2#include "LogTargetFile.h"
 3#include <fstream>
 4
 5namespace woe
 6{
 7	LogTargetFile::LogTargetFile(const string& file)
 8		:log_file_name_(file)
 9	{
10
11	}
12
13	LogTargetFile::~LogTargetFile()
14	{
15
16	}
17
18	bool LogTargetFile::initialize()
19	{
20		log_file_stream_.open(log_file_name_.c_str(), std::ios_base::out | std::ios_base::trunc);
21		if (log_file_stream_.good())
22		{
23			return true;
24		}
25		else
26		{
27			return false;
28		}
29	}
30
31	void LogTargetFile::doLog(const string& msg, const string& ll,  const TimeStamp& ts)
32	{
33		if (log_file_stream_.good())
34		{
35			log_file_stream_<<ts.getSeconds()<<ts.getMilliSeconds()<<" -"<<ll <<"> "<<msg;
36		}
37	}
38}