Skip to content

Commit

Permalink
Update runtime log to use RustG
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhEugene committed Nov 26, 2023
1 parent db50e52 commit 63fbfca
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
10 changes: 7 additions & 3 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
1 change: 1 addition & 0 deletions mods/rust_g/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
2 changes: 1 addition & 1 deletion test/check-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" '(?<!<)<<(?!<)' -P
Expand Down

0 comments on commit 63fbfca

Please sign in to comment.