diff options
author | Sebastian Reichel <sre@ring0.de> | 2012-07-31 01:42:10 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2012-07-31 01:42:10 +0200 |
commit | 44a70a656c994d1a6edc021355dc506e8a98e7a4 (patch) | |
tree | 5963f3b81ceb63223e6377a895a396768aa9b1cf | |
parent | 63f3f8502ae035886ee190cf3f57b68d43b35009 (diff) | |
download | microcopterd-44a70a656c994d1a6edc021355dc506e8a98e7a4.tar.bz2 |
print log entries with timestamp
-rw-r--r-- | log.vala | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,16 +1,21 @@ namespace Log { private unowned FileStream file; private FileStream fileowner; + private long start_timestamp; public void init() { + TimeVal time = {0}; + time.get_current_time(); + set_file(cfg.get_string("config", "logfile")); GLib.Log.set_default_handler(log_handler); + start_timestamp = time.tv_sec; } private void log_handler(string? domain, LogLevelFlags flags, string message) { TimeVal time = {0}; time.get_current_time(); - string s = "%.10ld | %15s | %s\n".printf(time.tv_usec, domain, message); + string s = "%.10ld | %15s | %s\n".printf(time.tv_sec - start_timestamp, domain, message); if(file != null) { file.printf(s); |