Add directx practice
This commit is contained in:
parent
30e30c8a7b
commit
92a35a5bc9
4 changed files with 140 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
|||
#include "FileLogger.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
FileLogger::~FileLogger()
|
||||
{
|
||||
|
@ -20,6 +22,10 @@ void FileLogger::SetFileName(const std::string& fileName)
|
|||
|
||||
void FileLogger::Open()
|
||||
{
|
||||
if (mWorkDirectory.empty())
|
||||
{
|
||||
mWorkDirectory = std::filesystem::current_path().string();
|
||||
}
|
||||
mFileStream.open(mWorkDirectory + "/" + mFileName);
|
||||
}
|
||||
|
||||
|
@ -30,6 +36,10 @@ void FileLogger::Close()
|
|||
|
||||
void FileLogger::LogLine(const std::ostringstream& line)
|
||||
{
|
||||
if (!mFileStream.is_open())
|
||||
{
|
||||
Open();
|
||||
}
|
||||
mFileStream << line.str() << std::endl;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue