Logger is a runtime console for Spark AR. It's based on CustomConsole in ypmits/ARrrrLibTest.
-
Download LoggerUI.arblockpkg and Logger.ts (It's minimized, you can find source codes here)
-
Drag them to your project
-
Drag LoggerUI block to scene
-
Import
Logger
to your script and use it just likeDiagnostics
import Logger from './Logger'; import Time from 'Time'; Logger.log('hi'); Logger.watch('runtime', Time.ms);
-
You can also Click Here to Download Sample Project
Setting | Description |
---|---|
Print Console | The value you log/watch will also show in editor console. |
Log Time | Log timestamp with format HH:mm:ss . |
Expand | Toggle open/close of the default state. |
Size | The window size of Logger. |
Content | DON'T edit this field, it's controlled by script. |
Progress | DON'T edit this field, it's controlled by script. |
If you want to disable Logger, just remove the LoggerUI block in scene or disable the visible of the block. There is a different between above two ways:
- Remove LoggerUI block, all
log
/watch
in your script won't do anything. - Disable the visible of LoggerUI block, all
log
/watch
will work byDiagnostics
.
Please note that this tool CAN'T automatically catch inner error message from Spark AR.
TouchGestures.onPinch();
// If you don't enable the capability in Spark AR, you'll get an error in console but no message in Logger
If you want to catch them, you need to write your own try/catch and log messages with Logger in script.
try {
TouchGestures.onPinch();
} catch (error) {
Logger.log(error.toString());
}
// Wrap it in try/catch so you can print the message both in logger and console.
If this is useful for you, please consider a donation🙏🏼. One-time donations can be made with PayPal.