Problem
An app cannot quieten jsartoolkitNFT's console output. setLogLevel() only reaches part of
it, and only after start-up. Measured with 1.13.0, default build, in Chrome:
| Output |
Emitted by |
Affected by setLogLevel()? |
[info] Page[0] pre: …, [info] Tracked page 0 (max 1)., [info] Tracking lost on page 0. |
ARToolKit ARLOG (WASM) |
Yes. At ARLogLevel.Warn, 8 frames of a two-target photo print 0 lines instead of 18, with the same detections. |
ℹ️[webarkit-info:]…, e.g. Continuous detection: on, Detection interval: 300 ms, add NFT marker-> …, Reading /markerNFT_0.fset3, init ARToolKitNFT constructor... |
WebARKitLib's own logger (WASM) |
No. Still printed at ARLogLevel.Warn, although getLogLevel() returns 2. |
ARToolkitNFT 1.13.0 |
console.info in the ARToolkitNFT constructor |
No (plain JS) |
[ARControllerNFT] ARToolkitNFT initialized, … Camera params loaded with ID 0, … Got ID from setup 0 |
console.log in ARControllerNFT._initialize() |
No (plain JS) |
add nft marker ids: [0] |
console.log in ARToolkitNFT.addNFTMarkers() |
No (plain JS) |
*** Camera Parameter ***, SIZE = 320, 240, the distortion and camera matrix dump, setCamera(): arParamLTCreated |
ARLOG / parameter display during _initialize() |
Cannot be tested: printed before an app can call setLogLevel() |
The timing is the main blocker. initWithDimensions() / initWithImage() run _initialize()
and only then hand the controller back. setLogLevel() is an instance method that needs
this.artoolkitNFT, which does not exist before _initialize(). customInit() runs its
callback earlier, but also too early for that instance to exist. So every app starts with
about 20 console lines it cannot turn off.
Suggested fix
- A log level at initialisation. For example an optional
options argument,
initWithDimensions(w, h, cameraParam, internalLuma, { logLevel }), or a static
ARControllerNFT.setDefaultLogLevel(level) that _initialize() applies as soon as the
ARToolkitNFT instance exists, before loadCamera() / setup().
- One level for WebARKit's logger too.
setLogLevel() (and the start-up option) should
also set the level of WebARKitLib's webarkit-info logger. Alternatively, expose a separate
setter for it.
- Route the JS logs through the level. The version line, the
[ARControllerNFT] … lines
and add nft marker ids should respect the level, e.g. through a small logger that checks
it. The version could be logged once at RelInfo so it can still be kept.
Context
Aframe-nft now calls setLogLevel() as soon as it
gets the controller (default warn). That silences the per-frame tracking lines but leaves
everything in the other rows of the table.
Problem
An app cannot quieten jsartoolkitNFT's console output.
setLogLevel()only reaches part ofit, and only after start-up. Measured with 1.13.0, default build, in Chrome:
setLogLevel()?[info] Page[0] pre: …,[info] Tracked page 0 (max 1).,[info] Tracking lost on page 0.ARLOG(WASM)ARLogLevel.Warn, 8 frames of a two-target photo print 0 lines instead of 18, with the same detections.ℹ️[webarkit-info:]…, e.g.Continuous detection: on,Detection interval: 300 ms,add NFT marker-> …,Reading /markerNFT_0.fset3,init ARToolKitNFT constructor...ARLogLevel.Warn, althoughgetLogLevel()returns 2.ARToolkitNFT 1.13.0console.infoin theARToolkitNFTconstructor[ARControllerNFT] ARToolkitNFT initialized,… Camera params loaded with ID 0,… Got ID from setup 0console.loginARControllerNFT._initialize()add nft marker ids: [0]console.loginARToolkitNFT.addNFTMarkers()*** Camera Parameter ***,SIZE = 320, 240, the distortion and camera matrix dump,setCamera(): arParamLTCreatedARLOG/ parameter display during_initialize()setLogLevel()The timing is the main blocker.
initWithDimensions()/initWithImage()run_initialize()and only then hand the controller back.
setLogLevel()is an instance method that needsthis.artoolkitNFT, which does not exist before_initialize().customInit()runs itscallback earlier, but also too early for that instance to exist. So every app starts with
about 20 console lines it cannot turn off.
Suggested fix
optionsargument,initWithDimensions(w, h, cameraParam, internalLuma, { logLevel }), or a staticARControllerNFT.setDefaultLogLevel(level)that_initialize()applies as soon as theARToolkitNFTinstance exists, beforeloadCamera()/setup().setLogLevel()(and the start-up option) shouldalso set the level of WebARKitLib's
webarkit-infologger. Alternatively, expose a separatesetter for it.
[ARControllerNFT] …linesand
add nft marker idsshould respect the level, e.g. through a small logger that checksit. The version could be logged once at
RelInfoso it can still be kept.Context
Aframe-nft now calls
setLogLevel()as soon as itgets the controller (default
warn). That silences the per-frame tracking lines but leaveseverything in the other rows of the table.