Skip to content

Commit

Permalink
Added option to show only warnings and errors in the log.
Browse files Browse the repository at this point in the history
  • Loading branch information
reattiva committed Mar 20, 2016
1 parent ff83d32 commit ee3070d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions io_mesh_urho/__init__.py
Expand Up @@ -285,6 +285,7 @@ def reset(self, context):
addonPrefs = context.user_preferences.addons[__name__].preferences

self.minimize = False
self.onlyErrors = False
self.showDirs = False

self.useSubDirs = True
Expand Down Expand Up @@ -371,6 +372,11 @@ def reset_paths(self, context, forced):
description = "Minimize the export panel",
default = False)

onlyErrors = BoolProperty(
name = "Log errors",
description = "Show only warnings and errors in the log",
default = False)

showDirs = BoolProperty(
name = "Show dirs",
description = "Show the dirs list",
Expand Down Expand Up @@ -846,6 +852,7 @@ def draw(self, context):
#split = layout.split(percentage=0.1)
if sys.platform.startswith('win'):
row.operator("wm.console_toggle", text="", icon='CONSOLE')
row.prop(settings, "onlyErrors", text="", icon='FORCE_WIND')
row.operator("urho.report", text="", icon='TEXT')
if settings.minimize:
return
Expand Down Expand Up @@ -1290,6 +1297,11 @@ def ExecuteUrhoExport(context):

settings.errorsMem.Clear()

if settings.onlyErrors:
log.setLevel(logging.WARNING)
else:
log.setLevel(logging.DEBUG)

if not settings.outputPath:
log.error( "Output path is not set" )
return False
Expand Down Expand Up @@ -1422,6 +1434,7 @@ def ExecuteAddon(context):
startTime = time.time()
print("----------------------Urho export start----------------------")
ExecuteUrhoExport(context)
log.setLevel(logging.DEBUG)
log.info("Export ended in {:.4f} sec".format(time.time() - startTime) )

bpy.ops.urho.report('INVOKE_DEFAULT')
Expand Down

0 comments on commit ee3070d

Please sign in to comment.