Skip to content

Commit

Permalink
Build error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adi-g15 committed Feb 22, 2021
1 parent e0083de commit dd3e134
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 67 deletions.
32 changes: 1 addition & 31 deletions includes/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,13 @@
#include "db/database.hpp"

namespace LOGGER{
inline std::atomic_flag lock = ATOMIC_FLAG_INIT;
inline std::mutex m = std::mutex();

inline void init() {
db::init();

spdlog::info("Starting spdlog");
auto async_file = spdlog::basic_logger_mt<spdlog::async_factory>("async_file_logger", "logs/async_log.txt");
const char* msg = "Hi there";
spdlog::info(msg);

lock.clear();
}

inline void _log_msg(const char* msg_format) {
std::clog << msg_format << std::endl;

//m.unlock();
lock.clear();
//lock.clear(std::memory_order_release);
}

template<typename FirstType, typename ...Args>
inline void _log_msg(const char* msg_format, FirstType arg, Args ...args) {
//while (lock.test_and_set()) // acquire lock
// ; // spin

for (; *msg_format != '\0'; msg_format++) {
if (*msg_format == '{' && *(msg_format + 1) == '}') {
std::clog << arg;
_log_msg(msg_format + 2, std::forward<Args>(args)...); // recursive call
return;
}
std::clog << *msg_format;
}

lock.clear();
}

template<typename FirstType, typename ...Args>
Expand All @@ -54,7 +24,7 @@ namespace LOGGER{
}

inline void log_msg(const char* msg_format) {
return _log_msg(msg_format);
spdlog::info(msg_format);
}

template<typename ...Args>
Expand Down
12 changes: 8 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@

int main(int argc, char *argv[])
{
LOGGER::init(); // for logging to console
nanogui::init(); // for display
try{
LOGGER::init(); // for logging to console
nanogui::init(); // for display

Verse verse;
verse.big_bang();
Verse verse;
verse.big_bang();
} catch(...) { // catch all handler
return EXIT_FAILURE;
}

return 0;
}
2 changes: 1 addition & 1 deletion src/Entities/planet.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Entities\planet.hpp"
#include "Entities/planet.hpp"

std::optional<Entity_Point> Planet::getPrimaryPos() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/Entities/solar_system.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "..\..\includes\Entities\solar_system.hpp"
#include "Entities/solar_system.hpp"

void Solar_System::simulateExistence()
{
Expand Down
20 changes: 0 additions & 20 deletions tests/CMakeLists.old.txt

This file was deleted.

10 changes: 0 additions & 10 deletions tests/db.hpp

This file was deleted.

0 comments on commit dd3e134

Please sign in to comment.