mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Added date/time stamps option to console log
This commit is contained in:
parent
68ac97e82a
commit
afa8124301
1 changed files with 12 additions and 0 deletions
|
|
@ -275,6 +275,7 @@ S32 gObjectCopyFailures = -1;
|
|||
|
||||
bool alwaysUseDebugOutput = true;
|
||||
bool useTimestamp = false;
|
||||
bool useRealTimestamp = false;
|
||||
|
||||
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
|
||||
|
||||
|
|
@ -374,6 +375,10 @@ void init()
|
|||
addVariable("Con::useTimestamp", TypeBool, &useTimestamp, "If true a timestamp is prepended to every console message.\n"
|
||||
"@ingroup Console\n");
|
||||
|
||||
// controls whether a real date and time is prepended to every console message
|
||||
addVariable("Con::useRealTimestamp", TypeBool, &useRealTimestamp, "If true a date and time will be prepended to every console message.\n"
|
||||
"@ingroup Console\n");
|
||||
|
||||
// Plug us into the journaled console input signal.
|
||||
smConsoleInput.notify(postConsoleInput);
|
||||
}
|
||||
|
|
@ -612,6 +617,13 @@ static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, co
|
|||
buffer[i] = ' ';
|
||||
}
|
||||
|
||||
if (useRealTimestamp)
|
||||
{
|
||||
Platform::LocalTime lt;
|
||||
Platform::getLocalTime(lt);
|
||||
offset += dSprintf(buffer + offset, sizeof(buffer) - offset, "[%d/%d/%d %02d:%02d:%02d]", lt.monthday, lt.month + 1, lt.year + 1900, lt.hour, lt.min, lt.sec);
|
||||
}
|
||||
|
||||
if (useTimestamp)
|
||||
{
|
||||
static U32 startTime = Platform::getRealMilliseconds();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue