Files
Bubberstation/code/__HELPERS/logging/talk.dm
nevimer 356efbfb3e Public Logging Update (#1545)
Use Regex to be smarter.

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Public logging finds ckeys via regex to remove them from lines now. Not
used for player say, at the moment. Not needed there either, as ckeys
are only used by key_name() and thats passed down as a string. rather
than just edit every instance of the proc, ill just regex them out by
adding identifiers into the ckey blocks in logs and snip them that way.

<!-- Please make sure to actually test your PRs. If you have not tested
your PR mention it. -->

## Why It's Good For The Game

Public logs are little more private. We want them only to have
characters, no keys.

## Proof Of Testing

<!-- Compile and run your code locally. Make sure it works. This is the
place to show off your changes! We are not responsible for testing your
features. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
refactor: public logging uses regex for cases of mechanics now. 
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

<!-- By opening a pull request. You have read and understood the
repository rules located on the main README.md on this project. -->

Co-authored-by: Waterpig <49160555+Majkl-J@users.noreply.github.com>
2024-11-25 18:54:51 -05:00

48 lines
2.4 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)
// log_public_file(message) // BUBBER EDIT
/// Logging for generic spoken messages
/proc/log_say(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_GAME_SAY, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT
/// Logging for whispered messages
/proc/log_whisper(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_GAME_WHISPER, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT
/// 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, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_TELECOMMS, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT
/// Logging for speech indicators.
/proc/log_speech_indicators(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_SPEECH_INDICATOR, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT