diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-04-24 22:09:05 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-04-24 22:09:05 +0200 |
commit | 7505d442626381200cd998a03df87b5f688d4c99 (patch) | |
tree | 3b45626a7e5d418a133d1106e2148c3a36c60d45 /uzbl.c | |
parent | ee54b47b4a24cbea013ab86a2c65454a5a0a8776 (diff) |
prepend log entries with date in "%Y-%m-%d %H:%M:%S" format for easy grepping
Diffstat (limited to 'uzbl.c')
-rw-r--r-- | uzbl.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -59,7 +59,14 @@ log_history_cb () { if (output_file == NULL) { fprintf(stderr, "Cannot open %s for logging\n", history_file); } else { - fprintf(output_file, "%s\n",uri); //TODO prepend date in Y-m-d H:i:s format for easy grepping :) + time_t rawtime; + struct tm * timeinfo; + char buffer [80]; + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); + strftime (buffer,80,"%Y-%m-%d %H:%M:%S",timeinfo); + + fprintf(output_file, "%s %s\n",buffer, uri); fclose(output_file); } } |