Files
Bubberstation/code/__HELPERS/logging/debug.dm
Zephyr fbec9c14e9 JSON Logging Take Two (#73604)
## About The Pull Request

Converts all logging, excluding perf and investigate, to json.
I focused on making the system as easy to use and as easy to add new
categories as possible.

Due to issues related to logging to world at global creation logger is
now a byond real, which is created directly before Master

Log categories support versioning, secret flagging, and sub-category
filtering. Although all of this is entirely optional for coders.
If you ever want to add a new category and use it, all you need to do is
make the barebones category datum and the define.
I've kept existing procs such as log_game, and simply turned them into a
wrapper for Logger.Log(xxx, ...)
## Why It's Good For The Game

Makes processing and filtering logs much easier in the future, while
only minimally downgrading log crawling experience.
I am also working on a log viewer frontend for admin usage however that
will take a little bit longer to finish up.
Also makes special logging and data tracking much easier thanks to a
data list processing implementation and handling
## Changelog
🆑
server: All logs are now formatted in json, excluding perf and
investigations
/🆑

---------

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: tattle <66640614+dragomagol@users.noreply.github.com>
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
2023-05-22 14:51:00 +12:00

62 lines
1.7 KiB
Plaintext

/// Logging for loading and caching assets
/proc/log_asset(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_ASSET, text, data)
/// Logging for config errors
/// Rarely gets called; just here in case the config breaks.
/proc/log_config(text, list/data)
logger.Log(LOG_CATEGORY_CONFIG, text, data)
SEND_TEXT(world.log, text)
/proc/log_filter_raw(text, list/data)
logger.Log(LOG_CATEGORY_FILTER, text, data)
/// Logging for job slot changes
/proc/log_job_debug(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_JOB, text, data)
/// Logging for lua scripting
/proc/log_lua(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_LUA, text, data)
/// Logging for mapping errors
/proc/log_mapping(text, skip_world_log)
#ifdef UNIT_TESTS
GLOB.unit_test_mapping_logs += text
#endif
logger.Log(LOG_CATEGORY_DEBUG_MAPPING, text)
if(skip_world_log)
return
SEND_TEXT(world.log, text)
/// Logging for game performance
/proc/log_perf(list/perf_info)
. = "[perf_info.Join(",")]\n"
WRITE_LOG_NO_FORMAT(GLOB.perf_log, .)
/// Logging for hard deletes
/proc/log_qdel(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_QDEL, text, data)
/* Log to the logfile only. */
/proc/log_runtime(text, list/data)
logger.Log(LOG_CATEGORY_RUNTIME, text, data)
/proc/log_signal(text, list/data)
logger.Log(LOG_CATEGORY_SIGNAL, text, data)
/// Logging for DB errors
/proc/log_sql(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_SQL, text, data)
/// Logging for world/Topic
/proc/log_topic(text, list/data)
logger.Log(LOG_CATEGORY_GAME_TOPIC, text, data)
/// Log to both DD and the logfile.
/proc/log_world(text, list/data)
#ifdef USE_CUSTOM_ERROR_HANDLER
logger.Log(LOG_CATEGORY_RUNTIME, text, data)
#endif
SEND_TEXT(world.log, text)