[chrome-gnome-shell/debug/issue/49] connector: redirect stderr to file



commit d504b43d86505c8ef39873224db8fd1c6d53396f
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Wed Mar 15 22:54:49 2017 +0400

    connector: redirect stderr to file

 connector/chrome-gnome-shell.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/connector/chrome-gnome-shell.py b/connector/chrome-gnome-shell.py
index 5d49acb..a0575c2 100755
--- a/connector/chrome-gnome-shell.py
+++ b/connector/chrome-gnome-shell.py
@@ -23,8 +23,23 @@ import struct
 import sys
 import traceback
 
+
+class Logger(object):
+    def __init__(self, filename="Default.log"):
+        self.terminal = sys.stdout
+        self.log = open(filename, "a")
+
+    def write(self, message):
+        self.terminal.write(message)
+        self.log.write(message)
+
+    def fileno(self):
+        return self.log.fileno()
+
+sys.stderr = Logger("/tmp/cgs-%d-%d.stderr" % (os.getppid(), os.getpid()))
+
 CONNECTOR_VERSION = 8.2
-DEBUG_ENABLED = False
+DEBUG_ENABLED = True
 
 SHELL_SCHEMA = "org.gnome.shell"
 ENABLED_EXTENSIONS_KEY = "enabled-extensions"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]