Files
Aurora.3/code/_helpers/logging/debug.dm
Fluffy b183188689 Better logging (#16164)
* Initial

* Cleared duplicates

* More work, get rid of log_error

* more

* log_debug() to macro LOG_DEBUG

* More work

* More

* Guh

* Maybe better?

* More work

* gah

* Dear lord

* *inserts swears here*

* gdi

* More work

* More

* dear lord

* fsdfsdafs

* rsdaf

* sadfasf

* sdafsad

* fgsd

* small fuckup fix

* jfsd

* sdafasf

* gdi

* sdfa

* sfdafgds

* sdafasdvf

* sdfasdfg

* sdfsga

* asdf

* dsfasfsagf

* ihibhbjh

* fsadf

* adfas

* sdafsad

* sdfasd

* fsda

* vhb

* asf

* for arrow

* removed source file-line logging, added header for tgui
2023-08-05 21:53:11 +00:00

78 lines
2.6 KiB
Plaintext

/**
* Use the macro LOG_DEBUG instead of calling this directly.
* Used for general_purpose debug logging, please use more specific ones if available, or consider adding your own
*/
/proc/log_debug(text,level = SEVERITY_DEBUG)
if (isnull(config) ? TRUE : config.logsettings["log_debug"])
log_world("DEBUG: [text]")
if (level == SEVERITY_ERROR) // Errors are always logged
log_world("ERROR: [text]")
for(var/s in staff)
var/client/C = s
if(!C.prefs) //This is to avoid null.toggles runtime error while still initialyzing players preferences
return
if(C.prefs.toggles & CHAT_DEBUGLOGS)
to_chat(C, "DEBUG: [text]")
send_gelf_log(short_message = text, long_message = "[time_stamp()]: [text]", level = level, category = "DEBUG")
/// Logging for loading and caching assets
/proc/log_asset(text)
if(config.logsettings["log_asset"])
WRITE_LOG(config.logfiles["world_asset_log"], "ASSET: [text]")
/// Logging for config errors
/// Rarely gets called; just here in case the config breaks.
/proc/log_config(text)
WRITE_LOG(isnull(config) ? "config_error.log" : config.logfiles["config_error_log"], "CONFIG: [text]")
// Do not print to world.log during unit tests
#if !defined(UNIT_TEST)
SEND_TEXT(world.log, "CONFIG: [text]")
#endif
/proc/log_filter_raw(text)
WRITE_LOG(config.logfiles["filter_log"], "FILTER: [text]")
/// Logging for job slot changes
/proc/log_job_debug(text)
if (config.logsettings["log_job_debug"])
WRITE_LOG(config.logfiles["world_job_debug_log"], "JOB: [text]")
/// Logging for lua scripting
/proc/log_lua(text)
WRITE_LOG(config.logfiles["lua_log"], "LUA: [text]")
/// Logging for game performance
/proc/log_perf(list/perf_info)
. = "[perf_info.Join(",")]\n"
WRITE_LOG_NO_FORMAT(config.logfiles["perf_log"], .)
/// Logging for SQL errors
/proc/log_query_debug(text)
WRITE_LOG(config.logfiles["query_debug_log"], "SQL: [text]")
/* Log to the logfile only. */
/proc/log_runtime(text)
WRITE_LOG(isnull(config) ? "world_runtime.log" : config.logfiles["world_runtime_log"], "RUNTIME: [text]")
/proc/_log_signal(text)
if(config.logsettings["log_signals"])
WRITE_LOG(config.logfiles["signals_log"], "SIGNAL: [text]")
/// Logging for DB errors
/proc/log_sql(text)
WRITE_LOG(config.logfiles["sql_error_log"], "SQL: [text]")
/// Logging for world/Topic
/proc/_log_topic(text)
WRITE_LOG(config.logfiles["world_game_log"], "TOPIC: [text]")
/// Log to both DD and the logfile.
/proc/log_world(text)
#ifdef USE_CUSTOM_ERROR_HANDLER
WRITE_LOG(isnull(config) ? "world_runtime.log" : config.logfiles["world_runtime_log"], "WORLD: [text]")
#endif
SEND_TEXT(world.log, "WORLD: [text]")