Custom Code... Console & Errors

How would I send a (date and time stamped) “Hello world!” to the Console in Perceptilabs?

How would I send pysnooper output there?

How would I raise a general or user defined error in the error tab?

Yours, curiously, Julian

Hi @JulianSMoore,
I believe printing or raising errors in the custom code in any component should do just that. Although the prints may currently just be piped to the terminal (if you are running with perceptilabs -v=3) rather than the console.

@robertl Sweet! thanks :smiley:

I’ve now tried it out and yes, with -v=3 I can print to the terminal.

However, seeing my output when -v=3 is difficult.

I wonder whether you are using standard python logging and if so, what the logger is called… so that I could call the logger with an appropriate level spec to cause output to appear with no -v declaration

Or: other suggestions?

What I did was insert this in a convolution component’s code - before the class…

def aFn():
    print('Hello world!')
    import warnings
    warnings.warn('oh dear')

And I can get “Hello world” and a nice warning when aFn is called as part of the convolution _init_

I’d just like to be able to see my output on it’s own somewhere… is that possible?

PS Is there any way to

  • change the verbosity/log level in the terminal
  • clear the terminal output

from within PL, once it has been started?

We are just using the standard python logging library: https://docs.python.org/3/library/logging.html
There are two loggers you can try called:
‘perceptilabs.applogger’
‘perceptilabs.consolelogger’

PS Is there any way to
change the verbosity/log level in the terminal
clear the terminal output
from within PL, once it has been started?

Unfortunately not yet, we are putting most resources into the GUI and modeling part over the terminal messages at the moment, but are planning to circle back and cover some more of these features later down the line.

Thanks for the loggers info. I’ll see what I can do with that.