put gajim application log file in application data/gajim folder. Fixes #4832
This commit is contained in:
parent
53de0bda9a
commit
5194387338
1 changed files with 21 additions and 0 deletions
21
src/gajim.py
21
src/gajim.py
|
@ -155,6 +155,27 @@ del config_path
|
||||||
common.configpaths.gajimpaths.init_profile(profile)
|
common.configpaths.gajimpaths.init_profile(profile)
|
||||||
del profile
|
del profile
|
||||||
|
|
||||||
|
if os.name == 'nt':
|
||||||
|
class MyStderr(object):
|
||||||
|
_file = None
|
||||||
|
_error = None
|
||||||
|
def write(self, text):
|
||||||
|
fname=os.path.join(common.configpaths.gajimpaths.root,
|
||||||
|
os.path.split(sys.executable)[1]+'.log')
|
||||||
|
if self._file is None and self._error is None:
|
||||||
|
try:
|
||||||
|
self._file = open(fname, 'a')
|
||||||
|
except Exception, details:
|
||||||
|
self._error = details
|
||||||
|
if self._file is not None:
|
||||||
|
self._file.write(text)
|
||||||
|
self._file.flush()
|
||||||
|
def flush(self):
|
||||||
|
if self._file is not None:
|
||||||
|
self._file.flush()
|
||||||
|
|
||||||
|
sys.stderr = MyStderr()
|
||||||
|
|
||||||
# PyGTK2.10+ only throws a warning
|
# PyGTK2.10+ only throws a warning
|
||||||
warnings.filterwarnings('error', module='gtk')
|
warnings.filterwarnings('error', module='gtk')
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue