use logging for exceptions in webserver, check BAM_VERBOSE env var
This commit is contained in:
@@ -35,7 +35,10 @@ del os, sys, path
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger("bam_cli")
|
log = logging.getLogger("bam_cli")
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
|
# if we're a module, don't mess with logging level
|
||||||
|
if __name__ == "__main__":
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
def fatal(msg):
|
def fatal(msg):
|
||||||
|
@@ -58,6 +58,7 @@ def create_from_files(deps):
|
|||||||
f_rel = bpy.path.relpath(f_abs)
|
f_rel = bpy.path.relpath(f_abs)
|
||||||
image = bpy.data.images.load(f)
|
image = bpy.data.images.load(f)
|
||||||
image.use_fake_user = True
|
image.use_fake_user = True
|
||||||
|
deps.append(f_abs)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@@ -13,7 +13,12 @@ Run a single test:
|
|||||||
python3 -m unittest test_cli.BamCommitTest.test_checkout
|
python3 -m unittest test_cli.BamCommitTest.test_checkout
|
||||||
"""
|
"""
|
||||||
|
|
||||||
VERBOSE = 1
|
import os
|
||||||
|
VERBOSE = os.environ.get("VERBOSE", False)
|
||||||
|
if VERBOSE:
|
||||||
|
# for the server subprocess
|
||||||
|
os.environ["BAM_VERBOSE"] = "1"
|
||||||
|
|
||||||
|
|
||||||
# ------------------
|
# ------------------
|
||||||
# Ensure module path
|
# Ensure module path
|
||||||
|
@@ -17,6 +17,12 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
# ***** END GPL LICENCE BLOCK *****
|
||||||
|
|
||||||
|
"""
|
||||||
|
Environment vars:
|
||||||
|
- BAM_VERBOSE, set to get debug logging.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
# ------------------
|
# ------------------
|
||||||
# Ensure module path
|
# Ensure module path
|
||||||
import os
|
import os
|
||||||
@@ -62,7 +68,9 @@ from application.modules.projects import admin
|
|||||||
from application.modules.projects.model import Project, ProjectSetting
|
from application.modules.projects.model import Project, ProjectSetting
|
||||||
|
|
||||||
log = logging.getLogger("webservice")
|
log = logging.getLogger("webservice")
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
|
if os.environ.get("BAM_VERBOSE"):
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
@auth.get_password
|
@auth.get_password
|
||||||
@@ -340,8 +348,8 @@ class FileAPI(Resource):
|
|||||||
import blendfile_pack
|
import blendfile_pack
|
||||||
|
|
||||||
assert(os.path.exists(filepath) and not os.path.isdir(filepath))
|
assert(os.path.exists(filepath) and not os.path.isdir(filepath))
|
||||||
print(" Source path:", filepath)
|
log.info(" Source path: %r" % filepath)
|
||||||
print(" Zip path:", filepath_zip)
|
log.info(" Zip path: %r" % filepath_zip)
|
||||||
|
|
||||||
deps_remap = {}
|
deps_remap = {}
|
||||||
paths_remap = {}
|
paths_remap = {}
|
||||||
@@ -356,8 +364,7 @@ class FileAPI(Resource):
|
|||||||
deps_remap=deps_remap, paths_remap=paths_remap, paths_uuid=paths_uuid,
|
deps_remap=deps_remap, paths_remap=paths_remap, paths_uuid=paths_uuid,
|
||||||
report=report)
|
report=report)
|
||||||
except:
|
except:
|
||||||
import traceback
|
log.exception("Error packing the blend file")
|
||||||
traceback.print_exc()
|
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
# non blend-file
|
# non blend-file
|
||||||
|
Reference in New Issue
Block a user