aboutsummaryrefslogtreecommitdiffstats
path: root/src/extras
diff options
context:
space:
mode:
authorshnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-08-09 20:03:14 +0000
committershnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-08-09 20:03:14 +0000
commitf940691edfca5980b6e5a5e4db6fb4ce64918621 (patch)
tree72008b05ae5b73c5acc7c0c1eb302c3f87e69cc6 /src/extras
parent793b5ef2503a21c68b0b1bbc6ed7c12082d16d67 (diff)
downloadsos-f940691edfca5980b6e5a5e4db6fb4ce64918621.tar.gz
slowly making it work..
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@347 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/extras')
-rwxr-xr-xsrc/extras/htmlog38
1 files changed, 33 insertions, 5 deletions
diff --git a/src/extras/htmlog b/src/extras/htmlog
index 047a70d3..1fbab8bb 100755
--- a/src/extras/htmlog
+++ b/src/extras/htmlog
@@ -38,10 +38,13 @@ class host_class:
def tell(self):
sumsize = 0
if self.log_idx > 0:
- for inc in range(0, self.log_idx - 1):
+ for inc in range(0, self.log_idx):
sumsize += self.logs[inc].size()
- return sumsize + self.logs[self.log_idx].fp.tell()
- return toret
+ try:
+ sumsize += self.fp().tell()
+ except TypeError:
+ pass
+ return sumsize
def size(self):
sumsize = 0
@@ -51,6 +54,7 @@ class host_class:
def eof(self):
if self.tell() >= self.size():
+ sys.exit("HOST IS EOF")
return True
return False
@@ -74,7 +78,7 @@ class host_class:
try:
toret = time.strptime(self.readline()[0:15], "%b %d %H:%M:%S")
except ValueError:
- return None
+ toret = None
self.seek(pos)
return toret
@@ -83,12 +87,23 @@ class host_class:
def readline(self):
if self.eof():
- return None
+ return ""
while True:
toret = self.fp().readline()
+ if len(toret) == 0:
+ if self.log_idx < len(self.logs):
+ self.log_idx += 1
+ self.fp().seek(0)
+ continue
+ else:
+ sys.exit("HOST IS EOF")
+ return ""
+
if self.validate_line(toret) or toret == "":
return toret
+ else:
+ print "invalid line"
def validate_line(self, line):
try:
@@ -138,6 +153,9 @@ class logfile_class:
def seek(self,pos):
self.fp.seek(pos)
+ def tell(self):
+ return self.fp.tell()
+
def parse(self):
self.seek(0)
while not self.eof:
@@ -187,6 +205,16 @@ for logname in __cmdLineOpts__.logfiles:
hosts[log.hostname] = host_class()
hosts[log.hostname].add_log(log)
+#print hosts["moka"].readline()
+#print hosts["moka"].readline()
+#print "DIRECT", hosts["moka"].fp().fp.tell()
+#print "HOST TELL", hosts["moka"].tell()
+#print hosts["moka"].readline()
+#print hosts["moka"].time()
+#print hosts["moka"].readline()
+#print hosts["moka"].time()
+#print hosts["moka"].readline()
+
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">