Skip to content

Commit

Permalink
Really fix logger
Browse files Browse the repository at this point in the history
  • Loading branch information
vbousquet committed Aug 22, 2023
1 parent faea25e commit 18a093c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions addons/vpx_lightmapper/vlm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,19 @@ def get_render_proj_ar(context):


def run_with_logger(op):
#log_handler = logging.FileHandler(bpy.path.abspath("//vlm.log"))
log_handler = logging.handlers.RotatingFileHandler(bpy.path.abspath("//vlm.log"), maxBytes=(1024*1024*4), backupCount=3)
#file_handler = logging.FileHandler(bpy.path.abspath("//vlm.log"))
file_handler = logging.handlers.RotatingFileHandler(bpy.path.abspath("//vlm.log"), maxBytes=(1024*1024*4), backupCount=3)
stream_handler = logging.StreamHandler()
try:
#while logger.hasHandlers():
# logger.removeHandler(logger.handlers[0])
logger.addHandler(log_handler)
logger.addHandler(logging.StreamHandler())
logger.addHandler(file_handler)
logger.addHandler(stream_handler)
return op()
except Exception as e:
logger.error(e)
return {'CANCELLED'}
finally:
logger.removeHandler(log_handler)
logger.removeHandler(logging.StreamHandler())
logger.removeHandler(file_handler)
logger.removeHandler(stream_handler)


# 3D tri area ABC is half the length of AB cross product AC
Expand Down

0 comments on commit 18a093c

Please sign in to comment.