diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index e5f45121244..ac17df57738 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -139,7 +139,9 @@ /* Log to both DD and the logfile. */ /proc/log_world(text) +#ifdef USE_CUSTOM_ERROR_HANDLER WRITE_LOG(GLOB.world_runtime_log, text) +#endif SEND_TEXT(world.log, text) /* Log to the logfile only. */ diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 67bbe24e38c..3ec2510cc78 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -3,6 +3,11 @@ //#define DATUMVAR_DEBUGGING_MODE //Enables the ability to cache datum vars and retrieve later for debugging which vars changed. +// Comment this out if you are debugging problems that might be obscured by custom error handling in world/Error +#ifdef DEBUG +#define USE_CUSTOM_ERROR_HANDLER +#endif + #ifdef TESTING #define DATUMVAR_DEBUGGING_MODE diff --git a/code/game/world.dm b/code/game/world.dm index a15782a20a7..0c7d256579a 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -5,6 +5,7 @@ GLOBAL_VAR(restart_counter) //This happens after the Master subsystem new(s) (it's a global datum) //So subsystems globals exist, but are not initialised /world/New() + log_world("World loaded at [time_stamp()]!") SetupExternalRSC() @@ -25,6 +26,10 @@ GLOBAL_VAR(restart_counter) SSdbcore.SetRoundID() SetupLogs() +#ifndef USE_CUSTOM_ERROR_HANDLER + world.log = file("[GLOB.log_directory]/dd.log") +#endif + load_admins() LoadVerbs(/datum/verbs/menu) if(CONFIG_GET(flag/usewhitelist)) diff --git a/code/modules/error_handler/error_handler.dm b/code/modules/error_handler/error_handler.dm index 280cf87f6e9..1c26a09c30e 100644 --- a/code/modules/error_handler/error_handler.dm +++ b/code/modules/error_handler/error_handler.dm @@ -1,8 +1,7 @@ GLOBAL_VAR_INIT(total_runtimes, GLOB.total_runtimes || 0) GLOBAL_VAR_INIT(total_runtimes_skipped, 0) -#ifdef DEBUG - +#ifdef USE_CUSTOM_ERROR_HANDLER #define ERROR_USEFUL_LEN 2 /world/Error(exception/E, datum/e_src) @@ -128,5 +127,4 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0) // This writes the regular format (unwrapping newlines and inserting timestamps as needed). log_runtime("runtime error: [E.name]\n[E.desc]") - -#endif \ No newline at end of file +#endif diff --git a/code/modules/error_handler/error_viewer.dm b/code/modules/error_handler/error_viewer.dm index 1f93bba9a0f..adcbb8fb57f 100644 --- a/code/modules/error_handler/error_viewer.dm +++ b/code/modules/error_handler/error_viewer.dm @@ -7,7 +7,7 @@ // logged errors. Only one instance of this datum should ever exist, and it's // right here: -#ifdef DEBUG +#ifdef USE_CUSTOM_ERROR_HANDLER GLOBAL_DATUM_INIT(error_cache, /datum/error_viewer/error_cache, new) #else // If debugging is disabled, there's nothing useful to log, so don't bother. @@ -192,4 +192,4 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache) browse_to(user, html) /datum/error_viewer/error_entry/make_link(linktext, datum/error_viewer/back_to, linear) - return is_skip_count ? name : ..() \ No newline at end of file + return is_skip_count ? name : ..()