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

Merge pull request #411 from NotAdam/boost_scrap

remove config file, json dep, cleanup logger
This commit is contained in:
Mordred 2018-10-26 11:08:39 +02:00 committed by GitHub
commit 6ce541e351
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19447 additions and 70 deletions

View file

@ -1,58 +0,0 @@
[Database]
Host = 127.0.0.1
Port = 3306
Database = sapphire
Username = root
Password =
SyncThreads = 2
AsyncThreads = 2
[GlobalParameters]
ServerSecret = default
DataPath = /mnt/c/Program Files (x86)/Steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack
[GlobalNetwork]
; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server
ZoneHost = 127.0.0.1
ZonePort = 54992
LobbyHost = 127.0.0.1
LobbyPort = 54994
RestHost = 127.0.0.1
RestPort = 80
[Lobby]
WorldID = 67
AllowNoSessionConnect = false
WorldName = Sapphire
[LobbyNetwork]
ListenIp = 0.0.0.0
ListenPort = 54994
[CharacterCreation]
DefaultGMRank = 255
[RestNetwork]
ListenIp = 0.0.0.0
ListenPort = 80
[Scripts]
; where compiled script modules are located
Path = ./compiledscripts/
; relative to Path, where we copy and load modules from
CachePath = ./cache/
; whether we should detect changes to script modules and reload them
HotSwap = true
[Network]
DisconnectTimeout = 20
[ZoneNetwork]
ListenIp = 0.0.0.0
ListenPort = 54992
[General]
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/zone.ini

19430
deps/nlohmann/json.hpp vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
#include "Logger.h"
#include <spdlog/spdlog.h>
#include <spdlog/async.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/daily_file_sink.h>
@ -26,20 +27,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,7 @@
#ifndef _LOGGER_H
#define _LOGGER_H
#define _LOGGER_H
#include <spdlog/spdlog.h>
#include <string>
namespace Core {
@ -21,8 +21,6 @@ class Logger
private:
std::string m_logFile;
std::shared_ptr< spdlog::logger > m_logger;
public:
Logger();

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;