[elbe-devel] [PATCH 05/32] Add logging to db for projectmanager
dion at linutronix.de
dion at linutronix.de
Fri Jun 14 22:13:19 CEST 2019
From: Olivier Dion <dion at linutronix.de>
'ElbeDB::load_project' seems to be the root of the creation of the log
path. Thus, the logging object is created there.
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
elbepack/db.py | 3 ++-
elbepack/projectmanager.py | 10 ++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/elbepack/db.py b/elbepack/db.py
index f2333c87..75fbd3dd 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -36,6 +36,7 @@ from sqlalchemy.exc import OperationalError
from elbepack.elbeproject import ElbeProject
from elbepack.elbexml import (ElbeXML, ValidationMode)
from elbepack.dosunix import dos2unix
+from elbepack.log import log
Base = declarative_base()
@@ -455,7 +456,6 @@ class ElbeDB(object):
def load_project(
self,
builddir,
- logpath=None,
url_validation=ValidationMode.CHECK_ALL):
# pass exceptions if hook-scripts can't be loaded (they're optional)
@@ -492,6 +492,7 @@ class ElbeDB(object):
p = s.query(Project). \
filter(Project.builddir == builddir).one()
+ log.new(os.path.join(builddir, "log.txt"))
return ElbeProject(p.builddir, name=p.name, logpath=logpath,
postbuild_file=postbuild_file,
presh_file=presh_file,
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 49cc2945..df644fd4 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -107,9 +107,8 @@ class ProjectManager(object):
raise
# Open the new project
- logpath = path.join(builddir, "log.txt")
- ep = self.db.load_project(
- builddir, logpath, url_validation=url_validation)
+ ep = self.db.load_project(builddir,
+ url_validation=url_validation)
self.userid2project[userid] = ep
self.builddir2userid[builddir] = userid
@@ -139,9 +138,8 @@ class ProjectManager(object):
self._close_current_project(userid)
# Load project from the database
- logpath = path.join(builddir, "log.txt")
- ep = self.db.load_project(
- builddir, logpath, url_validation=url_validation)
+ ep = self.db.load_project(builddir,
+ url_validation=url_validation)
# Add project to our dictionaries
self.userid2project[userid] = ep
--
2.11.0
More information about the elbe-devel
mailing list