Files
sdk/pkg/analyzer/lib/instrumentation/file_instrumentation.dart
T
Konstantin Shcheglov 9f986d2501 Migrate package:analyzer to null safety.
Change-Id: Iffe4370431587e46a141ddc72a86ceec29c163b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176486
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-01 18:56:04 +00:00

30 lines
794 B
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import 'package:analyzer/instrumentation/instrumentation.dart';
/// An [InstrumentationLogger] that writes to a file (as opposed to an external
/// source or in-memory source etc.)
class FileInstrumentationLogger implements InstrumentationLogger {
final String filePath;
late final IOSink _sink;
FileInstrumentationLogger(this.filePath) {
File file = File(filePath);
_sink = file.openWrite();
}
@override
void log(String message) {
_sink.writeln(message);
}
@override
Future shutdown() async {
await _sink.close();
}
}