Skip to content

Commit 8a7a81b

Browse files
committed
Formatted
1 parent 2a047d4 commit 8a7a81b

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

README.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ Inspired by [logger](https://github.com/orhanobut/logger) for Android.
1313
**Show some ❤️ and star the repo to support the project**
1414

1515
### Resources:
16+
1617
- [Documentation](https://pub.dev/documentation/logger/latest/logger/logger-library.html)
1718
- [Pub Package](https://pub.dev/packages/logger)
1819
- [GitHub Repository](https://github.com/Bungeefan/logger)
1920

2021
## Getting Started
2122

2223
Just create an instance of `Logger` and start logging:
24+
2325
```dart
2426
var logger = Logger();
2527
@@ -77,32 +79,35 @@ If you use the `PrettyPrinter`, there are more options:
7779
```dart
7880
var logger = Logger(
7981
printer: PrettyPrinter(
80-
methodCount: 2, // number of method calls to be displayed
81-
errorMethodCount: 8, // number of method calls if stacktrace is provided
82-
lineLength: 120, // width of the output
83-
colors: true, // Colorful log messages
84-
printEmojis: true, // Print an emoji for each log message
85-
printTime: false // Should each log print contain a timestamp
82+
methodCount: 2, // Number of method calls to be displayed
83+
errorMethodCount: 8, // Number of method calls if stacktrace is provided
84+
lineLength: 120, // Width of the output
85+
colors: true, // Colorful log messages
86+
printEmojis: true, // Print an emoji for each log message
87+
printTime: false // Should each log print contain a timestamp
8688
),
8789
);
8890
```
8991

9092
### Auto detecting
9193

92-
With the `io` package you can auto detect the `lineLength` and `colors` arguments.
93-
Assuming you have imported the `io` package with `import 'dart:io' as io;` you
94-
can auto detect `colors` with `io.stdout.supportsAnsiEscapes` and `lineLength`
94+
With the `io` package you can auto detect the `lineLength` and `colors` arguments.
95+
Assuming you have imported the `io` package with `import 'dart:io' as io;` you
96+
can auto detect `colors` with `io.stdout.supportsAnsiEscapes` and `lineLength`
9597
with `io.stdout.terminalColumns`.
9698

97-
You should probably do this unless there's a good reason you don't want to
99+
You should probably do this unless there's a good reason you don't want to
98100
import `io`, for example when using this library on the web.
99101

100102
## LogFilter
101103

102104
The `LogFilter` decides which log events should be shown and which don't.<br>
103-
The default implementation (`DevelopmentFilter`) 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
106+
in debug mode.
107+
In release mode all logs are omitted.
104108

105109
You can create your own `LogFilter` like this:
110+
106111
```dart
107112
class MyFilter extends LogFilter {
108113
@override
@@ -111,15 +116,16 @@ class MyFilter extends LogFilter {
111116
}
112117
}
113118
```
114-
This will show all logs even in release mode. (**NOT** a good idea)
115119

120+
This will show all logs even in release mode. (**NOT** a good idea)
116121

117122
## LogPrinter
118123

119124
The `LogPrinter` creates and formats the output, which is then sent to the `LogOutput`.<br>
120125
You can implement your own `LogPrinter`. This gives you maximum flexibility.
121126

122127
A very basic printer could look like this:
128+
123129
```dart
124130
class MyPrinter extends LogPrinter {
125131
@override
@@ -129,7 +135,9 @@ class MyPrinter extends LogPrinter {
129135
}
130136
```
131137

132-
If you created a cool `LogPrinter` which might be helpful to others, feel free to open a pull request. :)
138+
If you created a cool `LogPrinter` which might be helpful to others, feel free to open a pull
139+
request.
140+
:)
133141

134142
### Colors
135143

@@ -144,7 +152,7 @@ decorator to achieved colored logs for any logger:
144152

145153
```dart
146154
var logger = Logger(
147-
printer: PrefixPrinter(PrettyPrinter(colors: false))
155+
printer: PrefixPrinter(PrettyPrinter(colors: false))
148156
);
149157
```
150158

@@ -164,12 +172,14 @@ class ConsoleOutput extends LogOutput {
164172
}
165173
```
166174

167-
Possible future `LogOutput`s could send to a file, firebase or to Logcat. Feel free to open pull requests.
168-
175+
Possible future `LogOutput`s could send to a file, firebase or to Logcat. Feel free to open pull
176+
requests.
169177

170178
## logger_flutter extension
171179

172-
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.
180+
The [logger_flutter](https://pub.dev/packages/logger_flutter) package is an extension for logger.
181+
You can add it to any Flutter app.
182+
Just shake the phone to show the console.
173183

174184
# Acknowledgments
175185

0 commit comments

Comments
 (0)