Code refactoring.
parent
813f23d655
commit
f36d94183a
|
@ -12,6 +12,7 @@ namespace Consts {
|
|||
const int STANDARD_SCREEN_HEIGHT = 1920;
|
||||
const sf::Color BACKGROUND_COLOR = sf::Color(255, 255, 255);
|
||||
const std::string PROJECT_NAME = "engine";
|
||||
const bool USE_LOG_FILE = true;
|
||||
|
||||
const double PI = 3.14159265358979323846264338327950288;
|
||||
const double EPS = 0.000001;
|
||||
|
|
|
@ -10,16 +10,19 @@
|
|||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include "../Consts.h"
|
||||
|
||||
namespace Log
|
||||
{
|
||||
void log(const std::string& message) {
|
||||
std::time_t const now_c = std::time(nullptr);
|
||||
auto dt = std::put_time(std::localtime(&now_c), "%F %T");
|
||||
if(Consts::USE_LOG_FILE) {
|
||||
std::time_t const now_c = std::time(nullptr);
|
||||
auto dt = std::put_time(std::localtime(&now_c), "%F %T");
|
||||
|
||||
std::fstream file("engine_log.txt", std::ios::out | std::ios::app);
|
||||
file << dt << "\t" << message << " (" << Time::fps() << " fps)" << std::endl;
|
||||
std::cout << dt << "\t" << message << " (" << Time::fps() << " fps)" << std::endl;
|
||||
file.close();
|
||||
std::fstream file("engine_log.txt", std::ios::out | std::ios::app);
|
||||
file << dt << "\t" << message << " (" << Time::fps() << " fps)" << std::endl;
|
||||
std::cout << dt << "\t" << message << " (" << Time::fps() << " fps)" << std::endl;
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue