diff options
author | Kok, Auke <auke-jan.h.kok@intel.com> | 2010-01-27 11:34:45 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-01-27 14:15:40 -0800 |
commit | d2322b6309bf15a45002b42e7e6ba3d6b5bfa932 (patch) | |
tree | f0787aec20f98bf514f22e0f403f7496a9fd78c0 /os | |
parent | 0b21a0416b4cb2c32da5e3fda05a0682eb97d56e (diff) |
xserver: Add timestamps to logfile output.
Add timestamps in seconds derived from clock_monotonic to the log
file.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'os')
-rw-r--r-- | os/log.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -258,6 +258,14 @@ LogVWrite(int verb, const char *f, va_list args) { static char tmpBuffer[1024]; int len = 0; + static Bool newline = TRUE; + + if (newline) { + sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0); + len = strlen(tmpBuffer); + if (logFile) + fwrite(tmpBuffer, len, 1, logFile); + } /* * Since a va_list can only be processed once, write the string to a @@ -268,6 +276,7 @@ LogVWrite(int verb, const char *f, va_list args) vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args); len = strlen(tmpBuffer); } + newline = (tmpBuffer[len-1] == '\n'); if ((verb < 0 || logVerbosity >= verb) && len > 0) fwrite(tmpBuffer, len, 1, stderr); if ((verb < 0 || logFileVerbosity >= verb) && len > 0) { |