You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -80,32 +82,35 @@ If you use the `PrettyPrinter`, there are more options:
80
82
```dart
81
83
var logger = Logger(
82
84
printer: PrettyPrinter(
83
-
methodCount: 2, // number of method calls to be displayed
84
-
errorMethodCount: 8, // number of method calls if stacktrace is provided
85
-
lineLength: 120, // width of the output
86
-
colors: true, // Colorful log messages
87
-
printEmojis: true, // Print an emoji for each log message
88
-
printTime: false // Should each log print contain a timestamp
85
+
methodCount: 2, // Number of method calls to be displayed
86
+
errorMethodCount: 8, // Number of method calls if stacktrace is provided
87
+
lineLength: 120, // Width of the output
88
+
colors: true, // Colorful log messages
89
+
printEmojis: true, // Print an emoji for each log message
90
+
printTime: false // Should each log print contain a timestamp
89
91
),
90
92
);
91
93
```
92
94
93
95
### Auto detecting
94
96
95
-
With the `io` package you can auto detect the `lineLength` and `colors` arguments.
96
-
Assuming you have imported the `io` package with `import 'dart:io' as io;` you
97
-
can auto detect `colors` with `io.stdout.supportsAnsiEscapes` and `lineLength`
97
+
With the `io` package you can auto detect the `lineLength` and `colors` arguments.
98
+
Assuming you have imported the `io` package with `import 'dart:io' as io;` you
99
+
can auto detect `colors` with `io.stdout.supportsAnsiEscapes` and `lineLength`
98
100
with `io.stdout.terminalColumns`.
99
101
100
-
You should probably do this unless there's a good reason you don't want to
102
+
You should probably do this unless there's a good reason you don't want to
101
103
import `io`, for example when using this library on the web.
102
104
103
105
## LogFilter
104
106
105
107
The `LogFilter` decides which log events should be shown and which don't.<br>
106
-
The default implementation (`DevelopmentFilter`) shows all logs with `level >= Logger.level` while in debug mode. In release mode all logs are omitted.
108
+
The default implementation (`DevelopmentFilter`) shows all logs with `level >= Logger.level` while
109
+
in debug mode.
110
+
In release mode all logs are omitted.
107
111
108
112
You can create your own `LogFilter` like this:
113
+
109
114
```dart
110
115
class MyFilter extends LogFilter {
111
116
@override
@@ -114,15 +119,16 @@ class MyFilter extends LogFilter {
114
119
}
115
120
}
116
121
```
117
-
This will show all logs even in release mode. (**NOT** a good idea)
118
122
123
+
This will show all logs even in release mode. (**NOT** a good idea)
119
124
120
125
## LogPrinter
121
126
122
127
The `LogPrinter` creates and formats the output, which is then sent to the `LogOutput`.<br>
123
128
You can implement your own `LogPrinter`. This gives you maximum flexibility.
124
129
125
130
A very basic printer could look like this:
131
+
126
132
```dart
127
133
class MyPrinter extends LogPrinter {
128
134
@override
@@ -132,22 +138,26 @@ class MyPrinter extends LogPrinter {
132
138
}
133
139
```
134
140
135
-
If you created a cool `LogPrinter` which might be helpful to others, feel free to open a pull request. :)
141
+
If you created a cool `LogPrinter` which might be helpful to others, feel free to open a pull
142
+
request.
143
+
:)
136
144
137
145
### Colors
138
146
139
-
Please note that all IDEs (VSCode, XCode, Android Studio, IntelliJ) do not
140
-
support ANSI escape sequences in their terminal outputs. These escape sequences
141
-
are used to color output. If using such an IDE do not configure colored output.
147
+
Please note that in some cases ANSI escape sequences do not work under macOS.
148
+
These escape sequences are used to colorize the output.
149
+
This seems to be related to a Flutter bug that affects iOS builds:
150
+
https://github.com/flutter/flutter/issues/64491
142
151
143
-
However, if you are using a JetBrains IDE (Android Studio, IntelliJ, etc.)
144
-
you can make use of the [Grep Console Plugin](https://plugins.jetbrains.com/plugin/7125-grep-console)
145
-
and the [`PrefixPrinter`](/lib/src/printers/prefix_printer.dart)
146
-
decorator to achieved colored logs for any logger:
152
+
However, if you are using a JetBrains IDE (Android Studio, IntelliJ, etc.)
153
+
you can make use of
154
+
the [Grep Console Plugin](https://plugins.jetbrains.com/plugin/7125-grep-console)
155
+
and the [`PrefixPrinter`](/lib/src/printers/prefix_printer.dart)
@@ -167,33 +177,15 @@ class ConsoleOutput extends LogOutput {
167
177
}
168
178
```
169
179
170
-
Possible future `LogOutput`s could send to a file, firebase or to Logcat. Feel free to open pull requests.
171
-
180
+
Possible future `LogOutput`s could send to a file, firebase or to Logcat. Feel free to open pull
181
+
requests.
172
182
173
183
## logger_flutter extension
174
184
175
-
The [logger_flutter](https://pub.dev/packages/logger_flutter) package is an extension for logger. You can add it to any Flutter app. Just shake the phone to show the console.
185
+
The [logger_flutter](https://pub.dev/packages/logger_flutter) package is an extension for logger.
186
+
You can add it to any Flutter app.
187
+
Just shake the phone to show the console.
176
188
189
+
# Acknowledgments
177
190
178
-
## MIT License
179
-
```
180
-
Copyright (c) 2019 Simon Leier
181
-
182
-
Permission is hereby granted, free of charge, to any person obtaining a copy
183
-
of this software and associated documentation files (the "Software"), to deal
184
-
in the Software without restriction, including without limitation the rights
185
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
186
-
copies of the Software, and to permit persons to whom the Software is
187
-
furnished to do so, subject to the following conditions:
188
-
189
-
The above copyright notice and this permission notice shall be included in all
190
-
copies or substantial portions of the Software.
191
-
192
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
193
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
194
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
195
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
196
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
197
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
198
-
SOFTWARE.
199
-
```
191
+
This package was originally created by [Simon Choi](https://github.com/simc).
0 commit comments