summaryrefslogtreecommitdiff
path: root/src/account-server/main-account.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-05-29 20:06:31 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-05-29 20:16:11 +0200
commit0c56831afead73852958a818d154957930ddbecd (patch)
treec7bb58cc4cce68f9abbff37aa9cdbd2453b714ec /src/account-server/main-account.cpp
parent5bbdd448ac02f1860d4714224fb5a2fe5e897687 (diff)
downloadmanaserv-0c56831afead73852958a818d154957930ddbecd.tar.gz
manaserv-0c56831afead73852958a818d154957930ddbecd.tar.bz2
manaserv-0c56831afead73852958a818d154957930ddbecd.tar.xz
manaserv-0c56831afead73852958a818d154957930ddbecd.zip
Made the logLevel be taken from configuration for both servers.
The new parameters in the manaserv.xml file can be used to do so: log_accountServerLogLevel log_gameServerLogLevel Also, updated the sample manaserv.xml accordingly. Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/account-server/main-account.cpp')
-rw-r--r--src/account-server/main-account.cpp65
1 files changed, 38 insertions, 27 deletions
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp
index 39c111aa..e43f1a65 100644
--- a/src/account-server/main-account.cpp
+++ b/src/account-server/main-account.cpp
@@ -75,6 +75,36 @@ static void closeGracefully(int)
running = false;
}
+static void initConfig()
+{
+ /*
+ * If the path values aren't defined, we set the default
+ * depending on the platform.
+ */
+ // The config path
+#if defined CONFIG_FILE
+ std::string configPath = CONFIG_FILE;
+#else
+
+#if (defined __USE_UNIX98 || defined __FreeBSD__)
+ std::string configPath = getenv("HOME");
+ configPath += "/.";
+ configPath += DEFAULT_CONFIG_FILE;
+#else // Win32, ...
+ std::string configPath = DEFAULT_CONFIG_FILE;
+#endif
+
+#endif // defined CONFIG_FILE
+ Configuration::initialize(configPath);
+ LOG_INFO("Using config file: " << configPath);
+ // check inter-server password
+ if (Configuration::getValue("net_password", "") == "")
+ {
+ LOG_WARN("SECURITY WARNING: No 'net_password' set in " << configPath <<
+ " - set one ASAP or this server WILL get h4x0rd!!");
+ }
+}
+
/**
* Initializes the server.
*/
@@ -97,21 +127,6 @@ static void initialize()
* If the path values aren't defined, we set the default
* depending on the platform.
*/
- // The config path
-#if defined CONFIG_FILE
- std::string configPath = CONFIG_FILE;
-#else
-
-#if (defined __USE_UNIX98 || defined __FreeBSD__)
- std::string configPath = getenv("HOME");
- configPath += "/.";
- configPath += DEFAULT_CONFIG_FILE;
-#else // Win32, ...
- std::string configPath = DEFAULT_CONFIG_FILE;
-#endif
-
-#endif // defined CONFIG_FILE
-
// The log path
#if defined LOG_FILE
std::string logPath = LOG_FILE;
@@ -137,19 +152,10 @@ static void initialize()
// write the messages to both the screen and the log file.
Logger::setTeeMode(true);
- Configuration::initialize(configPath);
- LOG_INFO("Using config file: " << configPath);
LOG_INFO("Using log file: " << logPath);
ResourceManager::initialize();
- // check inter-server password
- if (Configuration::getValue("net_password", "") == "")
- {
- LOG_WARN("SECURITY WARNING: No net_password set in " << configPath <<
- " - set one ASAP or this server WILL get h4x0rd!!");
- }
-
// Open database
try {
storage = new Storage;
@@ -261,9 +267,8 @@ static void printHelp()
struct CommandLineOptions
{
CommandLineOptions():
- verbosity(Logger::Info),
- port(Configuration::getValue("net_accountServerPort",
- DEFAULT_SERVER_PORT))
+ verbosity(Logger::Warn),
+ port(DEFAULT_SERVER_PORT)
{}
Logger::Level verbosity;
@@ -318,9 +323,15 @@ int main(int argc, char *argv[])
#ifdef PACKAGE_VERSION
LOG_INFO("The Mana Account+Chat Server v" << PACKAGE_VERSION);
#endif
+ initConfig();
// Parse command line options
CommandLineOptions options;
+ options.verbosity = static_cast<Logger::Level>(
+ Configuration::getValue("log_accountServerLogLevel",
+ options.verbosity) );
+ options.port = Configuration::getValue("net_accountServerPort",
+ options.port);
parseOptions(argc, argv, options);
Logger::setVerbosity(options.verbosity);