Skip to content

Commit a404a96

Browse files
committed
docs: improve log.dart documentation
1 parent c36ccc3 commit a404a96

File tree

1 file changed

+30
-1
lines changed
  • frontend/app_flowy/packages/appflowy_editor/lib/src/infra

1 file changed

+30
-1
lines changed

frontend/app_flowy/packages/appflowy_editor/lib/src/infra/log.dart

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ enum LogLevel {
1111

1212
typedef LogHandler = void Function(String message);
1313

14+
/// Manages log service for [AppFlowyEditor]
15+
///
16+
/// Set the log level and config the handler depending on your need.
1417
class LogConfiguration {
1518
LogConfiguration._() {
1619
Logger.root.onRecord.listen((record) {
1720
if (handler != null) {
1821
handler!(
19-
'[${record.level.toLogLevel().name}][${record.loggerName}]: ${record.time}: ${record.message}');
22+
'[${record.level.toLogLevel().name}][${record.loggerName}]: ${record.time}: ${record.message}',
23+
);
2024
}
2125
});
2226
}
@@ -36,6 +40,7 @@ class LogConfiguration {
3640
}
3741
}
3842

43+
/// For logging message in AppFlowyEditor
3944
class Log {
4045
Log._({
4146
required this.name,
@@ -44,11 +49,35 @@ class Log {
4449
final String name;
4550
late final Logger _logger;
4651

52+
/// For logging message related to [AppFlowyEditor].
53+
///
54+
/// For example, uses the logger when registering plugins
55+
/// or handling something related to [EditorState].
4756
static Log editor = Log._(name: 'editor');
57+
58+
/// For logging message related to [AppFlowySelectionService].
59+
///
60+
/// For example, uses the logger when updating or clearing selection.
4861
static Log selection = Log._(name: 'selection');
62+
63+
/// For logging message related to [AppFlowyKeyboardService].
64+
///
65+
/// For example, uses the logger when processing shortcut events.
4966
static Log keyboard = Log._(name: 'keyboard');
67+
68+
/// For logging message related to [AppFlowyInputService].
69+
///
70+
/// For example, uses the logger when processing text inputs.
5071
static Log input = Log._(name: 'input');
72+
73+
/// For logging message related to [AppFlowyScrollService].
74+
///
75+
/// For example, uses the logger when processing scroll events.
5176
static Log scroll = Log._(name: 'scroll');
77+
78+
/// For logging message related to UI.
79+
///
80+
/// For example, uses the logger when building the widget.
5281
static Log ui = Log._(name: 'ui');
5382

5483
void error(String message) => _logger.severe(message);

0 commit comments

Comments
 (0)