[CalendarServer-changes] [8498] CalendarServer/trunk/calendarserver/tools/upgrade.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jan 9 14:51:28 PST 2012
Revision: 8498
http://trac.macosforge.org/projects/calendarserver/changeset/8498
Author: dre at apple.com
Date: 2012-01-09 14:51:27 -0800 (Mon, 09 Jan 2012)
Log Message:
-----------
Add time stamps to calendarserver_upgrade output
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/upgrade.py
Modified: CalendarServer/trunk/calendarserver/tools/upgrade.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/upgrade.py 2012-01-09 15:20:44 UTC (rev 8497)
+++ CalendarServer/trunk/calendarserver/tools/upgrade.py 2012-01-09 22:51:27 UTC (rev 8498)
@@ -22,6 +22,7 @@
import os
import sys
+import time
from twisted.python.text import wordWrap
from twisted.python import log
@@ -158,8 +159,28 @@
return UpgraderService(store, options, output, reactor, config)
def onlyUpgradeEvents(event):
- output.write(log.textFromEventDict(event)+"\n")
+ output.write(logDateString()+' '+log.textFromEventDict(event)+"\n")
setLogLevelForNamespace(None, "debug")
log.addObserver(onlyUpgradeEvents)
utilityMain(options["config"], makeService, reactor)
+
+def logDateString():
+ logtime = time.localtime()
+ Y, M, D, h, m, s = logtime[:6]
+ tz = computeTimezoneForLog(time.timezone)
+
+ return '%02d-%02d-%02d %02d:%02d:%02d%s' % (Y, M, D, h, m, s, tz)
+
+def computeTimezoneForLog(tz):
+ if tz > 0:
+ neg = 1
+ else:
+ neg = 0
+ tz = -tz
+ h, rem = divmod(tz, 3600)
+ m, rem = divmod(rem, 60)
+ if neg:
+ return '-%02d%02d' % (h, m)
+ else:
+ return '+%02d%02d' % (h, m)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120109/d4c8803e/attachment.html>
More information about the calendarserver-changes
mailing list