From 63fbfcadf8a05eee811a6995142320d0df541a1a Mon Sep 17 00:00:00 2001 From: SuhEugene <32931701+SuhEugene@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:46:23 +0300 Subject: [PATCH] Update runtime log to use RustG --- code/_macros.dm | 5 ++++- code/game/world.dm | 10 +++++++--- mods/rust_g/README.md | 1 + test/check-paths.sh | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/code/_macros.dm b/code/_macros.dm index b4a22b3d029e7..6a1ce3fc97dfc 100644 --- a/code/_macros.dm +++ b/code/_macros.dm @@ -123,7 +123,10 @@ /// Common use #define legacy_chat(target, message) to_target(target, message) #define to_world(message) to_chat(world, message) -#define to_world_log(message) to_target(world.log, message) +// [SIERRA-EDIT] - RUST_G +// #define to_world_log(message) to_target(world.log, message) // SIERRA-EDIT - ORIGINAL +#define to_world_log(message) if (istext(world.log)) { rustg_log_write_formatted(world.log, message) } else { to_target(world.log, message) } +// [/SIERRA-EDIT] #define sound_to(target, sound) to_target(target, sound) #define image_to(target, image) to_target(target, image) #define show_browser(target, content, title) to_target(target, browse(content, title)) diff --git a/code/game/world.dm b/code/game/world.dm index a4d7298fc5a34..2bf66098b3f7b 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -92,9 +92,13 @@ GLOBAL_VAR(href_logfile) if (config.server_name) name = "[config.server_name]" if (config.log_runtime) - var/runtime_log = file("data/logs/runtime/[date_string]_[time2text(world.timeofday, "hh:mm")]_[game_id].log") - to_file(runtime_log, "Game [game_id] starting up at [time2text(world.timeofday, "hh:mm.ss")]") - log = runtime_log + // [SIERRA-EDIT] - RUST_G + // var/runtime_log = file("data/logs/runtime/[date_string]_[time2text(world.timeofday, "hh:mm")]_[game_id].log") // SIERRA-EDIT - ORIGINAL + // to_file(runtime_log, "Game [game_id] starting up at [time2text(world.timeofday, "hh:mm.ss")]") // SIERRA-EDIT - ORIGINAL + // log = runtime_log // SIERRA-EDIT - ORIGINAL + log = "data/logs/runtime/[date_string]_[time2text(world.timeofday, "hh:mm")]_[game_id].log" + to_world_log("Game [game_id] starting up at [time2text(world.timeofday, "hh:mm.ss")]") + // [/SIERRA-EDIT] if (config.log_hrefs) GLOB.href_logfile = file("data/logs/[date_string] hrefs.htm") diff --git a/mods/rust_g/README.md b/mods/rust_g/README.md index 4ea389ecb470f..711c1e91e99a1 100644 --- a/mods/rust_g/README.md +++ b/mods/rust_g/README.md @@ -28,6 +28,7 @@ ID мода: RUST_G ### Изменения *кор кода* +- `code/_macros.dm`: `#define to_world_log` - `code/_helpers/logging.dm`: `/proc/game_log()` - `code/controllers/master.dm`: `/datum/controller/master/New()` - `code/controllers/subsystems/garbage.dm`: `/datum/controller/subsystem/garbage/Shutdown()` diff --git a/test/check-paths.sh b/test/check-paths.sh index 75f01ebf03c1d..dc18c8c5210fc 100755 --- a/test/check-paths.sh +++ b/test/check-paths.sh @@ -38,7 +38,7 @@ exactly 115 "to_world uses" '\sto_world\(' exactly 0 "globals with leading /" '^/var' -P exactly 0 "globals without global sugar" '^var/(?!global/)' -P exactly 0 "apparent paths with trailing /" '\w/[,\)\n]' -P -exactly 50 "to_world_log uses" '\sto_world_log\(' +exactly $((50 + 2)) "to_world_log uses" '\sto_world_log\(' exactly 0 "world<< uses" 'world<<|world[[:space:]]<<' exactly 0 "world.log<< uses" 'world.log<<|world.log[[:space:]]<<' exactly 2 "<< uses" '(?