Allow users to configure message logs
Arising in Feature #3569: it would be good to provide a way to allow users to disable warning messages, e.g. from ixsl:set-property.
We should also think generally about allowing users to configure the message logs from Saxon-JS (i.e. console logs in the browser). Saxon-CE provided a debug version, which could be configured to run various logging levels - e.g. off, and full tracing.
#1 Updated by Debbie Lockett 3 months ago
Saxon-JS produces log messages when saxonPrint is called. Currently these can be grouped as:
A. Loading log (i.e. "Saxon-JS 1.x in browser")
B. Transform initialization logs (i.e. "Transform options supplied:...", "SEF generated by Saxon-EE version..."
C. Warning logs (e.g. from ixsl:set-property, and xsl:result-document)
D. Processing logs* (e.g. messages about HTTP processing, adding to docPool local cache, loading categories.json)
- I always have been unsure whether these should be included or not. I've found them useful in development, but it's hard to tell whether these are useful or unwanted by other users. Also I think sometimes we've just left our internal debugging messages in by mistake.
Internally in Saxon-JS we have an evaluateWithTracing version of the evaluate function, which can be used during development (it produces XML output as the SEF is processed). It may be useful to allow users to switch on this tracing, as an additional "high level" of logging.
So I propose using the following logging levels:
-1 Loading log only
0 Transform initialization logs
1 [Default] Warning logs
2 Processing logs
10 Full tracing
Setting the logLevel to x allows logs from level x and lower only. So setting the level to 0 switches off warnings; setting the level to 2 or higher adds some processing messages; and setting to 10 provides full tracing.
Potentially, we may want to add further levels of processing messages, between 2 and 10 (hence leaving a gap). Though you'd probably want to add processing messages for different areas, and these might not fit so well on a numeric scale... Note that Saxon-CE used named levels e.g. OFF, SEVERE, WARNING, FINE, FINER, FINEST. I think the numbers currently make some sense, but would welcome feedback (and as noted, might not be so easily extendable).
To set the logLevel, we could introduce a SaxonJS method SaxonJS.setLogLevel, and/or a SaxonJS.transform option. Note that both mechanisms were available with Saxon-CE (using the Saxon.setLogLevel function and Command.logLevel property, respectively). So I'm inclined to add both for Saxon-JS too. Note that level -1 can only be set with SaxonJS.setLogLevel (it is too late with a SaxonJS.transform option.)
#6 Updated by Debbie Lockett 3 months ago
- Status changed from In Progress to Resolved
- Fix Committed on JS Branch 1.0, Trunk added
It's been agreed that the design looks OK: the scale is a little odd, but there are reasons behind the choice!
"logLevel" JS unit tests committed (setting logLevel using SaxonJS.setLogLevel() and logLevel transform option).
Please register to edit this issue