From c15a65c360636221096b3689ff6b9a80d597d77d Mon Sep 17 00:00:00 2001 From: calvin Date: Sun, 2 Jun 2002 14:10:57 +0000 Subject: [PATCH] ISO 8601 git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@455 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/log/BlacklistLogger.py | 1 - linkcheck/log/CSVLogger.py | 1 - linkcheck/log/ColoredLogger.py | 2 -- linkcheck/log/GMLLogger.py | 4 ---- linkcheck/log/HtmlLogger.py | 3 --- linkcheck/log/Logger.py | 2 -- linkcheck/log/SQLLogger.py | 2 -- linkcheck/log/StandardLogger.py | 2 -- linkcheck/log/XMLLogger.py | 1 - linkcheck/log/__init__.py | 22 +++++++++++++++++----- 10 files changed, 17 insertions(+), 23 deletions(-) diff --git a/linkcheck/log/BlacklistLogger.py b/linkcheck/log/BlacklistLogger.py index 07ce9391..ffc8e401 100644 --- a/linkcheck/log/BlacklistLogger.py +++ b/linkcheck/log/BlacklistLogger.py @@ -44,4 +44,3 @@ class BlacklistLogger (Logger): if self.blacklist[url] is None: fd.write(url+"\n") - diff --git a/linkcheck/log/CSVLogger.py b/linkcheck/log/CSVLogger.py index e600eaca..1fda1806 100644 --- a/linkcheck/log/CSVLogger.py +++ b/linkcheck/log/CSVLogger.py @@ -75,7 +75,6 @@ class CSVLogger (StandardLogger): urlData.cached)) self.fd.flush() - def endOfOutput (self, linknumber=-1): if self.fd is None: return self.stoptime = time.time() diff --git a/linkcheck/log/ColoredLogger.py b/linkcheck/log/ColoredLogger.py index 14b84cfd..b4d928b4 100644 --- a/linkcheck/log/ColoredLogger.py +++ b/linkcheck/log/ColoredLogger.py @@ -129,7 +129,6 @@ class ColoredLogger (StandardLogger): self.colorreset+"\n") self.fd.flush() - def endOfOutput (self, linknumber=-1): if self.fd is None: return if self.logfield("outro"): @@ -137,4 +136,3 @@ class ColoredLogger (StandardLogger): self.fd.write("o\n") StandardLogger.endOfOutput(self, linknumber=linknumber) - diff --git a/linkcheck/log/GMLLogger.py b/linkcheck/log/GMLLogger.py index 1b002609..28c647fb 100644 --- a/linkcheck/log/GMLLogger.py +++ b/linkcheck/log/GMLLogger.py @@ -40,7 +40,6 @@ class GMLLogger (StandardLogger): self.fd.write("graph [\n directed 1\n") self.fd.flush() - def newUrl (self, urlData): """write one node and all possible edges""" if self.fd is None: return @@ -62,7 +61,6 @@ class GMLLogger (StandardLogger): self.fd.write(" ]\n") self.writeEdges() - def writeEdges (self): """write all edges we can find in the graph in a brute-force manner. Better would be a mapping of parent urls. @@ -80,7 +78,6 @@ class GMLLogger (StandardLogger): self.fd.write(" ]\n") self.fd.flush() - def endOfOutput (self, linknumber=-1): if self.fd is None: return self.fd.write("]\n") @@ -100,4 +97,3 @@ class GMLLogger (StandardLogger): self.fd.flush() self.fd = None - diff --git a/linkcheck/log/HtmlLogger.py b/linkcheck/log/HtmlLogger.py index 032e5bd8..95e2b12e 100644 --- a/linkcheck/log/HtmlLogger.py +++ b/linkcheck/log/HtmlLogger.py @@ -58,7 +58,6 @@ class HtmlLogger (StandardLogger): "

") self.fd.flush() - def newUrl (self, urlData): if self.fd is None: return self.fd.write('"+self.tableerror+linkcheck._("Result")+ ""+self.tableerror+ urlData.errorString+"\n") - self.fd.write("


") self.fd.flush() - def endOfOutput (self, linknumber=-1): if self.fd is None: return if self.logfield("outro"): diff --git a/linkcheck/log/Logger.py b/linkcheck/log/Logger.py index f3638b53..27310248 100644 --- a/linkcheck/log/Logger.py +++ b/linkcheck/log/Logger.py @@ -21,13 +21,11 @@ class Logger: if "all" not in args['fields']: self.logfields = args['fields'] - def logfield (self, name): if self.logfields is None: return 1 return name in self.logfields - def init (self): raise Exception, "abstract function" diff --git a/linkcheck/log/SQLLogger.py b/linkcheck/log/SQLLogger.py index 510c97df..91807186 100644 --- a/linkcheck/log/SQLLogger.py +++ b/linkcheck/log/SQLLogger.py @@ -26,7 +26,6 @@ class SQLLogger (StandardLogger): self.dbname = args['dbname'] self.separator = args['separator'] - def init (self): if self.fd is None: return self.starttime = time.time() @@ -81,4 +80,3 @@ class SQLLogger (StandardLogger): self.fd.flush() self.fd = None - diff --git a/linkcheck/log/StandardLogger.py b/linkcheck/log/StandardLogger.py index 2f1ff644..9048a7e2 100644 --- a/linkcheck/log/StandardLogger.py +++ b/linkcheck/log/StandardLogger.py @@ -64,7 +64,6 @@ __init__(self, **args) else: self.fd = sys.stdout - def init (self): if self.fd is None: return self.starttime = time.time() @@ -122,7 +121,6 @@ __init__(self, **args) self.fd.write(urlData.errorString+"\n") self.fd.flush() - def endOfOutput (self, linknumber=-1): if self.fd is None: return if self.logfield('outro'): diff --git a/linkcheck/log/XMLLogger.py b/linkcheck/log/XMLLogger.py index d555cc5d..b4b57eb4 100644 --- a/linkcheck/log/XMLLogger.py +++ b/linkcheck/log/XMLLogger.py @@ -110,4 +110,3 @@ class XMLLogger (StandardLogger): self.fd.flush() self.fd = None - diff --git a/linkcheck/log/__init__.py b/linkcheck/log/__init__.py index 16fc98fb..1a1534bd 100644 --- a/linkcheck/log/__init__.py +++ b/linkcheck/log/__init__.py @@ -15,11 +15,22 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# return formatted time -def strtime (t): - return time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(t)) +import time -import time, linkcheck +def strtime (t): + """return ISO 8601 formatted time""" + return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(t)) + \ + strtimezone() + +def strtimezone (): + """return timezone info, %z on some platforms, but not supported on all""" + if time.daylight: + zone = time.altzone + else: + zone = time.timezone + return "%+04d" % int(-zone/3600) + +import linkcheck LogFields = { "realurl": "Real URL", @@ -35,7 +46,9 @@ LogFields = { "checktime": "Check Time", "url": "URL", } +# maximum indent for localized log field names MaxIndent = max(map(lambda x: len(linkcheck._(x)), LogFields.values()))+1 +# map with spaces between field name and value Spaces = {} for key,value in LogFields.items(): Spaces[key] = " "*(MaxIndent - len(linkcheck._(value))) @@ -62,4 +75,3 @@ Loggers = { } # for easy printing: a comma separated logger list LoggerKeys = reduce(lambda x, y: x+", "+y, Loggers.keys()) -