VulpesOS/gaia/tests/jsmarionette/plugins/marionette-js-logger/index.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

33 lines
1 KiB
JavaScript
Executable file

'use strict';
var LogGrabber = require('./lib/log_grabber').LogGrabber;
/**
* How many log entries should be buffered in the device for our retrieval? The
* obvious trade-off here is between memory and losing log entries. And the
* underlying variables are rate of log generation and how often we poll for new
* logs.
*/
var DEFAULT_LOG_LIMIT = 10000;
function setup(client, options) {
if (!options) {
options = {};
}
var grabber = new LogGrabber(client, options.logLimit || DEFAULT_LOG_LIMIT);
// Note! marionette-js-runner's createHost method uses resetWithDriver every
// time it goes to instantiate us. As a byproduct of this call, all hooks are
// reset, and this is why we don't need to worry about these addHook calls
// redundantly stacking up.
client.addHook('startSession', function(done) {
grabber._connect(done);
});
// deleteSession's hook runs after the session is already torn down, so we
// can't actually do anything at this point.
return grabber;
}
exports.setup = setup;