Kaydet (Commit) 20e8d76d authored tarafından Ozan Çağlayan's avatar Ozan Çağlayan

Use epoch time instead of uptime

üst 439582cd
......@@ -5,6 +5,9 @@
its output and error streams.
* bin/mudur.py (startUdev): Use run_async() for spawning
udevadm monitor instead of buggy start-stop-daemon.
* bin/mudur.py (Logger.sync): Use epoch time instead of
uptime for not reading /proc/uptime for every log attempt.
Use writelines() instead of map().
2009-02-26 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/network.py: Remove useless import.
......
......@@ -164,20 +164,17 @@ def waitBus(unix_name, timeout=5, wait=0.1, stream=True):
class Logger:
def __init__(self):
self.lines = []
self.lines = ["\n"]
def log(self, msg):
stamp = time.strftime("%b %d %H:%M:%S")
try:
up = loadFile("/proc/uptime").split()[0]
except:
up = "..."
self.lines.append("%s (up %s) %s\n" % (stamp, up, msg))
self.lines.append("[%.3f] %s %s\n" % (time.time(), stamp, msg))
def sync(self):
try:
f = file("/var/log/mudur.log", "a")
map(f.write, self.lines)
f = open("/var/log/mudur.log", "a")
self.lines.append("\n")
f.writelines(self.lines)
f.close()
except IOError:
ui.error(_("Cannot write mudur.log, read-only file system"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment