summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 39e62da..de44d77 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -544,13 +544,27 @@ int get_atcommand_level(const AtCommandType type) {
/*========================================
* At-command logging
*/
+void log_atcommand(struct map_session_data *sd, const char *fmt, ...) {
+ char message[512];
+ va_list ap;
-int last_logfile_nr = 0;
-char *gm_logfile_name = NULL;
-static FILE *gm_logfile = NULL;
+ va_start(ap, fmt);
+ vsnprintf(message, 511, fmt, ap);
+ va_end(ap);
-void log_atcommand(struct map_session_data *sd, const char *fmt, ...)
-{
+ if (pc_isGM(sd))
+ gm_log("%s(%d,%d) %s : %s", map[sd->bl.m].name, sd->bl.x,
+ sd->bl.y, sd->status.name, message);
+}
+
+char *gm_logfile_name = NULL;
+/*==========================================
+ * Log a timestamped line to GM log file
+ *------------------------------------------
+ */
+void gm_log(const char *fmt, ...) {
+ static int last_logfile_nr = 0;
+ static FILE *gm_logfile = NULL;
time_t time_v;
struct tm ctime;
int month, year, logfile_nr;
@@ -588,16 +602,14 @@ void log_atcommand(struct map_session_data *sd, const char *fmt, ...)
last_logfile_nr = logfile_nr;
}
- if (gm_logfile && pc_isGM(sd)) {
- fprintf(gm_logfile, "[%04d-%02d-%02d %02d:%02d:%02d] %s(%d,%d) %s : %s\n",
- year, month, ctime.tm_mday,
- ctime.tm_hour, ctime.tm_min, ctime.tm_sec,
- map[sd->bl.m].name, sd->bl.x, sd->bl.y, sd->status.name,
- message);
- fflush(gm_logfile);
- }
+ fprintf(gm_logfile, "[%04d-%02d-%02d %02d:%02d:%02d] %s\n",
+ year, month, ctime.tm_mday, ctime.tm_hour,
+ ctime.tm_min, ctime.tm_sec, message);
+
+ fflush(gm_logfile);
}
+
/*==========================================
*is_atcommand @コマンドに存在するかどうか確認する
*------------------------------------------