Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/session/LogWriter.py
blob: 3db45ab60b209fb897d19655dacc212d989b40eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import sys
import dbus

class LogWriter:
	def __init__(self, application):
		self._application = application
		bus = dbus.SessionBus()
		proxy_obj = bus.get_object('com.redhat.Sugar.Logger', '/com/redhat/Sugar/Logger')
		self._logger = dbus.Interface(proxy_obj, 'com.redhat.Sugar.Logger')

	def start(self):
		if os.environ.has_key('SUGAR_USE_CONSOLE'):
			sys.stdout = self
			sys.stderr = self

	def write(self, s):
		self._logger.log(self._application, s, ignore_reply=True)