mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-15 20:37:37 +00:00
Merge pull request #13324 from Putnam3145/extools-logging
Added threaded extools logging as an alternative to rust_g logging.
This commit is contained in:
Binary file not shown.
1
code/__DEFINES/_extools.dm
Normal file
1
code/__DEFINES/_extools.dm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#define EXTOOLS (world.system_type == MS_WINDOWS ? "byond-extools.dll" : "libbyond-extools.so")
|
||||||
@@ -281,8 +281,6 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
|
|||||||
#define CALCULATE_ADJACENT_TURFS(T) SSadjacent_air.queue[T] = 1
|
#define CALCULATE_ADJACENT_TURFS(T) SSadjacent_air.queue[T] = 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EXTOOLS (world.system_type == MS_WINDOWS ? "byond-extools.dll" : "libbyond-extools.so")
|
|
||||||
|
|
||||||
GLOBAL_VAR(atmos_extools_initialized) // this must be an uninitialized (null) one or init_monstermos will be called twice because reasons
|
GLOBAL_VAR(atmos_extools_initialized) // this must be an uninitialized (null) one or init_monstermos will be called twice because reasons
|
||||||
#define ATMOS_EXTOOLS_CHECK if(!GLOB.atmos_extools_initialized){\
|
#define ATMOS_EXTOOLS_CHECK if(!GLOB.atmos_extools_initialized){\
|
||||||
GLOB.atmos_extools_initialized=TRUE;\
|
GLOB.atmos_extools_initialized=TRUE;\
|
||||||
|
|||||||
5
code/__HELPERS/_extools_api.dm
Normal file
5
code/__HELPERS/_extools_api.dm
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#define EXTOOLS_LOGGING // rust_g is used as a fallback if this is undefined
|
||||||
|
|
||||||
|
/proc/extools_log_write()
|
||||||
|
|
||||||
|
/proc/extools_finalize_logging()
|
||||||
@@ -4,10 +4,15 @@
|
|||||||
#define SEND_SOUND(target, sound) DIRECT_OUTPUT(target, sound)
|
#define SEND_SOUND(target, sound) DIRECT_OUTPUT(target, sound)
|
||||||
#define SEND_TEXT(target, text) DIRECT_OUTPUT(target, text)
|
#define SEND_TEXT(target, text) DIRECT_OUTPUT(target, text)
|
||||||
#define WRITE_FILE(file, text) DIRECT_OUTPUT(file, text)
|
#define WRITE_FILE(file, text) DIRECT_OUTPUT(file, text)
|
||||||
|
#ifdef EXTOOLS_LOGGING
|
||||||
|
// proc hooked, so we can just put in standard TRUE and FALSE
|
||||||
|
#define WRITE_LOG(log, text) extools_log_write(log,text,TRUE)
|
||||||
|
#define WRITE_LOG_NO_FORMAT(log, text) extools_log_write(log,text,FALSE)
|
||||||
|
#else
|
||||||
//This is an external call, "true" and "false" are how rust parses out booleans
|
//This is an external call, "true" and "false" are how rust parses out booleans
|
||||||
#define WRITE_LOG(log, text) rustg_log_write(log, text, "true")
|
#define WRITE_LOG(log, text) rustg_log_write(log, text, "true")
|
||||||
#define WRITE_LOG_NO_FORMAT(log, text) rustg_log_write(log, text, "false")
|
#define WRITE_LOG_NO_FORMAT(log, text) rustg_log_write(log, text, "false")
|
||||||
|
#endif
|
||||||
//print a warning message to world.log
|
//print a warning message to world.log
|
||||||
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
|
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
|
||||||
/proc/warning(msg)
|
/proc/warning(msg)
|
||||||
@@ -216,7 +221,11 @@
|
|||||||
|
|
||||||
/* Close open log handles. This should be called as late as possible, and no logging should hapen after. */
|
/* Close open log handles. This should be called as late as possible, and no logging should hapen after. */
|
||||||
/proc/shutdown_logging()
|
/proc/shutdown_logging()
|
||||||
|
#ifdef EXTOOLS_LOGGING
|
||||||
|
extools_finalize_logging()
|
||||||
|
#else
|
||||||
rustg_log_close_all()
|
rustg_log_close_all()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Helper procs for building detailed log lines */
|
/* Helper procs for building detailed log lines */
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ GLOBAL_LIST(topic_status_cache)
|
|||||||
/world/New()
|
/world/New()
|
||||||
if (fexists(EXTOOLS))
|
if (fexists(EXTOOLS))
|
||||||
call(EXTOOLS, "maptick_initialize")()
|
call(EXTOOLS, "maptick_initialize")()
|
||||||
|
#ifdef EXTOOLS_LOGGING
|
||||||
|
call(EXTOOLS, "init_logging")()
|
||||||
|
else
|
||||||
|
CRASH("[EXTOOLS] does not exist!")
|
||||||
|
#endif
|
||||||
enable_debugger()
|
enable_debugger()
|
||||||
#ifdef REFERENCE_TRACKING
|
#ifdef REFERENCE_TRACKING
|
||||||
enable_reference_tracking()
|
enable_reference_tracking()
|
||||||
@@ -274,6 +279,7 @@ GLOBAL_LIST(topic_status_cache)
|
|||||||
GM.__gasmixture_unregister()
|
GM.__gasmixture_unregister()
|
||||||
num_deleted++
|
num_deleted++
|
||||||
log_world("Deallocated [num_deleted] gas mixtures")
|
log_world("Deallocated [num_deleted] gas mixtures")
|
||||||
|
shutdown_logging() // makes sure the thread is closed before end, else we terminate
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/world/proc/update_status()
|
/world/proc/update_status()
|
||||||
|
|||||||
Binary file not shown.
@@ -17,6 +17,7 @@
|
|||||||
#include "_maps\_basemap.dm"
|
#include "_maps\_basemap.dm"
|
||||||
#include "code\_compile_options.dm"
|
#include "code\_compile_options.dm"
|
||||||
#include "code\world.dm"
|
#include "code\world.dm"
|
||||||
|
#include "code\__DEFINES\_extools.dm"
|
||||||
#include "code\__DEFINES\_globals.dm"
|
#include "code\__DEFINES\_globals.dm"
|
||||||
#include "code\__DEFINES\_protect.dm"
|
#include "code\__DEFINES\_protect.dm"
|
||||||
#include "code\__DEFINES\_tick.dm"
|
#include "code\__DEFINES\_tick.dm"
|
||||||
@@ -147,6 +148,7 @@
|
|||||||
#include "code\__DEFINES\storage\_storage.dm"
|
#include "code\__DEFINES\storage\_storage.dm"
|
||||||
#include "code\__DEFINES\storage\volumetrics.dm"
|
#include "code\__DEFINES\storage\volumetrics.dm"
|
||||||
#include "code\__HELPERS\_cit_helpers.dm"
|
#include "code\__HELPERS\_cit_helpers.dm"
|
||||||
|
#include "code\__HELPERS\_extools_api.dm"
|
||||||
#include "code\__HELPERS\_lists.dm"
|
#include "code\__HELPERS\_lists.dm"
|
||||||
#include "code\__HELPERS\_logging.dm"
|
#include "code\__HELPERS\_logging.dm"
|
||||||
#include "code\__HELPERS\_string_lists.dm"
|
#include "code\__HELPERS\_string_lists.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user