mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-13 17:13:11 +00:00
ISO 8601
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@455 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
602b2a685e
commit
c15a65c360
10 changed files with 17 additions and 23 deletions
|
|
@ -44,4 +44,3 @@ class BlacklistLogger (Logger):
|
|||
if self.blacklist[url] is None:
|
||||
fd.write(url+"\n")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ class HtmlLogger (StandardLogger):
|
|||
"<br><br>")
|
||||
self.fd.flush()
|
||||
|
||||
|
||||
def newUrl (self, urlData):
|
||||
if self.fd is None: return
|
||||
self.fd.write('<table align=left border=0 cellspacing=0'
|
||||
|
|
@ -116,11 +115,9 @@ class HtmlLogger (StandardLogger):
|
|||
self.fd.write("<tr>"+self.tableerror+linkcheck._("Result")+
|
||||
"</td>"+self.tableerror+
|
||||
urlData.errorString+"</td></tr>\n")
|
||||
|
||||
self.fd.write("</table></td></tr></table><br clear=all><br>")
|
||||
self.fd.flush()
|
||||
|
||||
|
||||
def endOfOutput (self, linknumber=-1):
|
||||
if self.fd is None: return
|
||||
if self.logfield("outro"):
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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'):
|
||||
|
|
|
|||
|
|
@ -110,4 +110,3 @@ class XMLLogger (StandardLogger):
|
|||
self.fd.flush()
|
||||
self.fd = None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue