Files
BadNote/lib/editor/input/diagnostic_logger.dart
Akiba So d346cc2670
All checks were successful
CI / Windows build (push) Successful in 14m22s
feat: unified shell, diagnostics pack, native Office, sticky board
Make Surface remote debugging and classroom workflows viable: always-on
structured logs with one-click zip export, a single AppShell chrome,
OOXML PPTX/DOCX annotation without LibreOffice, and a first-class sticky
board. Also drop spike/legacy ink widgets and tighten pen feel
(predictor, PenInfoHistory, page-tile layer).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 17:55:27 +08:00

39 lines
1.2 KiB
Dart

// lib/editor/input/diagnostic_logger.dart
//
// Compatibility facade over [BadNoteLog] + [PenEventRing]. The PDF editor's
// toolbar toggle still calls start/stop; globally, [BadNoteLog.start] runs at
// app launch so packaged builds always have a session file.
import 'dart:async';
import '../../diagnostics/badnote_log.dart';
class DiagnosticLogger {
DiagnosticLogger._();
static final DiagnosticLogger instance = DiagnosticLogger._();
bool _verbose = false;
bool get isActive => _verbose || BadNoteLog.instance.path != null;
/// Absolute path of the structured session log (preferred), else null.
String? get path => BadNoteLog.instance.path;
/// Begin a verbose input session (also ensures the global log is running).
Future<void> start() async {
_verbose = true;
await BadNoteLog.instance.start();
BadNoteLog.instance.info(LogSubsystem.diag, 'verbose_input_on');
}
void log(String line) {
BadNoteLog.instance.debug(LogSubsystem.penNative, line);
}
Future<void> stop() async {
if (!_verbose) return;
_verbose = false;
BadNoteLog.instance.info(LogSubsystem.diag, 'verbose_input_off');
await BadNoteLog.instance.flush();
}
}