diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-08 17:24:24 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-08 17:24:24 +0000 |
commit | e40f63571168bfa85567a9accbf53f12d8239af1 (patch) | |
tree | 50d2c29f3f66451dccc3b257a812ca82d7b3e3d6 | |
parent | 9429d119e2ce99e16687b1b785352cf5ad0d8ade (diff) | |
download | hercules-e40f63571168bfa85567a9accbf53f12d8239af1.tar.gz hercules-e40f63571168bfa85567a9accbf53f12d8239af1.tar.bz2 hercules-e40f63571168bfa85567a9accbf53f12d8239af1.tar.xz hercules-e40f63571168bfa85567a9accbf53f12d8239af1.zip |
* Added option to turn off login server logging
* Moved char server starting logging to after we've read the configuration file first
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@513 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog.txt | 3 | ||||
-rw-r--r-- | conf-tmpl/login_athena.conf | 3 | ||||
-rw-r--r-- | src/char/char.c | 9 | ||||
-rw-r--r-- | src/login/login.c | 40 |
4 files changed, 34 insertions, 21 deletions
diff --git a/Changelog.txt b/Changelog.txt index 81f5bf21c..30e853e28 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,8 @@ Date Added 12/8 + * Added option to turn off login server logging [celest] + * Moved char server starting logging to after we've read the configuration + file first [celest] * Fixed crash with supernovices with 100% base exp [celest] * Updated the readme a little. [Mass Zero] diff --git a/conf-tmpl/login_athena.conf b/conf-tmpl/login_athena.conf index 547cc66df..d58ed3bf9 100644 --- a/conf-tmpl/login_athena.conf +++ b/conf-tmpl/login_athena.conf @@ -55,6 +55,9 @@ gm_account_filename_check_timer: 15 // Log Filename. All operations received by the server are logged in this file. login_log_filename: log/login.log +// To log the login server? +log_login: 1 + // Name of the file of that logs the unknown packets (for debug or hack check) login_log_unknown_packets_filename: log/login_unknown_packets.log diff --git a/src/char/char.c b/src/char/char.c index 2dc2242d9..2d5c5ba7d 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -3348,13 +3348,14 @@ void do_final(void) { int do_init(int argc, char **argv) { int i; - // a newline in the log... - char_log(""); - char_log("The char-server starting..." RETCODE); - char_config_read((argc < 2) ? CHAR_CONF_NAME : argv[1]); lan_config_read((argc > 1) ? argv[1] : LOGIN_LAN_CONF_NAME); + // a newline in the log... + char_log(""); + // moved behind char_config_read in case we changed the filename [celest] + char_log("The char-server starting..." RETCODE); + if ((naddr_ != 0) && (login_ip_set_ == 0 || char_ip_set_ == 0)) { // The char server should know what IP address it is running on // - MouseJstr diff --git a/src/login/login.c b/src/login/login.c index 08f91768b..5f8bde598 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -69,6 +69,8 @@ int save_unknown_packets = 0; long creation_time_GM_account_file; int gm_account_filename_check_timer = 15; // Timer to check if GM_account file has been changed and reload GM account automaticaly (in seconds; default: 15) +int log_login = 1; + int display_parse_login = 0; // 0: no, 1: yes int display_parse_admin = 0; // 0: no, 1: yes int display_parse_fromchar = 0; // 0: no, 1: yes (without packet 0x2714), 2: all packets @@ -169,26 +171,28 @@ int console = 0; // Writing function of logs file //------------------------------ int login_log(char *fmt, ...) { - va_list ap; - struct timeval tv; - char tmpstr[2048]; + if (log_login) { + va_list ap; + struct timeval tv; + char tmpstr[2048]; - if(!log_fp) - log_fp = fopen(login_log_filename, "a"); + if(!log_fp) + log_fp = fopen(login_log_filename, "a"); - log_fp = fopen(login_log_filename, "a"); - if (log_fp) { - if (fmt[0] == '\0') // jump a line if no message - fprintf(log_fp, RETCODE); - else { - va_start(ap, fmt); - gettimeofday(&tv, NULL); - strftime(tmpstr, 24, date_format, localtime(&(tv.tv_sec))); - sprintf(tmpstr + strlen(tmpstr), ".%03d: %s", (int)tv.tv_usec / 1000, fmt); - vfprintf(log_fp, tmpstr, ap); - va_end(ap); + log_fp = fopen(login_log_filename, "a"); + if (log_fp) { + if (fmt[0] == '\0') // jump a line if no message + fprintf(log_fp, RETCODE); + else { + va_start(ap, fmt); + gettimeofday(&tv, NULL); + strftime(tmpstr, 24, date_format, localtime(&(tv.tv_sec))); + sprintf(tmpstr + strlen(tmpstr), ".%03d: %s", (int)tv.tv_usec / 1000, fmt); + vfprintf(log_fp, tmpstr, ap); + va_end(ap); + } + fflush(log_fp); // under cygwin or windows, if software is stopped, data are not written in the file -> fflush at every line } - fflush(log_fp); // under cygwin or windows, if software is stopped, data are not written in the file -> fflush at every line } return 0; @@ -3416,6 +3420,8 @@ int login_config_read(const char *cfgName) { memset(login_log_filename, 0, sizeof(login_log_filename)); strncpy(login_log_filename, w2, sizeof(login_log_filename)); login_log_filename[sizeof(login_log_filename)-1] = '\0'; + } else if (strcmpi(w1, "log_login") == 0) { + log_login = atoi(w2); } else if (strcmpi(w1, "login_log_unknown_packets_filename") == 0) { memset(login_log_unknown_packets_filename, 0, sizeof(login_log_unknown_packets_filename)); strncpy(login_log_unknown_packets_filename, w2, sizeof(login_log_unknown_packets_filename)); |