From 0da9a4538e69a37c20116712fc1561246e26f649 Mon Sep 17 00:00:00 2001 From: cib Date: Sat, 18 May 2013 10:02:37 +0200 Subject: [PATCH] New debug log system. You can as admin toggle debug messages, VERY useful for devs and debugging the main server. --- code/__HELPERS/logging.dm | 11 +++++++++++ code/controllers/configuration.dm | 4 ++++ code/modules/admin/admin_verbs.dm | 14 +++++++++++++- code/setup.dm | 2 ++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/logging.dm b/code/__HELPERS/logging.dm index 2daf3690d8b..0d3112d09b8 100644 --- a/code/__HELPERS/logging.dm +++ b/code/__HELPERS/logging.dm @@ -15,6 +15,17 @@ if (config.log_admin) diary << "\[[time_stamp()]]ADMIN: [text]" + +/proc/log_debug(text) + if (config.log_debug) + diary << "\[[time_stamp()]]DEBUG: [text]" + + for(var/client/C in admins) + if(R_ADMIN & C.holder.rights) + if(C.prefs.toggles & CHAT_DEBUGLOGS) + C << "DEBUG: [text]" + + /proc/log_game(text) if (config.log_game) diary << "\[[time_stamp()]]GAME: [text]" diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index f537bbae3e6..02f8c521aa6 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -8,6 +8,7 @@ var/log_access = 0 // log login/logout var/log_say = 0 // log client say var/log_admin = 0 // log admin actions + var/log_debug = 1 // log debug output var/log_game = 0 // log game events var/log_vote = 0 // log voting var/log_whisper = 0 // log client whisper @@ -193,6 +194,9 @@ if ("log_admin") config.log_admin = 1 + if ("log_debug") + config.log_debug = text2num(value) + if ("log_game") config.log_game = 1 diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index abcb3d52b7b..51cd88e3db6 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -64,6 +64,7 @@ var/list/admin_verbs_admin = list( /client/proc/cmd_admin_change_custom_event, /client/proc/cmd_admin_rejuvenate, /client/proc/toggleattacklogs, + /client/proc/toggledebuglogs, /datum/admins/proc/show_skills, /client/proc/check_customitem_activity ) @@ -721,4 +722,15 @@ var/list/admin_verbs_mod = list( if (prefs.toggles & CHAT_ATTACKLOGS) usr << "You now will get attack log messages" else - usr << "You now won't get attack log messages" + usr << "You now won't get attack log messages" + + +/client/proc/toggledebuglogs() + set name = "Toggle Debug Log Messages" + set category = "Preferences" + + prefs.toggles ^= CHAT_DEBUGLOGS + if (prefs.toggles & CHAT_DEBUGLOGS) + usr << "You now will get debug log messages" + else + usr << "You now won't get debug log messages" \ No newline at end of file diff --git a/code/setup.dm b/code/setup.dm index 35fe8827a4f..d4f4941d430 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -620,6 +620,8 @@ var/list/TAGGERLOCATIONS = list("Disposals", #define CHAT_PRAYER 256 #define CHAT_RADIO 512 #define CHAT_ATTACKLOGS 1024 +#define CHAT_DEBUGLOGS 2048 + #define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS)