added logging
[enigma2-plugins.git] / emailclient / src / __init__.py
1 from Tools.Directories import resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
2 from Components.Language import language
3 from Components.config import config
4 import os, gettext
5 import logging
6
7 lang = language.getLanguage()
8 os.environ["LANGUAGE"] = lang[:2]
9 gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
10 gettext.textdomain("enigma2")
11 gettext.bindtextdomain("EmailClient", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/EmailClient/locale/"))
12
13 def _(txt):
14         t = gettext.dgettext("EmailClient", txt)
15         if t == txt:
16                 t = gettext.gettext(txt)
17         return t
18
19 LOG_FILENAME = '/tmp/EmailClient.log'
20 def initLog():
21         logging.basicConfig(filename=LOG_FILENAME,filemode='w',level=config.plugins.emailimap.debug.value)