]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
log: now in colour
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 13 Dec 2015 03:48:05 +0000 (14:48 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 13 Dec 2015 03:48:05 +0000 (14:48 +1100)
qcsrc/client/main.qc
qcsrc/lib/log.qh
qcsrc/server/bot/waypoints.qc

index 8e9e14a3a6ceaa57d2926bdfb31b9c60ec6116ff..2009388dad4c118856345e04ede9c29b7ad29043 100644 (file)
@@ -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)
index 28323d9307b148c06de47ef05c652b7f2734fffd..a5b46926bcdf4109307f149339b2a166936c80e4 100644 (file)
@@ -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)); \
index fe767b8c93384fa006a53b14321fdb86dbbca15d..f85c8e1cdc7e494f34fce3dba5cbddf79265f47d 100644 (file)
@@ -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;
 }