Logging API
Overview
MatrixOS.Logging writes Matrix OS structured log messages. Use print() for quick Python output while iterating; use MatrixOS.Logging when you want messages grouped by tag and severity in Matrix OS logs.
message is a normal string, not a printf format string.
import MatrixOS
MatrixOS.Logging.info("HelloPython", "settings saved")
MatrixOS.Logging.warning("HelloPython", "storage unavailable")
MatrixOS.Logging.error
error(tag: str, message: str) -> None
Writes an error-level log message.
Parameters:
tag: Short source tag, usually the app or feature name.message: Message text.
MatrixOS.Logging.warning
warning(tag: str, message: str) -> None
Writes a warning-level log message.
Parameters:
tag: Short source tag, usually the app or feature name.message: Message text.
MatrixOS.Logging.info
info(tag: str, message: str) -> None
Writes an info-level log message.
Parameters:
tag: Short source tag, usually the app or feature name.message: Message text.
MatrixOS.Logging.debug
debug(tag: str, message: str) -> None
Writes a debug-level log message.
Parameters:
tag: Short source tag, usually the app or feature name.message: Message text.
MatrixOS.Logging.verbose
verbose(tag: str, message: str) -> None
Writes a verbose-level log message.
Parameters:
tag: Short source tag, usually the app or feature name.message: Message text.
Log An Exception Path
import MatrixOS
TAG = "HelloPython"
if not MatrixOS.FileSystem.available():
# Use warning for recoverable problems the app can explain to a user.
MatrixOS.Logging.warning(TAG, "storage unavailable")
else:
# Use info for normal state changes that are useful while debugging.
MatrixOS.Logging.info(TAG, "storage ready")
Keep tags short and stable.
Comments