From: TimePath Date: Sun, 13 Dec 2015 03:48:05 +0000 (+1100) Subject: log: now in colour X-Git-Tag: xonotic-v0.8.2~1494 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=278c051f3e12cc972ea8b9b7eb8ad8c09b4947cd;p=xonotic%2Fxonotic-data.pk3dir.git log: now in colour --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 8e9e14a3a..2009388da 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -42,6 +42,11 @@ void CSQC_Init() LOG_INFOF("^4CSQC Build information: ^1%s\n", WATERMARK); #endif + // needs to be done so early because of the constants they create + static_init(); + static_init_late(); + static_init_precache(); + binddb = db_create(); tempdb = db_create(); ClientProgsDB = db_load("client.db"); @@ -93,11 +98,6 @@ void CSQC_Init() GetTeam(NUM_SPECTATOR, true); // add specs first - // needs to be done so early because of the constants they create - static_init(); - static_init_late(); - static_init_precache(); - // precaches if(autocvar_cl_reticle) diff --git a/qcsrc/lib/log.qh b/qcsrc/lib/log.qh index 28323d930..a5b46926b 100644 --- a/qcsrc/lib/log.qh +++ b/qcsrc/lib/log.qh @@ -33,20 +33,20 @@ string(string...) strcat0n = #115; #define _LOG(f, level, s) \ MACRO_BEGIN { \ - f(sprintf("[::"level "] ["__FILE__ ":%s:%d] %s", __FUNC__, __LINE__, s)); \ + f(sprintf("^9[::"level "^9] ["__FILE__ "^7:^9%s^7:^9%d] \n^7%s\n", __FUNC__, __LINE__, s)); \ } MACRO_END #define LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__)) #define LOG_FATALF(...) _LOG_FATAL(sprintf(__VA_ARGS__)) -#define _LOG_FATAL(s) _LOG(error, "FATAL", s) +#define _LOG_FATAL(s) _LOG(error, "^1FATAL", s) #define LOG_SEVERE(...) _LOG_SEVERE(strcat0n(__VA_ARGS__)) #define LOG_SEVEREF(...) _LOG_SEVERE(sprintf(__VA_ARGS__)) -#define _LOG_SEVERE(s) _LOG(backtrace, "SEVERE", s) +#define _LOG_SEVERE(s) _LOG(backtrace, "^1SEVERE", s) #define LOG_WARNING(...) _LOG_WARNING(strcat0n(__VA_ARGS__)) #define LOG_WARNINGF(...) _LOG_WARNING(sprintf(__VA_ARGS__)) -#define _LOG_WARNING(s) _LOG(print, "WARNING", s) +#define _LOG_WARNING(s) _LOG(print, "^3WARNING", s) #define LOG_INFO(...) _LOG_INFO(strcat0n(__VA_ARGS__)) #define LOG_INFOF(...) _LOG_INFO(sprintf(__VA_ARGS__)) @@ -54,18 +54,18 @@ string(string...) strcat0n = #115; MACRO_BEGIN { \ string ___s = s; \ if (autocvar_developer) \ - _LOG(print, "INFO", ___s); \ + _LOG(print, "^5INFO", ___s); \ else \ print(___s); \ } MACRO_END #define LOG_TRACE(...) _LOG_TRACE(strcat0n(__VA_ARGS__)) #define LOG_TRACEF(...) _LOG_TRACE(sprintf(__VA_ARGS__)) -#define _LOG_TRACE(s) _LOG(dprint, "TRACE", s) +#define _LOG_TRACE(s) _LOG(dprint, "^6TRACE", s) #define LOG_DEBUG(...) _LOG_DEBUG(strcat0n(__VA_ARGS__)) #define LOG_DEBUGF(...) _LOG_DEBUG(sprintf(__VA_ARGS__)) -#define _LOG_DEBUG(s) _LOG(dprint2, "DEBUG", s) +#define _LOG_DEBUG(s) _LOG(dprint2, "^2DEBUG", s) #define dprint2(msg) \ MACRO_BEGIN { \ @@ -97,7 +97,7 @@ noref bool autocvar_prvm_backtraceforwarnings; bool war = autocvar_prvm_backtraceforwarnings; \ bt_cvar_set("developer", "1"); \ bt_cvar_set("prvm_backtraceforwarnings", "1"); \ - print("\n--- CUT HERE ---\n", msg, "\n"); \ + print("\n--- CUT HERE ---\n", msg); \ _backtrace(); \ print("\n--- CUT UNTIL HERE ---\n"); \ bt_cvar_set("developer", ftos(dev)); \ diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index fe767b8c9..f85c8e1cd 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -451,11 +451,7 @@ float waypoint_load_links() fclose(file); - LOG_TRACE("loaded "); - LOG_TRACE(ftos(c)); - LOG_TRACE(" waypoint links from maps/"); - LOG_TRACE(mapname); - LOG_TRACE(".waypoints.cache\n"); + LOG_TRACE("loaded ", ftos(c), " waypoint links from maps/", mapname, ".waypoints.cache\n"); botframe_cachedwaypointlinks = true; return true; @@ -475,9 +471,7 @@ void waypoint_load_links_hardwired() if (file < 0) { - LOG_TRACE("waypoint links load from "); - LOG_TRACE(filename); - LOG_TRACE(" failed\n"); + LOG_TRACE("waypoint links load from ", filename, " failed\n"); return; } @@ -548,11 +542,7 @@ void waypoint_load_links_hardwired() fclose(file); - LOG_TRACE("loaded "); - LOG_TRACE(ftos(c)); - LOG_TRACE(" waypoint links from maps/"); - LOG_TRACE(mapname); - LOG_TRACE(".waypoints.hardwired\n"); + LOG_TRACE("loaded ", ftos(c), " waypoint links from maps/", mapname, ".waypoints.hardwired\n"); } entity waypoint_get_link(entity w, float i) @@ -712,19 +702,11 @@ float waypoint_loadall() cwb = cwb + 1; } fclose(file); - LOG_TRACE("loaded "); - LOG_TRACE(ftos(cwp)); - LOG_TRACE(" waypoints and "); - LOG_TRACE(ftos(cwb)); - LOG_TRACE(" wayboxes from maps/"); - LOG_TRACE(mapname); - LOG_TRACE(".waypoints\n"); + LOG_TRACE("loaded ", ftos(cwp), " waypoints and ", ftos(cwb), " wayboxes from maps/", mapname, ".waypoints\n"); } else { - LOG_TRACE("waypoint load from "); - LOG_TRACE(filename); - LOG_TRACE(" failed\n"); + LOG_TRACE("waypoint load from ", filename, " failed\n"); } return cwp + cwb; }