27#define LOGLEVEL_DEFAULT LOGLEVEL_WARNINGS
30#define printf(...) print(sprintf(__VA_ARGS__))
41 print(sprintf(
"^9%f ^7%s\n", time, msg));
43 print(sprintf(
"^7%s\n", msg));
50 print(sprintf(
"^9%f ^1%s^7: %s\n", time, functionName, msg));
52 print(sprintf(
"^1%s^7: %s\n", functionName, msg));
59 print(sprintf(
"^9%f ^3%s^7: %s\n", time, functionName, msg));
61 print(sprintf(
"^3%s^7: %s\n", functionName, msg));
65_NSAssert(
bool condition,
string function,
string descr)
68 print(strcat(
"^1Assertion failed in ", function,
", reason: ", descr,
"\n"));
79#define NSLog(...) if (autocvar_g_logLevel >= LOGLEVEL_DEBUG) _NSLog(sprintf(__VA_ARGS__))
85#define NSError(...) if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSError(__FUNC__, sprintf(__VA_ARGS__))
91#define NSWarning(...) if (autocvar_g_logLevel >= LOGLEVEL_WARNINGS) _NSWarning(__FUNC__, sprintf(__VA_ARGS__))
99#define NSAssert(condition, ...) if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSAssert(condition, __FUNC__, sprintf(__VA_ARGS__))
122 string sideLeft =
"";
123 string sideRight =
"";
125 if (functionName == __NULL__) {
126 NSLog(
"---------------------------------------------------");
131 chars = chars - (int)strlen(functionName) - 2i;
132 charsLeft = chars / 2i;
133 charExtra = chars % 2i;
135 for (
int i = 0i; i < charsLeft; i++)
136 sideLeft = strcat(sideLeft,
"-");
138 for (
int i = 0i; i < (charsLeft + charExtra); i++) {
139 sideRight = strcat(sideRight,
"-");
142 NSLog(
"%s %s %s", sideLeft, functionName, sideRight);
150 error(sprintf(
"Called InitStart() without InitEnd()ing %s!",
g_lastInitFunc));
157#define InitStart() _InitStart(__FUNC__)
162 float endTime = gettime(1);
164 NSLog(
"---------------------------------------------------");
168#define InitEnd() _InitEnd()
171#define entity_def(x, ...) const string x[] = { __VA_ARGS__ }
174#define thread(x) if (fork()) { x; abort(); }
const vector g_vec_null
Definition: global.h:111
var float g_initTime
Definition: global.h:114
var string g_lastInitFunc
Definition: global.h:145
#define LOGLEVEL_DEFAULT
Definition: global.h:27
void _InitStart(string functionName)
Definition: global.h:147
void _NSWarning(string functionName, string msg)
Definition: global.h:56
logLevel_t
Definition: global.h:20
@ LOGLEVEL_NONE
Definition: global.h:21
@ LOGLEVEL_ERRORS
Definition: global.h:22
@ LOGLEVEL_WARNINGS
Definition: global.h:23
@ LOGLEVEL_DEBUG
Definition: global.h:24
void _NSLog(string msg)
Definition: global.h:38
void _NSError(string functionName, string msg)
Definition: global.h:47
var bool autocvar_g_logTimestamps
Definition: global.h:17
searchFlags_t
Definition: global.h:102
@ SEARCH_MULTISEARCH
When set, separating search queries with : will allow for multiple queries in one string.
Definition: global.h:107
@ SEARCH_FORCESEARCH
Search a given game directory even if it's not mounted.
Definition: global.h:106
@ SEARCH_NAMESORT
Sort the results alphabetically (slower)
Definition: global.h:108
@ SEARCH_FULLPACKAGE
Package names include the game directory as a prefix.
Definition: global.h:104
@ SEARCH_INSENSITIVE
Attempt to do a case-insensitive search (slower)
Definition: global.h:103
@ SEARCH_ALLOWDUPES
Do not attempt to remove duplicate results (so you can search through multiple archives)
Definition: global.h:105
var logLevel_t autocvar_g_logLevel
Definition: global.h:28
void _NSAssert(bool condition, string function, string descr)
Definition: global.h:65
void InitPrint(string functionName)
Definition: global.h:117
#define NSLog(...)
Logs an message, with timestamp.
Definition: global.h:79
void _InitEnd(void)
Definition: global.h:160
#define enumflags
Doxygen doesn't know what enumflags (aka bitfields) are, used as e.g.
Definition: global.h:34