Xonotic
log.qh File Reference
#include "progname.qh"
+ Include dependency graph for log.qh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __SOURCELOC__   (sprintf("^7%s^9(^9%s^7:^9%s^7)", __FUNC__, __FILE__, STR(__LINE__)))
 
#define _assert(f, expr, then)
 
#define _backtrace()   builtin_remove(NULL)
 
#define _LOG(f, level, s)
 
#define _LOG_DEBUG(s)   _LOG(dprint2, "^2DEBUG", s)
 
#define _LOG_FATAL(s)   _LOG(error, "^1FATAL", s)
 
#define _LOG_HEADER(level)   "^9[::^7"PROGNAME"^9::"level"^9] ", __SOURCELOC__
 
#define _LOG_HELP(s)   print("^7", s, "\n")
 
#define _LOG_INFO(s)
 
#define _LOG_SEVERE(s)   _LOG(backtrace, "^1SEVERE", s)
 
#define _LOG_TRACE(s)   _LOG(dprint, "^6TRACE", s)
 
#define _LOG_WARN(s)   _LOG(print, "^3WARNING", s)
 
#define assert(expr, ...)   _assert(print_assertfailed_severe, expr, __VA_ARGS__)
 
#define ASSERT_LESS(name, var, const)   noref int name[(const - var + 1)];
 
#define assert_once(expr, ...)
 
#define backtrace(msg)
 
#define demand(expr, ...)   _assert(print_assertfailed_fatal, expr, __VA_ARGS__)
 
#define devassert(...)   MACRO_BEGIN if (autocvar_developer > 0) assert(__VA_ARGS__); MACRO_END
 
#define devassert_once(...)   MACRO_BEGIN if (autocvar_developer > 0) assert_once(__VA_ARGS__); MACRO_END
 
#define devdemand(...)   MACRO_BEGIN if (autocvar_developer > 0) demand(__VA_ARGS__); MACRO_END
 
#define dprint2(msg)
 
#define LOG_DEBUG(...)   _LOG_DEBUG(strcat1n(__VA_ARGS__))
 
#define LOG_DEBUGF(...)   _LOG_DEBUG(sprintf(__VA_ARGS__))
 
#define LOG_FATAL(...)   _LOG_FATAL(strcat1n(__VA_ARGS__))
 
#define LOG_FATALF(...)   _LOG_FATAL(sprintf(__VA_ARGS__))
 
#define LOG_HELP(...)   _LOG_HELP(strcat1n(__VA_ARGS__))
 
#define LOG_HELPF(...)   _LOG_HELP(sprintf(__VA_ARGS__))
 
#define LOG_INFO(...)   _LOG_INFO(strcat1n(__VA_ARGS__))
 
#define LOG_INFOF(...)   _LOG_INFO(sprintf(__VA_ARGS__))
 
#define LOG_SEVERE(...)   _LOG_SEVERE(strcat1n(__VA_ARGS__))
 
#define LOG_SEVEREF(...)   _LOG_SEVERE(sprintf(__VA_ARGS__))
 
#define LOG_TRACE(...)   _LOG_TRACE(strcat1n(__VA_ARGS__))
 
#define LOG_TRACEF(...)   _LOG_TRACE(sprintf(__VA_ARGS__))
 
#define LOG_WARN(...)   _LOG_WARN(strcat1n(__VA_ARGS__))
 
#define LOG_WARNF(...)   _LOG_WARN(sprintf(__VA_ARGS__))
 

Functions

void print_assertfailed_fatal (string expr)
 
void print_assertfailed_severe (string expr)
 
 string (string, string...) strcat1n
 

Variables

noref int autocvar_developer
 
noref bool autocvar_prvm_backtraceforwarnings
 

Macro Definition Documentation

◆ __SOURCELOC__

#define __SOURCELOC__   (sprintf("^7%s^9(^9%s^7:^9%s^7)", __FUNC__, __FILE__, STR(__LINE__)))

Definition at line 48 of file log.qh.

◆ _assert

#define _assert (   f,
  expr,
  then 
)
Value:
if (!(expr)) \
{ \
f(#expr); \
then; \
} \
MACRO_END
if(IS_DEAD(this))
Definition: impulse.qc:92

Definition at line 25 of file log.qh.

◆ _backtrace

#define _backtrace ( )    builtin_remove(NULL)

Definition at line 100 of file log.qh.

◆ _LOG

#define _LOG (   f,
  level,
 
)
Value:
if (autocvar_developer > 0) f(strcat1n(_LOG_HEADER(level), "\n")); \
f(strcat1n("^7", s, "\n")); \
#define MACRO_END
Definition: macro.qh:7
#define _LOG_HEADER(level)
Definition: log.qh:51
noref int autocvar_developer
Definition: log.qh:102
if(IS_DEAD(this))
Definition: impulse.qc:92

Definition at line 52 of file log.qh.

◆ _LOG_DEBUG

#define _LOG_DEBUG (   s)    _LOG(dprint2, "^2DEBUG", s)

Definition at line 87 of file log.qh.

◆ _LOG_FATAL

#define _LOG_FATAL (   s)    _LOG(error, "^1FATAL", s)

Definition at line 60 of file log.qh.

◆ _LOG_HEADER

#define _LOG_HEADER (   level)    "^9[::^7"PROGNAME"^9::"level"^9] ", __SOURCELOC__

Definition at line 51 of file log.qh.

◆ _LOG_HELP

#define _LOG_HELP (   s)    print("^7", s, "\n")

Definition at line 97 of file log.qh.

◆ _LOG_INFO

#define _LOG_INFO (   s)
Value:
if (autocvar_developer > 1) dprint(strcat1n(_LOG_HEADER("^5INFO"), "\n")); \
string __s = s; \
print("^7", __s); \
/* TODO: unconditionally add a newline when possible */ \
if (str2chr(__s, strlen(__s) - 1) != '\n') { print("\n"); } \
MACRO_END
#define str2chr
Definition: dpextensions.qh:45
#define _LOG_HEADER(level)
Definition: log.qh:51
noref int autocvar_developer
Definition: log.qh:102
if(IS_DEAD(this))
Definition: impulse.qc:92

Definition at line 72 of file log.qh.

◆ _LOG_SEVERE

#define _LOG_SEVERE (   s)    _LOG(backtrace, "^1SEVERE", s)

Definition at line 64 of file log.qh.

◆ _LOG_TRACE

#define _LOG_TRACE (   s)    _LOG(dprint, "^6TRACE", s)

Definition at line 83 of file log.qh.

◆ _LOG_WARN

#define _LOG_WARN (   s)    _LOG(print, "^3WARNING", s)

Definition at line 68 of file log.qh.

◆ assert

◆ ASSERT_LESS

#define ASSERT_LESS (   name,
  var,
  const 
)    noref int name[(const - var + 1)];

Definition at line 34 of file log.qh.

◆ assert_once

#define assert_once (   expr,
  ... 
)
Value:
MACRO_BEGIN \
static bool __once; \
if (!__once) \
{ \
assert(expr, __VA_ARGS__); \
__once = true; \
} \
MACRO_END

Definition at line 11 of file log.qh.

Referenced by RegisterTeam().

◆ backtrace

#define backtrace (   msg)
Value:
MACRO_BEGIN \
int dev = autocvar_developer; \
cvar_set("developer", "1"); \
cvar_set("prvm_backtraceforwarnings", "1"); \
print("\n--- CUT HERE ---\n", msg); \
_backtrace(); \
print("\n--- CUT UNTIL HERE ---\n"); \
cvar_set("developer", ftos(dev)); \
cvar_set("prvm_backtraceforwarnings", ftos(war)); \
MACRO_END
noref int autocvar_developer
Definition: log.qh:102
noref bool autocvar_prvm_backtraceforwarnings
Definition: log.qh:103

Definition at line 105 of file log.qh.

Referenced by ctf_RespawnFlag(), Deathtype_Name(), EliminatedPlayers_Init(), InitializeEntitiesRun(), Local_Notification(), Local_Notification_WOVA(), Mutator_Add(), Mutator_Remove(), Obituary(), Obituary_SpecialDeath(), Portal_TeleportPlayer(), RadiusDamageForSource(), round_handler_Spawn(), UpdatePlayerSounds(), W_DecreaseAmmo(), waypoint_spawn(), and weapon_thinkf().

◆ demand

#define demand (   expr,
  ... 
)    _assert(print_assertfailed_fatal, expr, __VA_ARGS__)

Definition at line 22 of file log.qh.

◆ devassert

#define devassert (   ...)    MACRO_BEGIN if (autocvar_developer > 0) assert(__VA_ARGS__); MACRO_END

Definition at line 9 of file log.qh.

◆ devassert_once

#define devassert_once (   ...)    MACRO_BEGIN if (autocvar_developer > 0) assert_once(__VA_ARGS__); MACRO_END

Definition at line 20 of file log.qh.

◆ devdemand

#define devdemand (   ...)    MACRO_BEGIN if (autocvar_developer > 0) demand(__VA_ARGS__); MACRO_END

Definition at line 23 of file log.qh.

◆ dprint2

#define dprint2 (   msg)
Value:
#define MACRO_END
Definition: macro.qh:7
noref int autocvar_developer
Definition: log.qh:102
if(IS_DEAD(this))
Definition: impulse.qc:92

Definition at line 89 of file log.qh.

◆ LOG_DEBUG

◆ LOG_DEBUGF

#define LOG_DEBUGF (   ...)    _LOG_DEBUG(sprintf(__VA_ARGS__))

◆ LOG_FATAL

◆ LOG_FATALF

◆ LOG_HELP

#define LOG_HELP (   ...)    _LOG_HELP(strcat1n(__VA_ARGS__))

Definition at line 95 of file log.qh.

Referenced by BanCommand_ban(), BanCommand_banlist(), BanCommand_kickban(), BanCommand_mute(), BanCommand_unban(), BanCommand_unmute(), bot_cmdhelp(), bot_list_commands(), Cmd_Scoreboard_Help(), DumpStats(), GameCommand(), GameCommand_adminmsg(), GameCommand_allready(), GameCommand_allspec(), GameCommand_animbench(), GameCommand_anticheat(), GameCommand_bbox(), GameCommand_bot_cmd(), GameCommand_cointoss(), GameCommand_database(), GameCommand_defer_clear(), GameCommand_defer_clear_all(), GameCommand_delrec(), GameCommand_effectindexdump(), GameCommand_extendmatchtime(), GameCommand_gametype(), GameCommand_gettaginfo(), GameCommand_gotomap(), GameCommand_lockteams(), GameCommand_make_mapinfo(), GameCommand_moveplayer(), GameCommand_nospectators(), GameCommand_printstats(), GameCommand_radarmap(), GameCommand_reducematchtime(), GameCommand_resetmatch(), GameCommand_setbots(), GameCommand_shuffleteams(), GameCommand_stuffto(), GameCommand_trace(), GameCommand_unlockteams(), GameCommand_warp(), GENERIC_COMMAND(), GenericCommand_addtolist(), GenericCommand_maplist(), GenericCommand_nextframe(), GenericCommand_removefromlist(), GenericCommand_restartnotifs(), GenericCommand_rpn(), GenericCommand_runtest(), GenericCommand_settemp(), GenericCommand_settemp_restore(), LocalCommand_blurtest(), LocalCommand_boxparticles(), LocalCommand_create_scrshot_ent(), LocalCommand_debugmodel(), LocalCommand_handlevote(), LocalCommand_hud(), LocalCommand_localprint(), LocalCommand_mv_download(), LocalCommand_sendcvar(), W_Model(), and write_String_To_File().

◆ LOG_HELPF

#define LOG_HELPF (   ...)    _LOG_HELP(sprintf(__VA_ARGS__))

◆ LOG_INFO

#define LOG_INFO (   ...)    _LOG_INFO(strcat1n(__VA_ARGS__))

Definition at line 70 of file log.qh.

Referenced by _MapInfo_Generate(), _mutPrintFail(), Accuracy_LoadLevels(), Ban_Insert(), Ban_View(), BanCommand_kickban(), BanCommand_mute(), BanCommand_unmute(), bd_close_editor(), bd_load_level(), bd_move(), bd_save_level(), bot_cmd_debug_assert_canfire(), bot_cmd_eval(), bot_cmd_if(), bot_decodecommand(), bot_execute_commands_once(), bot_getplace(), botframe_autowaypoints_fix(), botframe_autowaypoints_fix_from(), CampaignBailout(), CheatImpulse(), CheckPlayerJump(), Cmd_MapVote_MapDownload(), Cmd_Scoreboard_SetFields(), CommonCommand_editmob(), CSQCPlayer_PredictTo(), Curl_URI_Get_Callback(), GameCommand(), GameCommand_adminmsg(), GameCommand_allready(), GameCommand_allspec(), GameCommand_animbench(), GameCommand_anticheat(), GameCommand_bot_cmd(), GameCommand_database(), GameCommand_defer_clear(), GameCommand_defer_clear_all(), GameCommand_effectindexdump(), GameCommand_gettaginfo(), GameCommand_gotomap(), GameCommand_moveplayer(), GameCommand_printstats(), GameCommand_stuffto(), GameCommand_trace(), GameCommand_warp(), GameItem::GameItem ::show(), GENERIC_COMMAND(), GenericCommand_maplist(), GenericCommand_qc_curl(), GenericCommand_restartnotifs(), GenericCommand_rpn(), GetCvars(), GotoFirstMap(), HUD_Vote(), InitGameplayMode(), LocalCommand_blurtest(), LocalCommand_create_scrshot_ent(), make_mapinfo_Think(), MapInfo_LoadMap(), MapList_LoadMap(), MUTATOR_HOOKFUNCTION(), OnlineBanList_URI_Get_Callback(), Portal_FindSafeOrigin(), Portal_TeleportPlayer(), print_Effect_Index(), QuickMenu_Open(), RadarMap_Make(), RedirectionThink(), REGISTER_MUTATOR(), relocate_spawnpoint(), RemoveTeam(), rpn_get(), rpn_pop(), rpn_push(), rpn_set(), RUN_ALL_TESTS(), sandbox_Database_Load(), Say(), shuffleteams(), Shutdown(), Simple_TeleportPlayer(), spawnfunc(), StartFrame(), teleport_findtarget(), updateCompression(), UpdateNotification_URI_Get_Callback(), URI_Get_Callback(), url_fclose(), url_multi_fopen(), url_multi_ready(), url_single_fopen(), url_URI_Get_Callback(), VoteCommand_checkargs(), W_SetupProjVelocity_Explicit(), W_SetupShot_Dir_ProjectileSize_Range(), WarpZone_PostTeleportPlayer_Callback(), WarpZone_Projectile_Touch(), WarpZone_Teleport(), WarpZone_Touch(), waypoint_clear_start_wp_globals(), waypoint_load_hardwiredlinks(), waypoint_loadall(), waypoint_remove_fromeditor(), waypoint_spawn(), waypoint_spawn_fromeditor(), waypoint_start_hardwiredlink(), waypoint_unreachable(), and WeaponStats_ready().

◆ LOG_INFOF

#define LOG_INFOF (   ...)    _LOG_INFO(sprintf(__VA_ARGS__))

Definition at line 71 of file log.qh.

Referenced by _Movetype_PushMove(), Ban_MaybeEnforceBan(), BanCommand_ban(), BanCommand_kickban(), BanCommand_mute(), BanCommand_unmute(), BGMScript_InitEntity(), bot_decodecommand(), bot_execute_commands_once(), bot_setnameandstuff(), CheckSendCvars(), Close_Clicked(), Cmd_Scoreboard_SetFields(), Create_Notification_Entity(), Create_Notification_Entity_Annce(), Create_Notification_Entity_Choice(), Create_Notification_Entity_InfoCenter(), Create_Notification_Entity_Multi(), CSQC_Ent_Remove(), CSQC_Ent_Update(), CSQC_Parse_CenterPrint(), CSQC_Parse_Print(), CSQC_Parse_StuffCmd(), CSQC_Parse_TempEntity(), CSQCPlayer_ModelAppearance_PostUpdate(), cvar_settemp(), cvar_settemp_restore(), damage_explosion_calcpush(), Dump_Weapon_Settings(), GameCommand_adminmsg(), GameCommand_animbench(), GameCommand_anticheat(), GameCommand_bbox(), GameCommand_bot_cmd(), GameCommand_database(), GameCommand_defer_clear(), GameCommand_delrec(), GameCommand_gametype(), GameCommand_gettaginfo(), GameCommand_gotomap(), GameCommand_moveplayer(), GameCommand_radarmap(), GameCommand_setbots(), GameCommand_stuffto(), GameCommand_trace(), GENERIC_COMMAND(), GenericCommand_addtolist(), GenericCommand_maplist(), GenericCommand_removefromlist(), GenericCommand_restartnotifs(), GenericCommand_settemp(), HUD_Panel_ExportCfg(), LocalCommand_boxparticles(), LocalCommand_handlevote(), LocalCommand_hud(), LocalCommand_localprint(), LocalCommand_mv_download(), LocalCommand_sendcvar(), NET_HANDLE(), Pickup::Pickup ::show(), Process_Notif_Args(), Process_Notif_Line(), QuickMenu_Open(), RadiusDamageForSource(), relocate_nexball(), relocate_spawnpoint(), RUN_ALL_TESTS(), SL_ProcessCategoryOverrides(), spawnfunc(), TEST(), TEST_Run(), turret_draw2d(), URI_Get_Callback(), url_URI_Get_Callback(), View_Ortho(), W_Model(), waypoint_loadall(), waypoint_remove_fromeditor(), waypoint_save_hardwiredlinks(), waypoint_save_links(), waypoint_saveall(), waypoint_spawn_fromeditor(), waypoint_start_hardwiredlink(), and waypoint_unreachable().

◆ LOG_SEVERE

#define LOG_SEVERE (   ...)    _LOG_SEVERE(strcat1n(__VA_ARGS__))

◆ LOG_SEVEREF

#define LOG_SEVEREF (   ...)    _LOG_SEVERE(sprintf(__VA_ARGS__))

Definition at line 63 of file log.qh.

Referenced by MapInfo_LoadMapSettings(), Promise_reject(), Promise_resolve(), and STATIC_INIT().

◆ LOG_TRACE

#define LOG_TRACE (   ...)    _LOG_TRACE(strcat1n(__VA_ARGS__))

Definition at line 81 of file log.qh.

Referenced by _MapInfo_FilterGametype(), _MapInfo_Generate(), _MapInfo_Parse_Settemp(), activate_minigame(), Ban_Insert(), bot_aim(), bot_clearqueue(), CommonCommand_timein(), CSQCModel_AutoTagIndex_Apply(), ctf_DelayedInit(), ctf_FlagThink(), ctf_Handle_Pickup(), cvar_settemp(), DistributeEvenly_Init(), dom_DelayedInit(), draw_Text(), end_minigame(), findnearest(), GameCommand_adminmsg(), GameTypeVote_Finished(), GENERIC_COMMAND(), GenericCommand_settemp(), GenericCommand_settemp_restore(), havocbot_chooserole(), havocbot_moveto(), havocbot_movetogoal(), havocbot_role_ctf_setrole(), havocbot_role_ft_freeing(), havocbot_role_ft_offense(), havocbot_role_kh_carrier(), havocbot_role_kh_defense(), havocbot_role_kh_freelancer(), havocbot_role_kh_offense(), HUD_Main(), invasion_SpawnChosenMonster(), Item_FindTeam(), ItemSend(), LinkDoors(), m_init(), m_keydown(), m_keyup(), MapHasRightSize(), MaplistMethod_Iterate(), MaplistMethod_Random(), MaplistMethod_Repeat(), MaplistMethod_Shuffle(), minigame_read_owner(), MUTATOR_HOOKFUNCTION(), nb_spawnteam(), NET_HANDLE(), nmm_in_mill(), OnlineBanList_URI_Get_Callback(), pathlib_astar(), pathlib_close_node(), pathlib_expandnode_star(), pathlib_walknode(), pathlib_waypointpath(), pathlib_waypointpath_step(), PlayerJump(), prandom(), psrandom(), REGISTER_MUTATOR(), ResetBall(), Shutdown(), skeleton_loadinfo(), Spawn_Score(), start_minigame(), STATIC_INIT(), SUB_NoImpactCheck(), superspec_save_client_conf(), tdm_DelayedInit(), updateConwidths(), UpdateNotification_URI_Get_Callback(), vehicles_exit(), viewloc_PlayerPhysics(), W_Reload(), WarpZone_Touch(), WarpZone_TraceBox_ThroughZone(), WarpZone_TraceToss_ThroughZone(), WarpZoneLib_BoxTouchesBrush_Recurse(), waypoint_load_hardwiredlinks(), waypoint_load_links(), waypoint_loadall(), waypoint_save_hardwiredlinks(), waypoint_spawn(), WinningCondition_LMS(), XonoticResolutionSlider_loadResolutions(), and XonoticStatsList_getStats().

◆ LOG_TRACEF

◆ LOG_WARN

◆ LOG_WARNF

Function Documentation

◆ print_assertfailed_fatal()

void print_assertfailed_fatal ( string  expr)

Definition at line 124 of file log.qh.

References LOG_FATAL.

125 {
126  // this is inside a function to avoid expanding it on compilation everytime
127  LOG_FATAL("assertion failed: `", expr, "`\n");
128 }
#define LOG_FATAL(...)
Definition: log.qh:58

◆ print_assertfailed_severe()

void print_assertfailed_severe ( string  expr)

Definition at line 118 of file log.qh.

References LOG_SEVERE.

119 {
120  // this is inside a function to avoid expanding it on compilation everytime
121  LOG_SEVERE("assertion failed: `", expr, "`\n");
122 }
#define LOG_SEVERE(...)
Definition: log.qh:62

◆ string()

string ( string  ,
string...   
)

Variable Documentation

◆ autocvar_developer

noref int autocvar_developer

◆ autocvar_prvm_backtraceforwarnings

noref bool autocvar_prvm_backtraceforwarnings

Definition at line 103 of file log.qh.