17var
bool autocvar_g_logTimestamps =
false;
27#define LOGLEVEL_DEFAULT LOGLEVEL_WARNINGS
28var logLevel_t autocvar_g_logLevel = LOGLEVEL_DEFAULT;
30#define printf(...) print(sprintf(__VA_ARGS__))
40 if (autocvar_g_logTimestamps)
41 print(sprintf(
"^9%f ^7%s\n", time, msg));
43 print(sprintf(
"^7%s\n", msg));
47_NSError(
string functionName,
string msg)
49 if (autocvar_g_logTimestamps)
50 print(sprintf(
"^9%f ^1%s^7: %s\n", time, functionName, msg));
52 print(sprintf(
"^1%s^7: %s\n", functionName, msg));
56_NSWarning(
string functionName,
string msg)
58 if (autocvar_g_logTimestamps)
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__))
117InitPrint(
string functionName)
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);
145var
string g_lastInitFunc;
147_InitStart(
string functionName)
150 error(sprintf(
"Called InitStart() without InitEnd()ing %s!", g_lastInitFunc));
152 InitPrint(functionName);
153 g_lastInitFunc = functionName;
154 g_initTime = gettime(1);
157#define InitStart() _InitStart(__FUNC__)
162 float endTime = gettime(1);
163 NSLog(
"loaded in %.1f seconds", (endTime - g_initTime));
164 NSLog(
"---------------------------------------------------");
168#define InitEnd() _InitEnd()
171#define entity_def(x, ...) const string x[] = { __VA_ARGS__ }
174#define thread(x) if (fork()) { x; abort(); }
176#define STRING_SET(x) ((x != __NULL__) && (x != ""))
179fileExists(
string filePath)
182 if not(whichpack(filePath))
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37
noref const vector g_vec_null
Definition: math.h:36