Files
Aurora.3/code/_helpers/logging.dm
skull132 e9b688e1f6 Merge branch 'development-2' into development
Christ on a stick. SO MANY ERRORS. REEE.

# Conflicts:
#	baystation12.dme
#	code/_helpers/lists.dm
#	code/_helpers/logging.dm
#	code/_helpers/text.dm
#	code/_onclick/click.dm
#	code/controllers/configuration.dm
#	code/controllers/master_controller.dm
#	code/datums/supplypacks.dm
#	code/game/antagonist/antagonist.dm
#	code/game/antagonist/antagonist_print.dm
#	code/game/antagonist/outsider/commando.dm
#	code/game/antagonist/outsider/ninja.dm
#	code/game/area/areas.dm
#	code/game/gamemodes/cult/cult_items.dm
#	code/game/gamemodes/game_mode.dm
#	code/game/jobs/access.dm
#	code/game/machinery/atmoalter/canister.dm
#	code/game/machinery/autolathe.dm
#	code/game/machinery/doors/airlock.dm
#	code/game/machinery/recharger.dm
#	code/game/machinery/suit_storage_unit.dm
#	code/game/mecha/mech_fabricator.dm
#	code/game/mecha/mecha.dm
#	code/game/objects/effects/spiders.dm
#	code/game/objects/items.dm
#	code/game/objects/items/devices/PDA/PDA.dm
#	code/game/objects/items/devices/flash.dm
#	code/game/objects/items/devices/lightreplacer.dm
#	code/game/objects/items/devices/paicard.dm
#	code/game/objects/items/devices/scanners.dm
#	code/game/objects/items/devices/suit_cooling.dm
#	code/game/objects/items/devices/uplink.dm
#	code/game/objects/items/robot/robot_upgrades.dm
#	code/game/objects/items/toys.dm
#	code/game/objects/items/weapons/cards_ids.dm
#	code/game/objects/items/weapons/handcuffs.dm
#	code/game/objects/items/weapons/manuals.dm
#	code/game/objects/items/weapons/material/kitchen.dm
#	code/game/objects/items/weapons/material/misc.dm
#	code/game/objects/items/weapons/material/swords.dm
#	code/game/objects/items/weapons/melee/energy.dm
#	code/game/objects/items/weapons/melee/misc.dm
#	code/game/objects/items/weapons/scrolls.dm
#	code/game/objects/items/weapons/storage/belt.dm
#	code/game/objects/items/weapons/stunbaton.dm
#	code/game/objects/items/weapons/tools.dm
#	code/game/objects/objs.dm
#	code/game/objects/structures/crates_lockers/closets.dm
#	code/game/objects/structures/crates_lockers/closets/secure/security.dm
#	code/game/objects/structures/janicart.dm
#	code/game/sound.dm
#	code/game/turfs/simulated.dm
#	code/game/verbs/ooc.dm
#	code/global.dm
#	code/modules/admin/verbs/debug.dm
#	code/modules/admin/verbs/modifyvariables.dm
#	code/modules/client/client procs.dm
#	code/modules/client/preferences.dm
#	code/modules/clothing/clothing.dm
#	code/modules/clothing/head/hardhat.dm
#	code/modules/clothing/head/helmet.dm
#	code/modules/clothing/head/jobs.dm
#	code/modules/clothing/head/misc_special.dm
#	code/modules/clothing/shoes/jobs.dm
#	code/modules/clothing/spacesuits/alien.dm
#	code/modules/clothing/spacesuits/captain.dm
#	code/modules/clothing/spacesuits/miscellaneous.dm
#	code/modules/clothing/spacesuits/rig/rig_pieces.dm
#	code/modules/clothing/spacesuits/rig/suits/alien.dm
#	code/modules/clothing/spacesuits/spacesuits.dm
#	code/modules/clothing/spacesuits/void/merc.dm
#	code/modules/clothing/spacesuits/void/void.dm
#	code/modules/clothing/suits/armor.dm
#	code/modules/clothing/suits/jobs.dm
#	code/modules/clothing/suits/storage.dm
#	code/modules/clothing/suits/utility.dm
#	code/modules/clothing/suits/wiz_robe.dm
#	code/modules/clothing/under/jobs/security.dm
#	code/modules/economy/Events.dm
#	code/modules/economy/Events_Mundane.dm
#	code/modules/economy/economy_misc.dm
#	code/modules/events/blob.dm
#	code/modules/events/event.dm
#	code/modules/events/event_container.dm
#	code/modules/events/event_manager.dm
#	code/modules/events/money_lotto.dm
#	code/modules/events/prison_break.dm
#	code/modules/events/spacevine.dm
#	code/modules/hydroponics/trays/tray.dm
#	code/modules/mob/dead/observer/observer.dm
#	code/modules/mob/emote.dm
#	code/modules/mob/holder.dm
#	code/modules/mob/language/station.dm
#	code/modules/mob/living/bot/cleanbot.dm
#	code/modules/mob/living/carbon/alien/diona/diona.dm
#	code/modules/mob/living/carbon/alien/diona/diona_attacks.dm
#	code/modules/mob/living/carbon/give.dm
#	code/modules/mob/living/carbon/human/emote.dm
#	code/modules/mob/living/carbon/human/human.dm
#	code/modules/mob/living/carbon/human/human_defense.dm
#	code/modules/mob/living/carbon/human/inventory.dm
#	code/modules/mob/living/carbon/human/life.dm
#	code/modules/mob/living/carbon/human/species/outsider/vox.dm
#	code/modules/mob/living/carbon/human/species/station/golem.dm
#	code/modules/mob/living/carbon/human/species/station/station.dm
#	code/modules/mob/living/carbon/human/update_icons.dm
#	code/modules/mob/living/carbon/metroid/metroid.dm
#	code/modules/mob/living/living.dm
#	code/modules/mob/living/living_defense.dm
#	code/modules/mob/living/living_defines.dm
#	code/modules/mob/living/silicon/ai/ai.dm
#	code/modules/mob/living/silicon/pai/admin.dm
#	code/modules/mob/living/silicon/pai/pai.dm
#	code/modules/mob/living/silicon/robot/drone/drone.dm
#	code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
#	code/modules/mob/living/silicon/robot/emote.dm
#	code/modules/mob/living/silicon/robot/robot_items.dm
#	code/modules/mob/living/silicon/robot/robot_modules.dm
#	code/modules/mob/living/silicon/silicon.dm
#	code/modules/mob/living/simple_animal/bees.dm
#	code/modules/mob/living/simple_animal/friendly/cat.dm
#	code/modules/mob/living/simple_animal/friendly/corgi.dm
#	code/modules/mob/living/simple_animal/friendly/farm_animals.dm
#	code/modules/mob/living/simple_animal/friendly/mouse.dm
#	code/modules/mob/living/simple_animal/friendly/spiderbot.dm
#	code/modules/mob/living/simple_animal/hostile/hostile.dm
#	code/modules/mob/living/simple_animal/simple_animal.dm
#	code/modules/mob/logout.dm
#	code/modules/mob/mob.dm
#	code/modules/mob/mob_grab_specials.dm
#	code/modules/mob/mob_helpers.dm
#	code/modules/mob/new_player/sprite_accessories.dm
#	code/modules/organs/organ.dm
#	code/modules/organs/organ_alien.dm
#	code/modules/organs/organ_external.dm
#	code/modules/paperwork/faxmachine.dm
#	code/modules/projectiles/ammunition/boxes.dm
#	code/modules/projectiles/ammunition/bullets.dm
#	code/modules/projectiles/guns/energy/nuclear.dm
#	code/modules/projectiles/guns/energy/rifle.dm
#	code/modules/projectiles/guns/energy/special.dm
#	code/modules/projectiles/guns/projectile.dm
#	code/modules/projectiles/guns/projectile/automatic.dm
#	code/modules/projectiles/guns/projectile/pistol.dm
#	code/modules/projectiles/guns/projectile/revolver.dm
#	code/modules/projectiles/guns/projectile/shotgun.dm
#	code/modules/projectiles/projectile/bullets.dm
#	code/modules/projectiles/projectile/special.dm
#	code/modules/reagents/reagent_containers.dm
#	code/modules/reagents/reagent_containers/food/drinks.dm
#	code/modules/research/designs.dm
#	code/modules/research/destructive_analyzer.dm
#	code/modules/research/rdconsole.dm
#	code/modules/spells/artifacts.dm
#	code/modules/spells/spellbook.dm
#	code/modules/tables/tables.dm
#	code/world.dm
#	config/example/config.txt
#	icons/mob/items_lefthand.dmi
#	icons/mob/items_righthand.dmi
#	icons/obj/lighting.dmi
2016-10-31 00:01:52 +02:00

184 lines
4.4 KiB
Plaintext

//print an error message to world.log
// On Linux/Unix systems the line endings are LF, on windows it's CRLF, admins that don't use notepad++
// will get logs that are one big line if the system is Linux and they are using notepad. This solves it by adding CR to every line ending
// in the logs. ascii character 13 = CR
/var/global/log_end= world.system_type == UNIX ? ascii2text(13) : ""
/proc/error(msg)
world.log << "## ERROR: [msg][log_end]"
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [src] usr: [usr].")
//print a warning message to world.log
/proc/warning(msg)
world.log << "## WARNING: [msg][log_end]"
//print a testing-mode debug message to world.log
/proc/testing(msg)
world.log << "## TESTING: [msg][log_end]"
/proc/game_log(category, text)
diary << "\[[time_stamp()]] [game_id] [category]: [text][log_end]"
/proc/log_admin(text)
admin_log.Add(text)
if (config.log_admin)
game_log("ADMIN", text)
/proc/log_debug(text)
if (config.log_debug)
game_log("DEBUG", text)
for(var/client/C in admins)
if(!C.prefs) //This is to avoid null.toggles runtime error while still initialyzing players preferences
return
if(C.prefs.toggles & CHAT_DEBUGLOGS)
C << "DEBUG: [text]"
/proc/log_game(text)
if (config.log_game)
game_log("GAME", text)
/proc/log_vote(text)
if (config.log_vote)
game_log("VOTE", text)
/proc/log_access(text)
if (config.log_access)
game_log("ACCESS", text)
/proc/log_say(text)
if (config.log_say)
game_log("SAY", text)
/proc/log_ooc(text)
if (config.log_ooc)
game_log("OOC", text)
/proc/log_whisper(text)
if (config.log_whisper)
game_log("WHISPER", text)
/proc/log_emote(text)
if (config.log_emote)
game_log("EMOTE", text)
/proc/log_attack(text)
if (config.log_attack)
game_log("ATTACK", text)
/proc/log_adminsay(text)
if (config.log_adminchat)
game_log("ADMINSAY", text)
/proc/log_adminwarn(text)
if (config.log_adminwarn)
game_log("ADMINWARN", text)
/proc/log_pda(text)
if (config.log_pda)
game_log("PDA", text)
/proc/log_to_dd(text)
world.log << text //this comes before the config check because it can't possibly runtime
if(config.log_world_output)
game_log("DD_OUTPUT", text)
/proc/log_misc(text)
game_log("MISC", text)
/proc/log_unit_test(text)
world.log << "## UNIT_TEST ##: [text]"
// Procs for logging into diary_runtime
/proc/log_hard_delete(atom/A)
if (config.log_runtime)
diary_runtime << "hard delete:[log_end]"
diary_runtime << "[A.type][log_end]"
/proc/log_exception(exception/e)
if (config.log_runtime)
if (config.log_runtime == 2)
log_debug("RUNTIME ERROR:\n[e.name]")
diary_runtime << "runtime error:[e.name][log_end]"
diary_runtime << "[e.desc]"
//pretty print a direction bitflag, can be useful for debugging.
/proc/print_dir(var/dir)
var/list/comps = list()
if(dir & NORTH) comps += "NORTH"
if(dir & SOUTH) comps += "SOUTH"
if(dir & EAST) comps += "EAST"
if(dir & WEST) comps += "WEST"
if(dir & UP) comps += "UP"
if(dir & DOWN) comps += "DOWN"
return english_list(comps, nothing_text="0", and_text="|", comma_text="|")
//more or less a logging utility
/proc/key_name(var/whom, var/include_link = null, var/include_name = 1, var/highlight_special_characters = 1)
var/mob/M
var/client/C
var/key
if(!whom) return "*null*"
if(istype(whom, /client))
C = whom
M = C.mob
key = C.key
else if(ismob(whom))
M = whom
C = M.client
key = M.key
else if(istype(whom, /datum/mind))
var/datum/mind/D = whom
key = D.key
M = D.current
if(D.current)
C = D.current.client
else if(istype(whom, /datum))
var/datum/D = whom
return "*invalid:[D.type]*"
else
return "*invalid*"
. = ""
if(key)
if(include_link && C)
. += "<a href='?priv_msg=\ref[C]'>"
if(C && C.holder && C.holder.fakekey && !include_name)
. += "Administrator"
else
. += key
if(include_link)
if(C) . += "</a>"
else . += " (DC)"
else
. += "*no key*"
if(include_name && M)
var/name
if(M.real_name)
name = M.real_name
else if(M.name)
name = M.name
if(include_link && is_special_character(M) && highlight_special_characters)
. += "/(<font color='#FFA500'>[name]</font>)" //Orange
else
. += "/([name])"
return .
/proc/key_name_admin(var/whom, var/include_name = 1)
return key_name(whom, 1, include_name)