start method
Initializes any necessary start-up state that is required for this plugin to run.
This is called once by the plugin server, in PluginServer.initialize,
per analysis context.
Implementation
@override
void start() {
try {
if (_logLevel == Level.OFF) {
return;
}
final timestamp = DateTime.now().millisecondsSinceEpoch;
final logFile = File('bm_lints_$timestamp.log');
// ignore: close_sinks false positive
final sink = _logSink ??= logFile.openWrite();
Logger.root
..level = _logLevel
..clearListeners()
..onRecord.listen(sink.writeln);
// ignore: avoid_catches_without_on_clauses for resiliency
} catch (_) {
// ignore errors
}
}