Skip to content

Commit 21b7e35

Browse files
committed
chore: move omitLog docs to network logger
1 parent 6361ecc commit 21b7e35

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lib/src/modules/network_logger.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ class NetworkLogger {
4343
_manager.setObfuscateLogCallback(callback);
4444
}
4545

46+
/// Registers a callback to selectively omit network log data.
47+
///
48+
/// Use this method to set a callback function that determines whether
49+
/// specific network log data should be excluded before recording it.
50+
///
51+
/// The [callback] function takes a [NetworkData] object as its argument and
52+
/// should return a boolean value indicating whether the data should be omitted
53+
/// (`true`) or included (`false`).
54+
///
55+
/// Example:
56+
///
57+
/// ```dart
58+
/// NetworkLogger.omitLog((data) {
59+
/// // Implement logic to decide whether to omit the data.
60+
/// // For example, ignore requests to a specific URL:
61+
/// return data.url.startsWith('https://example.com');
62+
/// });
63+
/// ```
4664
static void omitLog(OmitLogCallback callback) {
4765
_manager.setOmitLogCallback(callback);
4866
}

lib/src/utils/network_manager.dart

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ class NetworkManager {
2929
return _obfuscateLogCallback!(data);
3030
}
3131

32-
/// Registers a callback to selectively omit network log data.
33-
///
34-
/// Use this method to set a callback function that determines whether
35-
/// specific network log data should be excluded before recording or displaying it.
36-
///
37-
/// The [callback] function takes a [NetworkData] object as its argument and
38-
/// should return a boolean value indicating whether the data should be omitted
39-
/// (true) or included (false).
40-
///
41-
/// Example:
42-
///
43-
/// ```dart
44-
/// NetworkLogger.omitLog((data) {
45-
/// // Implement logic to decide whether to omit the data.
46-
/// // For example, check if it contains a specific keyword and return false, otherwise return true.
47-
/// return someCondition ? true : false;
48-
/// });
49-
/// ```
5032
FutureOr<bool> omitLog(NetworkData data) {
5133
if (_omitLogCallback == null) {
5234
return false;

0 commit comments

Comments
 (0)