1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 22:37:45 +00:00

fix build errors, add new json dep

This commit is contained in:
NotAdam 2018-10-26 19:57:39 +11:00
parent 53bab1f780
commit 3e62c7653b
4 changed files with 19446 additions and 10 deletions

19430
deps/nlohmann/json.hpp vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,5 @@
#include "Logger.h"
#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/daily_file_sink.h>
@ -26,20 +25,22 @@ void Logger::setLogPath( const std::string& logPath )
void Logger::init()
{
spdlog::init_thread_pool( 8192, 1 );
std::vector< spdlog::sink_ptr > sinks;
auto stdout_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >();
auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( m_logFile + ".log", 0, 0 );
sinks.push_back( std::make_shared< spdlog::sinks::stdout_color_sink_mt >() );
sinks.push_back( std::make_shared< spdlog::sinks::daily_file_sink_mt >( m_logFile + ".log", 0, 0 ) );
std::vector<spdlog::sink_ptr> sinks { stdout_sink, daily_sink };
auto logger = std::make_shared< spdlog::async_logger >( "logger", sinks.begin(), sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block );
spdlog::register_logger( logger );
spdlog::set_pattern( "[%H:%M:%S.%e] [%^%l%$] %v" );
m_logger = std::make_shared< spdlog::logger >( "logger", std::begin( sinks ), std::end( sinks ) );
spdlog::register_logger(m_logger);
// always flush the log on criticial messages, otherwise it's done by libc
// see: https://github.com/gabime/spdlog/wiki/7.-Flush-policy
// nb: if the server crashes, log data can be missing from the file unless something logs critical just before it does
m_logger->flush_on( spdlog::level::critical );
spdlog::set_pattern( "[%H:%M:%S] [%l] %v" );
spdlog::flush_on( spdlog::level::critical );
}

View file

@ -1,7 +1,8 @@
#ifndef _LOGGER_H
#define _LOGGER_H
#define _LOGGER_H
#include <spdlog/spdlog.h>
#include <spdlog/async.h>
namespace Core {

View file

@ -11,6 +11,8 @@
#include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp>
#include <nlohmann/json.hpp>
#include <Database/DatabaseDef.h>
Core::Network::SapphireAPI::SapphireAPI()
@ -122,6 +124,8 @@ Core::Network::SapphireAPI::createCharacter( const int& accountId, const std::st
boost::property_tree::ptree pt;
auto json = nlohmann::json::parse( infoJson );
std::stringstream ss;
ss << infoJson;