mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-03 01:07:47 +00:00
add customisable log level to config
This commit is contained in:
parent
0988b3abac
commit
91abe63598
8 changed files with 18 additions and 0 deletions
|
@ -12,6 +12,8 @@ ServerSecret = default
|
||||||
DataPath = C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
|
DataPath = C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
|
||||||
WorldID = 67
|
WorldID = 67
|
||||||
DefaultGMRank = 255
|
DefaultGMRank = 255
|
||||||
|
LogLevel = 1
|
||||||
|
LogFilter = 0
|
||||||
|
|
||||||
[Network]
|
[Network]
|
||||||
; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server
|
; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server
|
||||||
|
|
|
@ -713,6 +713,8 @@ int main( int argc, char* argv[] )
|
||||||
if( !loadSettings( argc, argv ) )
|
if( !loadSettings( argc, argv ) )
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
|
|
||||||
|
Logger::setLogLevel( m_config.global.general.logLevel );
|
||||||
|
|
||||||
server.resource[ "^/ZoneName/([0-9]+)$" ][ "GET" ] = &getZoneName;
|
server.resource[ "^/ZoneName/([0-9]+)$" ][ "GET" ] = &getZoneName;
|
||||||
server.resource[ "^/sapphire-api/lobby/createAccount" ][ "POST" ] = &createAccount;
|
server.resource[ "^/sapphire-api/lobby/createAccount" ][ "POST" ] = &createAccount;
|
||||||
server.resource[ "^/sapphire-api/lobby/login" ][ "POST" ] = &login;
|
server.resource[ "^/sapphire-api/lobby/login" ][ "POST" ] = &login;
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace Sapphire::Common::Config
|
||||||
uint16_t worldID;
|
uint16_t worldID;
|
||||||
|
|
||||||
uint8_t defaultGMRank;
|
uint8_t defaultGMRank;
|
||||||
|
uint8_t logLevel;
|
||||||
|
uint32_t logFilter;
|
||||||
} general;
|
} general;
|
||||||
|
|
||||||
struct Network
|
struct Network
|
||||||
|
|
|
@ -57,6 +57,8 @@ bool Sapphire::ConfigMgr::loadGlobalConfig( Common::Config::GlobalConfig& config
|
||||||
config.general.serverSecret = getValue< std::string >( "General", "ServerSecret", "default" );
|
config.general.serverSecret = getValue< std::string >( "General", "ServerSecret", "default" );
|
||||||
config.general.worldID = getValue< uint16_t >( "General", "WorldID", 67 );
|
config.general.worldID = getValue< uint16_t >( "General", "WorldID", 67 );
|
||||||
config.general.defaultGMRank = getValue< uint8_t >( "General", "DefaultGMRank", 255 );
|
config.general.defaultGMRank = getValue< uint8_t >( "General", "DefaultGMRank", 255 );
|
||||||
|
config.general.logLevel = getValue< uint8_t >( "General", "LogLevel", 1 );
|
||||||
|
config.general.logFilter = getValue< uint32_t >( "General", "LogFilter", 0 );
|
||||||
|
|
||||||
// network
|
// network
|
||||||
config.network.zoneHost = getValue< std::string >( "Network", "ZoneHost", "127.0.0.1" );
|
config.network.zoneHost = getValue< std::string >( "Network", "ZoneHost", "127.0.0.1" );
|
||||||
|
|
|
@ -53,6 +53,11 @@ namespace Sapphire
|
||||||
spdlog::flush_on( spdlog::level::critical );
|
spdlog::flush_on( spdlog::level::critical );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Logger::setLogLevel( uint8_t logLevel )
|
||||||
|
{
|
||||||
|
spdlog::set_level( static_cast< spdlog::level::level_enum >( logLevel ) );
|
||||||
|
}
|
||||||
|
|
||||||
void Logger::error( const std::string& text )
|
void Logger::error( const std::string& text )
|
||||||
{
|
{
|
||||||
spdlog::get( "logger" )->error( text );
|
spdlog::get( "logger" )->error( text );
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace Sapphire
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void init( const std::string& logPath );
|
static void init( const std::string& logPath );
|
||||||
|
static void setLogLevel( uint8_t logLevel );
|
||||||
|
|
||||||
// todo: this is a minor increase in build time because of fmtlib, but much less than including spdlog directly
|
// todo: this is a minor increase in build time because of fmtlib, but much less than including spdlog directly
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ namespace Sapphire
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger::setLogLevel( m_config.global.general.logLevel );
|
||||||
|
|
||||||
auto pFw = std::make_shared< Framework >();
|
auto pFw = std::make_shared< Framework >();
|
||||||
Network::HivePtr hive( new Network::Hive() );
|
Network::HivePtr hive( new Network::Hive() );
|
||||||
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive, pFw );
|
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive, pFw );
|
||||||
|
|
|
@ -129,6 +129,8 @@ void Sapphire::World::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger::setLogLevel( m_config.global.general.logLevel );
|
||||||
|
|
||||||
Logger::info( "Setting up generated EXD data" );
|
Logger::info( "Setting up generated EXD data" );
|
||||||
auto pExdData = std::make_shared< Data::ExdDataGenerated >();
|
auto pExdData = std::make_shared< Data::ExdDataGenerated >();
|
||||||
auto dataPath = m_config.global.general.dataPath;
|
auto dataPath = m_config.global.general.dataPath;
|
||||||
|
|
Loading…
Add table
Reference in a new issue