#Logging
Adaptable logs warnings and diagnostics — a misconfigured group column, a column id that doesn't exist, an AdaptableQL expression that fails to evaluate — to the browser console. The logs are off by default: you turn them on per channel when you need them, for example to track down a configuration problem or to share the output with our support team.
A few critical messages, such as license problems, don't go through channels — they are always written to the console.
#Enabling logging
Logging is controlled by the debug key in localStorage. Set it in the
browser console and reload the page:
localStorage.debug = 'Adaptable:Logs';Adaptable:Logs is the recommended setting: it shows every message meant for
developers, from all Adaptable instances on the page. The other channels are
internal and much noisier — useful mainly when our support team asks for them.
To turn logging off again, remove the key:
localStorage.removeItem('debug');#Channels
Adaptable and Infinite Table share the same logging utility (the debug export
of @infinite-table/infinite-vue, inspired by the
debug package). Messages are written to
channels — names made of segments separated by : — and the debug value
selects the channels to show.
Adaptable's messages go to Adaptable:Logs:<Type>, where the type is Info,
Warn, Error or Success. Messages from a specific instance add its id:
Adaptable:Logs:Warn:id=<adaptableId>.
debug value | Shows |
|---|---|
Adaptable:Logs | All Adaptable log messages, from every instance |
Adaptable:Logs:Warn | Only warnings (likewise Info, Error, Success) |
Adaptable:Logs:*:id=<adaptableId> | All log messages of one Adaptable instance |
Adaptable:Logs:Error:id=<adaptableId> | Only the errors of one Adaptable instance |
Adaptable:* | Everything Adaptable logs, including internal channels |
* | Everything — Adaptable and Infinite Table |
A value matches a channel and all channels below it, so Adaptable:Logs also
matches Adaptable:Logs:Warn:id=grid1. A * in the middle matches any
segments in between, as long as the channel ends with what follows the *.
Combine several values with commas, and exclude a channel by prefixing it with
-. The first value that matches a channel decides (values without a * are
checked before those with one), so put exclusions before the values they carve
out of:
// errors and warnings only
localStorage.debug = 'Adaptable:Logs:Error,Adaptable:Logs:Warn';
// every log message, except info
localStorage.debug = '-Adaptable:Logs:Info,Adaptable:Logs';* also turns on Infinite Table's internal channels, which log on every render
and scroll — expect a lot of output.
#Logging from your code
adaptableApi.loggerApi writes to the same channels, tagged with your
instance's id — handy for messages that should show up next to Adaptable's own:
adaptableApi.loggerApi.info('Loaded 10,000 rows'); // Adaptable:Logs:Info:id=<adaptableId>
adaptableApi.loggerApi.warn('Unknown region in the data');
adaptableApi.loggerApi.error('Failed to save the layout');
adaptableApi.loggerApi.success('Layout saved');
// logs the message only once per page load
adaptableApi.loggerApi.warnOnce('Using the fallback price feed');Each method has a *Once variant (infoOnce, warnOnce, errorOnce,
successOnce), which takes an optional second argument: the key that identifies
the message (defaults to the message itself).