Skip to content

Commit fad8535

Browse files
committed
Rename DebugFilter to DevelopmentFilter
The name `DebugFilter` often caused confusing where users thought it would actually display all log messages. While Flutter uses the term 'debug' build this is not used in the wider Dart community. Especially when talking about a logs the name 'debug' is overloaded with the old class name. The new name reflects clearly when you should be using this filter.
1 parent 8dae0e8 commit fad8535

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ import `io`, for example when using this library on the web.
102102
## LogFilter
103103

104104
The `LogFilter` decides which log events should be shown and which don't.<br>
105-
The default implementation (`DebugFilter`) shows all logs with `level >= Logger.level` while in debug mode. In release mode all logs are omitted.
105+
The default implementation (`DevelopmentFilter`) shows all logs with `level >= Logger.level` while in debug mode. In release mode all logs are omitted.
106106

107107
You can create your own `LogFilter` like this:
108108
```dart

lib/src/filters/debug_filter.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import 'package:logger/src/logger.dart';
22
import 'package:logger/src/log_filter.dart';
33

4-
/// Default implementation of [LogFilter].
4+
/// Prints all logs with `level >= Logger.level` while in development mode (eg
5+
/// when `assert`s are evaluated, Flutter calls this debug mode).
56
///
6-
/// Prints all logs with `level >= Logger.level` while in debug mode. In release
7-
/// mode all logs are omitted.
8-
class DebugFilter extends LogFilter {
7+
/// In release mode ALL logs are omitted.
8+
class DevelopmentFilter extends LogFilter {
99
@override
1010
bool shouldLog(LogEvent event) {
1111
var shouldLog = false;

lib/src/log_filter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:logger/src/logger.dart';
22

33
/// An abstract filter of log messages.
44
///
5-
/// You can implement your own `LogFilter` or use [DebugFilter].
5+
/// You can implement your own `LogFilter` or use [DevelopmentFilter].
66
/// Every implementation should consider [Logger.level].
77
abstract class LogFilter {
88
Level level;

lib/src/logger.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ class Logger {
5454
/// Create a new instance of Logger.
5555
///
5656
/// You can provide a custom [printer], [filter] and [output]. Otherwise the
57-
/// defaults: [PrettyPrinter], [DebugFilter] and [ConsoleOutput] will be
57+
/// defaults: [PrettyPrinter], [DevelopmentFilter] and [ConsoleOutput] will be
5858
/// used.
5959
Logger({
6060
LogFilter filter,
6161
LogPrinter printer,
6262
LogOutput output,
6363
Level level,
64-
}) : _filter = filter ?? DebugFilter(),
64+
}) : _filter = filter ?? DevelopmentFilter(),
6565
_printer = printer ?? PrettyPrinter(),
6666
_output = output ?? ConsoleOutput() {
6767
_filter.init();

0 commit comments

Comments
 (0)