From da8110a86ad8b57b8c41873d40aeac346ee66b88 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 5 Feb 2015 13:18:06 +0000 Subject: bitbake: toaster: improve logging facilities for toaster This patch improves the logging facilities for toaster in order to help diagnose bugs that happen on user machines. The logs are stored now under "/tmp/toaster_$$" where $$ is a PID-based unique identifier. On shutdown, toaster will automatically erase all logs unless errors are listed in the log file. On error, Toaster provides suggestions on what to do. This patch includes a minor fix found as a result of logging improvements. (Bitbake rev: 8a8248f7b7e30469f592e2f8adbf6ce21e8685c5) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastermain/urls.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'bitbake/lib/toaster/toastermain/urls.py') diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py index 6112067579..f66f11dcde 100644 --- a/bitbake/lib/toaster/toastermain/urls.py +++ b/bitbake/lib/toaster/toastermain/urls.py @@ -23,6 +23,9 @@ from django.conf.urls import patterns, include, url from django.views.generic import RedirectView from django.views.decorators.cache import never_cache +import logging + +logger = logging.getLogger("toaster") # Uncomment the next two lines to enable the admin: from django.contrib import admin @@ -47,10 +50,12 @@ import toastermain.settings if toastermain.settings.FRESH_ENABLED: urlpatterns.insert(1, url(r'', include('fresh.urls'))) + logger.info("Enabled django-fresh extension") if toastermain.settings.DEBUG_PANEL_ENABLED: import debug_toolbar urlpatterns.insert(1, url(r'', include(debug_toolbar.urls))) + logger.info("Enabled django_toolbar extension") if toastermain.settings.MANAGED: @@ -70,4 +75,15 @@ for t in os.walk(os.path.dirname(currentdir)): if "urls.py" in t[2] and t[0] != currentdir: modulename = os.path.basename(t[0]) - urlpatterns.insert(0, url(r'^' + modulename + '/', include ( modulename + '.urls'))) + # make sure we don't have this module name in + conflict = False + for p in urlpatterns: + if p.regex.pattern == '^' + modulename + '/': + conflict = True + if not conflict: + urlpatterns.insert(0, url(r'^' + modulename + '/', include ( modulename + '.urls'))) + else: + logger.warn("Module \'%s\' has a regexp conflict, was not added to the urlpatterns" % modulename) + +from pprint import pformat +logger.debug("urlpatterns list %s", pformat(urlpatterns)) -- cgit v1.2.3-54-g00ecf