Isotropix Forums

Specifying Log Level In Python-Embedded Clarisse

Clarisse Scripting related topics

Specifying Log Level In Python-Embedded Clarisse

Unread postby mati » Mon Jun 03, 2019 8:46 pm

Hi,

I'm followed these steps to run Clarisse in batch mode: https://clarissewiki.com/4.0/sdk/claris ... ython.html

Is there a way to set the log level when I'm launching Clarisse in this way? I'm getting more output to the shell than I want at the moment.

Thank you!
mati
 
Posts: 26
Joined: Fri Apr 19, 2019 8:35 pm

Re: Specifying Log Level In Python-Embedded Clarisse

Unread postby dcourtois » Tue Jun 04, 2019 3:21 pm

Hi,
You can control the log level using this function:

python code

# backup the current level
previous_level = ix.api.CoreLogHandler.main_handler().get_log_level()

# disable all logs (even print from Python)
ix.api.CoreLogHandler.main_handler().set_log_level(0)
print("I will not be printed :[")

# and you can restore the level
ix.api.CoreLogHandler.main_handler().set_log_level(previous_level)
print("Yay, logs are back !!")


Log levels go from 0 (completely silent) to 9 (most verbose):
  • 0: Fatal errors (e.g. when there is a crash)
  • 1: Errors
  • 2: Warnings
  • 3: Infos (Python's print uses this level if I'm not mistaken)
  • 4-9: Debug information
User avatar
dcourtois
 
Posts: 34
Joined: Tue Jul 25, 2017 3:15 pm

Re: Specifying Log Level In Python-Embedded Clarisse

Unread postby mati » Fri Jun 21, 2019 4:51 am

This worked for us. Thanks!
mati
 
Posts: 26
Joined: Fri Apr 19, 2019 8:35 pm


Return to Scripting