mirror of
https://github.com/dashr9230/SA-MP.git
synced 2026-10-11 01:38:17 +08:00
[server] Add output formatting to logprintf
This commit is contained in:
1 parent
8c9881951e
commit
e79e0ab272
1 file changed
+21
@@ -285,7 +285,28 @@ void logprintf(char* format, ...)
|
||||
puts(output);
|
||||
fflush(stdout);
|
||||
#else
|
||||
if (pConsole && pConsole->GetBoolVariable("output"))
|
||||
{
|
||||
puts(buffer);
|
||||
}
|
||||
#endif
|
||||
if (pLogFile) {
|
||||
if (pConsole) {
|
||||
if (pConsole->GetBoolVariable("timestamp"))
|
||||
{
|
||||
const struct tm *tm;
|
||||
time_t now;
|
||||
now = time(NULL);
|
||||
tm = localtime(&now);
|
||||
char s[256];
|
||||
strftime(s, 256, pConsole->GetStringVariable("logtimeformat"), tm);
|
||||
fprintf(pLogFile, "%s %s\n", s, buffer);
|
||||
}
|
||||
else fprintf(pLogFile, "%s\n", buffer);
|
||||
}
|
||||
else fprintf(pLogFile, "%s\n", buffer);
|
||||
fflush(pLogFile);
|
||||
}
|
||||
|
||||
// TODO: logprintf
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user