Files
Bubberstation/code/__HELPERS/logging/admin.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

46 lines
1.9 KiB
Plaintext

/* Items with ADMINPRIVATE prefixed are stripped from public logs. */
// For backwards compatibility these are currently also added to LOG_CATEGORY_GAME with their respective prefix
// This is to avoid breaking any existing tools that rely on the old format, but should be removed in the future
/// General logging for admin actions
/proc/log_admin(text, list/data)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMIN: [text]")
/// Logging for admin actions on or with circuits
/proc/log_admin_circuit(text, list/data)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN_CIRCUIT, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMIN: CIRCUIT: [text]")
/// General logging for admin actions
/proc/log_admin_private(text, list/data)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN_PRIVATE, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMINPRIVATE: [text]")
/// Logging for AdminSay (ASAY) messages
/proc/log_adminsay(text, list/data)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN_PRIVATE_ASAY, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMINPRIVATE: ASAY: [text]")
/// Logging for DeachatSay (DSAY) messages
/proc/log_dsay(text, list/data)
logger.Log(LOG_CATEGORY_ADMIN_DSAY, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMIN: DSAY: [text]")
/**
* Writes to a special log file if the log_suspicious_login config flag is set,
* which is intended to contain all logins that failed under suspicious circumstances.
*
* Mirrors this log entry to log_access when access_log_mirror is TRUE, so this proc
* doesn't need to be used alongside log_access and can replace it where appropriate.
*/
/proc/log_suspicious_login(text, list/data, access_log_mirror = TRUE)
logger.Log(LOG_CATEGORY_SUSPICIOUS_LOGIN, text)
if(access_log_mirror)
log_access(text)