Options for logging time stamps

This commit is contained in:
Kiooeht 2011-05-12 13:09:30 -07:00
parent beea65b5d1
commit 2678d78812
3 changed files with 46 additions and 14 deletions

View file

@ -18,6 +18,7 @@ Bugs
* Issues with connecting? Client not closing connection right? People keep getting "nick taken" messages * Issues with connecting? Client not closing connection right? People keep getting "nick taken" messages
* Windows XP SP2: sometimes mouse clicks dont register? must be some kinda crash * Windows XP SP2: sometimes mouse clicks dont register? must be some kinda crash
* When using mood sort, scroll position jumps to last selected chum * When using mood sort, scroll position jumps to last selected chum
* When switching chumhandles, OP doesn't appear to retain OP status (though they do)
Mac Bugs Mac Bugs
-------- --------

View file

@ -696,9 +696,17 @@ class PesterOptions(QtGui.QDialog):
layout_3.addWidget(self.sortBox, 10) layout_3.addWidget(self.sortBox, 10)
self.logpesterscheck = QtGui.QCheckBox("Log all Pesters", self) self.logpesterscheck = QtGui.QCheckBox("Log all Pesters", self)
self.logpesterscheck.setChecked(self.config.logPesters()) if self.config.logPesters() & self.config.LOG:
self.logpesterscheck.setChecked(True)
self.logmemoscheck = QtGui.QCheckBox("Log all Memos", self) self.logmemoscheck = QtGui.QCheckBox("Log all Memos", self)
self.logmemoscheck.setChecked(self.config.logMemos()) if self.config.logMemos() & self.config.LOG:
self.logmemoscheck.setChecked(True)
self.stamppestercheck = QtGui.QCheckBox("Log Time Stamps for Pesters", self)
if self.config.logPesters() & self.config.STAMP:
self.stamppestercheck.setChecked(True)
self.stampmemocheck = QtGui.QCheckBox("Log Time Stamps for Memos", self)
if self.config.logMemos() & self.config.STAMP:
self.stampmemocheck.setChecked(True)
self.idleBox = QtGui.QSpinBox(self) self.idleBox = QtGui.QSpinBox(self)
self.idleBox.setStyleSheet("background:#FFFFFF") self.idleBox.setStyleSheet("background:#FFFFFF")
@ -798,6 +806,8 @@ class PesterOptions(QtGui.QDialog):
layout_logs.setAlignment(QtCore.Qt.AlignTop) layout_logs.setAlignment(QtCore.Qt.AlignTop)
layout_logs.addWidget(self.logpesterscheck) layout_logs.addWidget(self.logpesterscheck)
layout_logs.addWidget(self.logmemoscheck) layout_logs.addWidget(self.logmemoscheck)
layout_logs.addWidget(self.stamppestercheck)
layout_logs.addWidget(self.stampmemocheck)
self.pages.addWidget(widget) self.pages.addWidget(widget)
# Idle # Idle

View file

@ -88,18 +88,28 @@ class PesterLog(object):
self.logpath = _datadir+"logs" self.logpath = _datadir+"logs"
def log(self, handle, msg): def log(self, handle, msg):
if handle[0] == '#': if self.parent.config.time12Format():
if not self.parent.config.logMemos(): return time = strftime("[%I:%M")
else: else:
if not self.parent.config.logPesters(): return time = strftime("[%H:%M")
if self.parent.config.showSeconds():
time += strftime(":%S] ")
else:
time += "] "
if handle[0] == '#':
if not self.parent.config.logMemos() & self.parent.config.LOG: return
if not self.parent.config.logMemos() & self.parent.config.STAMP:
time = ""
else:
if not self.parent.config.logPesters() & self.parent.config.LOG: return
if not self.parent.config.logPesters() & self.parent.config.STAMP:
time = ""
if str(handle).upper() == "NICKSERV": return if str(handle).upper() == "NICKSERV": return
#watch out for illegal characters #watch out for illegal characters
handle = re.sub(r'[<>:"/\\|?*]', "_", handle) handle = re.sub(r'[<>:"/\\|?*]', "_", handle)
#time = strftime("[%H:%M:%S] ") bbcodemsg = time + convertTags(msg, "bbcode")
# no time codes in logs html = time + convertTags(msg, "html")+"<br />"
bbcodemsg = convertTags(msg, "bbcode") msg = time +convertTags(msg, "text")
html = convertTags(msg, "html")+"<br />"
msg = convertTags(msg, "text")
modes = {"bbcode": bbcodemsg, "html": html, "text": msg} modes = {"bbcode": bbcodemsg, "html": html, "text": msg}
if not self.convos.has_key(handle): if not self.convos.has_key(handle):
time = datetime.now().strftime("%Y-%m-%d.%H.%M") time = datetime.now().strftime("%Y-%m-%d.%H.%M")
@ -267,6 +277,9 @@ class pesterTheme(dict):
class userConfig(object): class userConfig(object):
def __init__(self, parent): def __init__(self, parent):
self.parent = parent self.parent = parent
# Use for bit flag log setting
self.LOG = 1
self.STAMP = 2
if sys.platform != "darwin": if sys.platform != "darwin":
self.filename = "pesterchum.js" self.filename = "pesterchum.js"
else: else:
@ -345,9 +358,9 @@ class userConfig(object):
self.set("onlineNumbers", False) self.set("onlineNumbers", False)
return self.config.get('onlineNumbers', False) return self.config.get('onlineNumbers', False)
def logPesters(self): def logPesters(self):
return self.config.get('logPesters', True) return self.config.get('logPesters', self.LOG | self.STAMP)
def logMemos(self): def logMemos(self):
return self.config.get('logMemos', True) return self.config.get('logMemos', self.LOG)
def disableUserLinks(self): def disableUserLinks(self):
return not self.config.get('userLinks', True) return not self.config.get('userLinks', True)
def idleTime(self): def idleTime(self):
@ -2414,11 +2427,19 @@ class PesterWindow(MovingWindow):
self.chumList.hideOnlineNumbers() self.chumList.hideOnlineNumbers()
self.config.set("onlineNumbers", onlinenumsetting) self.config.set("onlineNumbers", onlinenumsetting)
# logging # logging
logpesterssetting = self.optionmenu.logpesterscheck.isChecked() logpesterssetting = 0
if self.optionmenu.logpesterscheck.isChecked():
logpesterssetting = logpesterssetting | self.config.LOG
if self.optionmenu.stamppestercheck.isChecked():
logpesterssetting = logpesterssetting | self.config.STAMP
curlogpesters = self.config.logPesters() curlogpesters = self.config.logPesters()
if logpesterssetting != curlogpesters: if logpesterssetting != curlogpesters:
self.config.set('logPesters', logpesterssetting) self.config.set('logPesters', logpesterssetting)
logmemossetting = self.optionmenu.logmemoscheck.isChecked() logmemossetting = 0
if self.optionmenu.logmemoscheck.isChecked():
logmemossetting = logmemossetting | self.config.LOG
if self.optionmenu.stampmemocheck.isChecked():
logmemossetting = logmemossetting | self.config.STAMP
curlogmemos = self.config.logMemos() curlogmemos = self.config.logMemos()
if logmemossetting != curlogmemos: if logmemossetting != curlogmemos:
self.config.set('logMemos', logmemossetting) self.config.set('logMemos', logmemossetting)