mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-25 00:22:39 +00:00
## 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>
44 lines
1.9 KiB
Plaintext
44 lines
1.9 KiB
Plaintext
/**
|
|
* Helper for logging chat messages or other logs with arbitrary inputs (e.g. announcements)
|
|
*
|
|
* This proc compiles a log string by prefixing the tag to the message
|
|
* and suffixing what it was forced_by if anything
|
|
* if the message lacks a tag and suffix then it is logged on its own
|
|
* Arguments:
|
|
* * message - The message being logged
|
|
* * message_type - the type of log the message is(ATTACK, SAY, etc)
|
|
* * tag - tag that indicates the type of text(announcement, telepathy, etc)
|
|
* * log_globally - boolean checking whether or not we write this log to the log file
|
|
* * forced_by - source that forced the dialogue if any
|
|
*/
|
|
/atom/proc/log_talk(message, message_type, tag = null, log_globally = TRUE, forced_by = null, custom_say_emote = null)
|
|
var/prefix = tag ? "([tag]) " : ""
|
|
var/suffix = forced_by ? " FORCED by [forced_by]" : ""
|
|
log_message("[prefix][custom_say_emote ? "*[custom_say_emote]*, " : ""]\"[message]\"[suffix]", message_type, log_globally = log_globally)
|
|
|
|
/// Logging for generic spoken messages
|
|
/proc/log_say(text, list/data)
|
|
logger.Log(LOG_CATEGORY_GAME_SAY, text, data)
|
|
|
|
/// Logging for whispered messages
|
|
/proc/log_whisper(text, list/data)
|
|
logger.Log(LOG_CATEGORY_GAME_WHISPER, text, data)
|
|
|
|
/// Helper for logging of messages with only one sender and receiver (i.e. mind links)
|
|
/proc/log_directed_talk(atom/source, atom/target, message, message_type, tag)
|
|
if(!tag)
|
|
stack_trace("Unspecified tag for private message")
|
|
tag = "UNKNOWN"
|
|
|
|
source.log_talk(message, message_type, tag = "[tag] to [key_name(target)]")
|
|
if(source != target)
|
|
target.log_talk(message, LOG_VICTIM, tag = "[tag] from [key_name(source)]", log_globally = FALSE)
|
|
|
|
/// Logging for speech taking place over comms, as well as tcomms equipment
|
|
/proc/log_telecomms(text, list/data)
|
|
logger.Log(LOG_CATEGORY_TELECOMMS, text, data)
|
|
|
|
/// Logging for speech indicators.
|
|
/proc/log_speech_indicators(text, list/data)
|
|
logger.Log(LOG_CATEGORY_SPEECH_INDICATOR, text, data)
|