vispy.util.logs.
NumPyJSONEncoder
Bases: json.encoder.JSONEncoder
json.encoder.JSONEncoder
default
Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).
o
TypeError
For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
log_exception
Send an exception and traceback to the logger.
This function is used in cases where an exception is handled safely but nevertheless should generate a descriptive error message. An extra line is inserted into the stack trace indicating where the exception was caught.
See set_log_level for options.
set_log_level
The number of traceback entries to ignore, prior to the point where the exception was caught. The default is 2.
Convenience function for setting the logging level
The verbosity of messages to print. If a str, it can be either DEBUG, INFO, WARNING, ERROR, or CRITICAL. Note that these are for convenience and are equivalent to passing in logging.DEBUG, etc. For bool, True is the same as ‘INFO’, False is the same as ‘WARNING’.
String to match. Only those messages that both contain a substring that regexp matches 'match' (and the verbose level) will be displayed.
'match'
verbose
If True, return the old verbosity level and old match.
See also
vispy.util.use_log_level
Notes
If verbose=='debug', then the vispy method emitting the log message will be prepended to each log message, which is useful for debugging. If verbose=='debug' or match is not None, then a small performance overhead is added. Thus it is suggested to only use these options when performance is not crucial.
verbose=='debug'
vispy
match is not None
use_log_level
Bases: object
object
Context manager that temporarily sets logging level
The string to match.
If True, the context manager will keep a record of the logging messages generated by vispy. Otherwise, an empty list will be returned.
If False, printing of (all) messages will be suppressed. This is mainly useful in testing. False only works in record=True mode, if not recording messages, consider setting level appropriately.
As a context manager, an empty list or the list of logging messages will be returned (depending on the input record).
record