]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/log.qh
Fix area grid linking/unlinking of triggers and gametype ents in DP master
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / log.qh
index 01ce44408cfead3fa0fae87b027b9d111d9ced95..f33202f939ddaf975aa785b3fdd924372d6e1d11 100644 (file)
@@ -51,7 +51,8 @@ string(string, string...) strcat1n = #115;
 #define _LOG_HEADER(level) "^9[::^7"PROGNAME"^9::"level"^9] ", __SOURCELOC__
 #define _LOG(f, level, s) \
        MACRO_BEGIN \
-               f(strcat1n(_LOG_HEADER(level), "\n^7", s, "\n")); \
+               if (autocvar_developer > 0) f(strcat1n(_LOG_HEADER(level), "\n")); \
+               f(strcat1n("^7", s, "\n")); \
        MACRO_END
 
 #define  LOG_FATAL(...) _LOG_FATAL(strcat1n(__VA_ARGS__))
@@ -70,9 +71,9 @@ string(string, string...) strcat1n = #115;
 #define  LOG_INFOF(...) _LOG_INFO(sprintf(__VA_ARGS__))
 #define _LOG_INFO(s) \
        MACRO_BEGIN \
-               dprint(_LOG_HEADER("^5INFO")); \
+               if (autocvar_developer > 1) dprint(strcat1n(_LOG_HEADER("^5INFO"), "\n")); \
                string __s = s; \
-               print("\n^7", __s); \
+               print("^7", __s); \
                /* TODO: unconditionally add a newline when possible */ \
                if (str2chr(__s, strlen(__s) - 1) != '\n') { print("\n"); } \
        MACRO_END
@@ -90,10 +91,14 @@ string(string, string...) strcat1n = #115;
                if (autocvar_developer > 1) dprint(msg); \
        MACRO_END
 
-// simpler version for help messages
+// same as LOG_INFO but without any debug information that bloats console output and compiled program files
 #define  LOG_HELP(...) _LOG_HELP(strcat1n(__VA_ARGS__))
 #define  LOG_HELPF(...) _LOG_HELP(sprintf(__VA_ARGS__))
-#define _LOG_HELP(s) print("^7", s, "\n")
+#define _LOG_HELP(s) \
+       MACRO_BEGIN \
+               string __s = s; \
+               print("^7", __s, (str2chr(__s, strlen(__s) - 1) != '\n') ? "\n" : ""); \
+       MACRO_END
 
 // TODO: this sucks, lets find a better way to do backtraces?
 #define _backtrace() builtin_remove(NULL)