Added logger module
This commit is contained in:
parent
414b0a95fd
commit
c6c0774ec5
@ -3,11 +3,15 @@ import os
|
|||||||
import gettext
|
import gettext
|
||||||
import locale
|
import locale
|
||||||
import sys
|
import sys
|
||||||
|
import logging
|
||||||
from platform_utils import paths
|
from platform_utils import paths
|
||||||
|
|
||||||
|
log = logging.getLogger("i18n")
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
lang = locale.getdefaultlocale()[0]
|
lang = locale.getdefaultlocale()[0]
|
||||||
os.environ["lang"] = lang
|
os.environ["lang"] = lang
|
||||||
|
log.debug("System detected language: {0}".format(lang,))
|
||||||
if sys.version[0] == "3":
|
if sys.version[0] == "3":
|
||||||
gettext.install("musicdl", localedir=os.path.join(paths.app_path(), "locales"))
|
gettext.install("musicdl", localedir=os.path.join(paths.app_path(), "locales"))
|
||||||
else:
|
else:
|
||||||
|
17
src/main.py
17
src/main.py
@ -1,23 +1,28 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals # at top of module
|
from __future__ import unicode_literals # at top of module
|
||||||
|
import os
|
||||||
|
import logging
|
||||||
|
import storage
|
||||||
|
storage.setup()
|
||||||
|
logging.basicConfig(filename=os.path.join(storage.data_directory, "info.log"), level=logging.DEBUG, filemode="w")
|
||||||
|
log = logging.getLogger("main")
|
||||||
|
log.debug("Logger initialized. Saving debug to {0}".format(storage.data_directory,))
|
||||||
|
log.debug("Starting music-dl %s" % (application.version,))
|
||||||
|
log.debug("Application path is %s" % (paths.app_path(),))
|
||||||
import sys
|
import sys
|
||||||
|
log.debug("Using Python version {0}".format(sys.version,))
|
||||||
if sys.version[0] == "2":
|
if sys.version[0] == "2":
|
||||||
if hasattr(sys, "frozen"):
|
if hasattr(sys, "frozen"):
|
||||||
|
log.debug("Applying fixes for Python 2 frozen executables.")
|
||||||
import fixes
|
import fixes
|
||||||
fixes.setup()
|
fixes.setup()
|
||||||
import i18n
|
import i18n
|
||||||
i18n.setup()
|
i18n.setup()
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import logging
|
|
||||||
import application
|
import application
|
||||||
from platform_utils import paths
|
from platform_utils import paths
|
||||||
|
|
||||||
logging.basicConfig()
|
|
||||||
log = logging.getLogger("main")
|
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
log.debug("Starting music-dl %s" % (application.version,))
|
|
||||||
log.debug("Application path is %s" % (paths.app_path(),))
|
|
||||||
from controller import mainController
|
from controller import mainController
|
||||||
app = widgetUtils.mainLoopObject()
|
app = widgetUtils.mainLoopObject()
|
||||||
log.debug("Created Application mainloop object")
|
log.debug("Created Application mainloop object")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user