mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-03 16:13:34 +08:00
[server] Add output formatting to logprintf
This commit is contained in:
parent
8c9881951e
commit
e79e0ab272
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user