LogsDebugTab
The Logs tab: the app's own logcat, with a live tail, filters, and a plain-text export, under /api/v1/logs/. The app gives it no data source: the tab runs logcat for its own process.
Register it from debug code, as the Network tab:
Lustro.builder(app).addTab(LogsDebugTab.create()).build().start()The tab reads logcat from Lustro.start() to Lustro.stop(), also while the app is in the background. It starts with the lines that the process wrote before, from its start. It holds the newest lines in a buffer of bufferBytes on the app's heap, and folds a line that repeats the one before into a count.
In the console, the tab shows a live tail of the log, with filters for the level, the tag, and the message. GET /api/v1/logs/_schema describes its routes.
logcat keeps at most about 4 KB of a message. When the app has a logger of its own, the logger can also give its lines to append, in full, and name their tags with appendedTags of create, so that the tab drops the cut copies that come from logcat, from the first append of each tag on:
val logs = LogsDebugTab.create(appendedTags = { it == "MyApp" })
// In the app's logger, before it writes the line to logcat:
logs.append(Log.DEBUG, "MyApp", message)Types
Factory for LogsDebugTab.
Functions
Adds a line that the app's own logger writes, with its whole text, to the lines from logcat. The console, GET entries, and GET text show it as one line, with the time, the process, and the thread of this call.
The view's static shell; logs.js and logs.css in the assets fill and style it.