[26076] in Source-Commits
/svn/athena r25377 - in trunk/debathena/debathena/console: . debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Thu Aug 11 14:38:38 2011
Date: Thu, 11 Aug 2011 14:38:31 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201108111838.p7BIcVFC029932@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-08-11 14:38:31 -0400 (Thu, 11 Aug 2011)
New Revision: 25377
Modified:
trunk/debathena/debathena/console/debathena-console
trunk/debathena/debathena/console/debian/changelog
Log:
In console:
* Actually support passing filenames on the command line
* Add a timestamp to each line (c.f. /etc/athena/console)
Modified: trunk/debathena/debathena/console/debathena-console
===================================================================
--- trunk/debathena/debathena/console/debathena-console 2011-08-11 16:29:01 UTC (rev 25376)
+++ trunk/debathena/debathena/console/debathena-console 2011-08-11 18:38:31 UTC (rev 25377)
@@ -8,6 +8,8 @@
import os
import sys
import time
+# We don't get argparse until 2.7 which is natty-only
+from optparse import OptionParser
import gobject
import gtk
@@ -207,7 +209,7 @@
# act like tee, so the logs still end up in .xsession-errors
print data,
text_buffer.insert_with_tags_by_name(text_buffer.get_end_iter(),
- data, tag)
+ time.strftime("%H:%M ", time.localtime()) + data, tag)
text_view.scroll_to_mark(text_buffer.create_mark(None, text_buffer.get_end_iter(), False), 0, False)
@@ -227,10 +229,14 @@
gobject.io_add_watch(f, gobject.IO_IN, got_data, fds[i][0])
def main():
+ parser = OptionParser()
+ parser.add_option("-n","--names", action="store_true", dest="names",
+ default=False, help="Use named files instead of FDs")
+ (opts, args) = parser.parse_args()
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- if len(sys.argv) >= 2:
- ConsoleViewer(fds=[(type, int(fd)) for x in sys.argv[1:]
- for type, fd in [x.split(':')]])
+ if len(args) >= 1:
+ ConsoleViewer(fds=[(type, opts.names and os.open(fname, os.O_RDONLY | os.O_NONBLOCK) or int(fname)) for x in args
+ for type, fname in [x.split(':')]])
else:
ConsoleViewer(fds=[("stdout", 0)])
gtk.main()
Modified: trunk/debathena/debathena/console/debian/changelog
===================================================================
--- trunk/debathena/debathena/console/debian/changelog 2011-08-11 16:29:01 UTC (rev 25376)
+++ trunk/debathena/debathena/console/debian/changelog 2011-08-11 18:38:31 UTC (rev 25377)
@@ -1,3 +1,10 @@
+debathena-console (1.2) unstable; urgency=low
+
+ * Actually support passing filenames on the command line
+ * Add a timestamp to each line (c.f. /etc/athena/console)
+
+ -- Jonathan Reed <jdreed@mit.edu> Thu, 11 Aug 2011 14:38:24 -0400
+
debathena-console (1.1) unstable; urgency=low
* Fix a line that used a variable before defining it.