Skip to content

Commit

Permalink
Revert "[MIRROR] JSON Logging Take Two [MDB IGNORE] (Skyrat-SS13#21329)"
Browse files Browse the repository at this point in the history
This reverts commit 649c250.
  • Loading branch information
Dimach committed Jun 21, 2023
1 parent 490ca17 commit c7b0494
Show file tree
Hide file tree
Showing 57 changed files with 379 additions and 1,111 deletions.
8 changes: 1 addition & 7 deletions code/__DEFINES/_protect.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///Protects a datum from being VV'd or spawned through admin manipulation
///Protects a datum from being VV'd
#define GENERAL_PROTECT_DATUM(Path)\
##Path/can_vv_get(var_name){\
return FALSE;\
Expand All @@ -8,10 +8,4 @@
}\
##Path/CanProcCall(procname){\
return FALSE;\
}\
##Path/Read(savefile/savefile){\
qdel(src);\
}\
##Path/Write(savefile/savefile){\
return;\
}
97 changes: 13 additions & 84 deletions code/__DEFINES/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,95 +55,24 @@
#define LOGSRC_MOB "Mob"

// Log header keys
#define LOG_HEADER_CATEGORY "cat"
#define LOG_HEADER_CATEGORY_LIST "cat-list"
#define LOG_HEADER_INIT_TIMESTAMP "ts"
#define LOG_HEADER_ROUND_ID "round-id"
#define LOG_HEADER_SECRET "secret"
#define LOG_HEADER_CATEGORY "category"
#define LOG_HEADER_INIT_TIMESTAMP "timestamp"
#define LOG_HEADER_ROUND_ID "round_id"

// Log data keys
#define LOG_ENTRY_MESSAGE "message"
#define LOG_ENTRY_TIMESTAMP "timestamp"
#define LOG_ENTRY_DATA "data"

// Log json keys
#define LOG_JSON_CATEGORY "cat"
#define LOG_JSON_CATEGORY "category"
#define LOG_JSON_ENTRIES "entries"
#define LOG_JSON_LOGGING_START "log-start"

// Category for invalid/missing categories
#define LOG_CATEGORY_NOT_FOUND "invalid-category"
#define LOG_JSON_LOGGING_START "log_start"

// Misc categories
#define LOG_CATEGORY_ATTACK "attack"
#define LOG_CATEGORY_CONFIG "config"
#define LOG_CATEGORY_DYNAMIC "dynamic"
#define LOG_CATEGORY_ECONOMY "economy"
#define LOG_CATEGORY_FILTER "filter"
#define LOG_CATEGORY_MANIFEST "manifest"
#define LOG_CATEGORY_MECHA "mecha"
#define LOG_CATEGORY_PAPER "paper"
#define LOG_CATEGORY_RUNTIME "runtime"
#define LOG_CATEGORY_SHUTTLE "shuttle"
#define LOG_CATEGORY_SILICON "silicon"
// Log categories
#define LOG_CATEGORY_NOT_FOUND "invalid_category"
#define LOG_CATEGORY_TARGET_ZONE_SWITCH "target_zone_switch"
#define LOG_CATEGORY_SILO "silo"
#define LOG_CATEGORY_SIGNAL "signal"
#define LOG_CATEGORY_SPEECH_INDICATOR "speech-indiciator"
#define LOG_CATEGORY_SUSPICIOUS_LOGIN "supicious-login"
#define LOG_CATEGORY_TARGET_ZONE_SWITCH "target-zone-switch"
#define LOG_CATEGORY_TELECOMMS "telecomms"
#define LOG_CATEGORY_TOOL "tool"
#define LOG_CATEGORY_VIRUS "virus"

// Admin categories
#define LOG_CATEGORY_ADMIN "admin"
#define LOG_CATEGORY_ADMIN_CIRCUIT "admin-circuit"
#define LOG_CATEGORY_ADMIN_DSAY "admin-dsay"

// Admin private categories
#define LOG_CATEGORY_ADMIN_PRIVATE "adminprivate"
#define LOG_CATEGORY_ADMIN_PRIVATE_ASAY "adminprivate-asay"

// Debug categories
#define LOG_CATEGORY_DEBUG "debug"
#define LOG_CATEGORY_DEBUG_ASSET "debug-asset"
#define LOG_CATEGORY_DEBUG_HREF "debug-href"
#define LOG_CATEGORY_DEBUG_JOB "debug-job"
#define LOG_CATEGORY_DEBUG_LUA "debug-lua"
#define LOG_CATEGORY_DEBUG_MAPPING "debug-mapping"
#define LOG_CATEGORY_DEBUG_MOBTAG "debug-mobtag"
#define LOG_CATEGORY_DEBUG_QDEL "debug-qdel"
#define LOG_CATEGORY_DEBUG_SQL "debug-sql"
#define LOG_CATEGORY_DEBUG_TGUI "debug-tgui"

// Compatibility categories, for when stuff is changed and you need existing functionality to work
#define LOG_CATEGORY_COMPAT_GAME "game-compat"

// Game categories
#define LOG_CATEGORY_GAME "game"
#define LOG_CATEGORY_GAME_ACCESS "game-access"
#define LOG_CATEGORY_GAME_EMOTE "game-emote"
#define LOG_CATEGORY_GAME_INTERNET_REQUEST "game-internet-request"
#define LOG_CATEGORY_GAME_OOC "game-ooc"
#define LOG_CATEGORY_GAME_PRAYER "game-prayer"
#define LOG_CATEGORY_GAME_RADIO_EMOTE "game-radio-emote"
#define LOG_CATEGORY_GAME_SAY "game-say"
#define LOG_CATEGORY_GAME_TOPIC "game-topic"
#define LOG_CATEGORY_GAME_TRAITOR "game-traitor"
#define LOG_CATEGORY_GAME_VOTE "game-vote"
#define LOG_CATEGORY_GAME_WHISPER "game-whisper"

// Uplink categories
#define LOG_CATEGORY_UPLINK "uplink"
#define LOG_CATEGORY_UPLINK_CHANGELING "uplink-changeling"
#define LOG_CATEGORY_UPLINK_HERETIC "uplink-heretic"
#define LOG_CATEGORY_UPLINK_MALF "uplink-malf"
#define LOG_CATEGORY_UPLINK_SPELL "uplink-spell"

// PDA categories
#define LOG_CATEGORY_PDA "pda"
#define LOG_CATEGORY_PDA_CHAT "pda-chat"
#define LOG_CATEGORY_PDA_COMMENT "pda-comment"

#define SCHEMA_VERSION "schema-version"

// Default log schema version
#define LOG_CATEGORY_SCHEMA_VERSION_NOT_SET "0.0.1"

//wrapper macros for easier grepping
#define DIRECT_OUTPUT(A, B) A << B
Expand Down
10 changes: 0 additions & 10 deletions code/__DEFINES/~skyrat_defines/_globalvars/logging.dm

This file was deleted.

12 changes: 8 additions & 4 deletions code/__DEFINES/~skyrat_defines/logging.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Logging types for log_message()
#define LOG_SUBTLE (1 << 22)
#define LOG_SUBTLER (1 << 23)
#define LOG_SUBTLER (1 << 22)

//Individual logging panel pages
#undef INDIVIDUAL_EMOTE_LOG
#define INDIVIDUAL_EMOTE_LOG (LOG_EMOTE | LOG_SUBTLE | LOG_SUBTLER)
#define INDIVIDUAL_EMOTE_LOG (LOG_EMOTE | LOG_SUBTLER)
#undef INDIVIDUAL_SHOW_ALL_LOG
#define INDIVIDUAL_SHOW_ALL_LOG (LOG_ATTACK | LOG_SAY | LOG_WHISPER | LOG_EMOTE | LOG_SUBTLE | LOG_SUBTLER | LOG_DSAY | LOG_PDA | LOG_CHAT | LOG_COMMENT | LOG_TELECOMMS | LOG_OOC | LOG_ADMIN | LOG_OWNERSHIP | LOG_GAME | LOG_ADMIN_PRIVATE | LOG_ASAY | LOG_MECHA | LOG_VIRUS | LOG_SHUTTLE | LOG_ECON)
#define INDIVIDUAL_SHOW_ALL_LOG (LOG_ATTACK | LOG_SAY | LOG_WHISPER | LOG_EMOTE | LOG_SUBTLER | LOG_DSAY | LOG_PDA | LOG_CHAT | LOG_COMMENT | LOG_TELECOMMS | LOG_OOC | LOG_ADMIN | LOG_OWNERSHIP | LOG_GAME | LOG_ADMIN_PRIVATE | LOG_ASAY | LOG_MECHA | LOG_VIRUS | LOG_SHUTTLE | LOG_ECON)

// Investigate
#define INVESTIGATE_CIRCUIT "circuit"


2 changes: 1 addition & 1 deletion code/__HELPERS/files.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
GLOBAL_VAR_INIT(fileaccess_timer, 0)

/client/proc/browse_files(root_type=BROWSE_ROOT_ALL_LOGS, max_iterations=10, list/valid_extensions=list("txt","log","htm", "html", "gz", "json"))
/client/proc/browse_files(root_type=BROWSE_ROOT_ALL_LOGS, max_iterations=10, list/valid_extensions=list("txt","log","htm", "html", "gz"))
// wow why was this ever a parameter
var/root = "data/logs/"
switch(root_type)
Expand Down
29 changes: 1 addition & 28 deletions code/__HELPERS/logging/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,6 @@
msg = "## NOTICE: [msg]"
log_world(msg)

#define SET_SERIALIZATION_SEMVER(semver_list, semver) semver_list[type] = semver
#define CHECK_SERIALIZATION_SEMVER(wanted, actual) (__check_serialization_semver(wanted, actual))

/// Checks if the actual semver is equal or later than the wanted semver
/// Must be passed as TEXT; you're probably looking for CHECK_SERIALIZATION_SEMVER, look right above
/proc/__check_serialization_semver(wanted, actual)
if(wanted == actual)
return TRUE

var/list/wanted_versions = semver_to_list(wanted)
var/list/actual_versions = semver_to_list(actual)

if(!wanted_versions || !actual_versions)
stack_trace("Invalid semver string(s) passed to __check_serialization_semver: '[wanted]' and '[actual]'")
return FALSE

if(wanted_versions[1] != actual_versions[1])
return FALSE // major must always

if(wanted_versions[2] > actual_versions[2])
return FALSE // actual must be later than wanted

// patch is not checked
return TRUE

//print a testing-mode debug message to world.log and world
#ifdef TESTING
#define testing(msg) log_world("## TESTING: [msg]"); to_chat(world, "## TESTING: [msg]")
Expand Down Expand Up @@ -128,8 +103,6 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global"))
if(LOG_EMOTE)
log_emote(log_text)
//SKYRAT EDIT ADDITION BEGIN
if(LOG_SUBTLE)
log_subtle(log_text)
if(LOG_SUBTLER)
log_subtler(log_text)
//SKYRAT EDIT ADDITION END
Expand Down Expand Up @@ -176,7 +149,7 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global"))
/* Close open log handles. This should be called as late as possible, and no logging should hapen after. */
/proc/shutdown_logging()
rustg_log_close_all()
logger.shutdown_logging()
GLOB.logger.shutdown_logging()

/* Helper procs for building detailed log lines */
/proc/key_name(whom, include_link = null, include_name = TRUE)
Expand Down
38 changes: 18 additions & 20 deletions code/__HELPERS/logging/admin.dm
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
/* 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)
/proc/log_admin(text)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMIN: [text]")
if (CONFIG_GET(flag/log_admin))
WRITE_LOG(GLOB.world_game_log, "ADMIN: [text]")

/// Logging for admin actions on or with circuits
/proc/log_admin_circuit(text, list/data)
/proc/log_admin_circuit(text)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN_CIRCUIT, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMIN: CIRCUIT: [text]")
if(CONFIG_GET(flag/log_admin))
WRITE_LOG(GLOB.world_game_log, "ADMIN: CIRCUIT: [text]")

/// General logging for admin actions
/proc/log_admin_private(text, list/data)
/proc/log_admin_private(text)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN_PRIVATE, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMINPRIVATE: [text]")
if (CONFIG_GET(flag/log_admin))
WRITE_LOG(GLOB.world_game_log, "ADMINPRIVATE: [text]")

/// Logging for AdminSay (ASAY) messages
/proc/log_adminsay(text, list/data)
/proc/log_adminsay(text)
GLOB.admin_activities.Add(text)
logger.Log(LOG_CATEGORY_ADMIN_PRIVATE_ASAY, text, data)
logger.Log(LOG_CATEGORY_COMPAT_GAME, "ADMINPRIVATE: ASAY: [text]")
if (CONFIG_GET(flag/log_adminchat))
WRITE_LOG(GLOB.world_game_log, "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]")
/proc/log_dsay(text)
if (CONFIG_GET(flag/log_adminchat))
WRITE_LOG(GLOB.world_game_log, "ADMIN: DSAY: [text]")

/**
* Writes to a special log file if the log_suspicious_login config flag is set,
Expand All @@ -39,7 +36,8 @@
* 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)
/proc/log_suspicious_login(text, access_log_mirror = TRUE)
if (CONFIG_GET(flag/log_suspicious_login))
WRITE_LOG(GLOB.world_suspicious_login_log, "SUSPICIOUS_ACCESS: [text]")
if(access_log_mirror)
log_access(text)
30 changes: 18 additions & 12 deletions code/__HELPERS/logging/antagonists.dm
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
/// Logging for traitor objectives
/proc/log_traitor(text, list/data)
logger.Log(LOG_CATEGORY_GAME_TRAITOR, text, data)
/proc/log_traitor(text)
if (CONFIG_GET(flag/log_traitor))
WRITE_LOG(GLOB.world_game_log, "TRAITOR: [text]")

/// Logging for items purchased from a traitor uplink
/proc/log_uplink(text, list/data)
logger.Log(LOG_CATEGORY_UPLINK, text, data)
/proc/log_uplink(text)
if (CONFIG_GET(flag/log_uplink))
WRITE_LOG(GLOB.world_uplink_log, "UPLINK: [text]")

/// Logging for upgrades purchased by a malfunctioning (or combat upgraded) AI
/proc/log_malf_upgrades(text, list/data)
logger.Log(LOG_CATEGORY_UPLINK_MALF, text, data)
/proc/log_malf_upgrades(text)
if (CONFIG_GET(flag/log_uplink))
WRITE_LOG(GLOB.world_uplink_log, "MALF UPGRADE: [text]")

/// Logging for changeling powers purchased
/proc/log_changeling_power(text, list/data)
logger.Log(LOG_CATEGORY_UPLINK_CHANGELING, text, data)
/proc/log_changeling_power(text)
if (CONFIG_GET(flag/log_uplink))
WRITE_LOG(GLOB.world_uplink_log, "CHANGELING: [text]")

/// Logging for heretic powers learned
/proc/log_heretic_knowledge(text, list/data)
logger.Log(LOG_CATEGORY_UPLINK_HERETIC, text, data)
/proc/log_heretic_knowledge(text)
if (CONFIG_GET(flag/log_uplink))
WRITE_LOG(GLOB.world_uplink_log, "HERETIC RESEARCH: [text]")

/// Logging for wizard powers learned
/proc/log_spellbook(text, list/data)
logger.Log(LOG_CATEGORY_UPLINK_SPELL, text, data)
/proc/log_spellbook(text)
if (CONFIG_GET(flag/log_uplink))
WRITE_LOG(GLOB.world_uplink_log, "SPELLBOOK: [text]")
5 changes: 3 additions & 2 deletions code/__HELPERS/logging/attack.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// Generic attack logging
/proc/log_attack(text, list/data)
logger.Log(LOG_CATEGORY_ATTACK, text)
/proc/log_attack(text)
if (CONFIG_GET(flag/log_attack))
WRITE_LOG(GLOB.world_attack_log, "ATTACK: [text]")

/**
* Log a combat message in the attack log
Expand Down
Loading

0 comments on commit c7b0494

Please sign in to comment.