Skip to content

Commit 77109cc

Browse files
authored
Merge pull request #1 from Bungeefan/master
update version
2 parents 69fd282 + 2ec1283 commit 77109cc

34 files changed

+398
-221
lines changed

.github/workflows/dart.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,46 @@
1-
name: Dart CI
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# See documentation here:
7+
# https://github.com/dart-lang/setup-dart/blob/main/README.md
8+
9+
name: Dart
210

311
on:
412
push:
5-
branches: [ master ]
13+
branches: [ "master" ]
614
pull_request:
7-
branches: [ master ]
15+
branches: [ "master" ]
816

917
jobs:
1018
build:
11-
1219
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
sdk: [ stable, 2.17.0 ]
24+
steps:
25+
- uses: actions/checkout@v3
1326

14-
container:
15-
image: google/dart:2.12
27+
- uses: dart-lang/setup-dart@v1
28+
with:
29+
sdk: ${{ matrix.sdk }}
1630

17-
steps:
18-
- uses: actions/checkout@v2
19-
- name: Install dependencies
20-
run: pub get
21-
- name: Format code
22-
run: dartfmt -n --set-exit-if-changed .
23-
- name: Static analyze project
24-
run: dartanalyzer --fatal-infos --fatal-warnings .
25-
- name: Run tests
26-
run: pub run test
31+
- name: Install dependencies
32+
run: dart pub get
33+
34+
# Uncomment this step to verify the use of 'dart format' on each commit.
35+
- name: Verify formatting
36+
run: dart format --output=none --set-exit-if-changed .
37+
38+
# Consider passing '--fatal-infos' for slightly stricter analysis.
39+
- name: Analyze project source
40+
run: dart analyze --fatal-infos
41+
42+
# Your project will need to have tests in test/ and a dependency on
43+
# package:test for this step to succeed. Note that Flutter projects will
44+
# want to change this to 'flutter test'.
45+
- name: Run tests
46+
run: dart test

.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
1+
## 1.3.0
2+
3+
- Fixed stackTrace count when using `stackTraceBeginIndex`.
4+
Addresses [#114](https://github.com/simc/logger/issues/114).
5+
- Added proper FileOutput stub. Addresses [#94](https://github.com/simc/logger/issues/94).
6+
- Added `isClosed`. Addresses [#130](https://github.com/simc/logger/issues/130).
7+
- Added `time` to LogEvent.
8+
- Added `error` handling to LogfmtPrinter.
9+
10+
## 1.2.2
11+
12+
- Fixed conditional LogOutput export. Credits to
13+
@ChristopheOosterlynck [#4](https://github.com/Bungeefan/logger/pull/4).
14+
15+
## 1.2.1
16+
17+
- Reverted `${this}` interpolation and added linter
18+
ignore. [#1](https://github.com/Bungeefan/logger/issues/1)
19+
20+
## 1.2.0
21+
22+
- Added origin LogEvent to OutputEvent. Addresses [#133](https://github.com/simc/logger/pull/133).
23+
- Re-added LogListener and OutputListener (Should restore compatibility with logger_flutter).
24+
- Replaced pedantic with lints.
25+
126
## 1.1.0
27+
228
- Enhance boxing control with PrettyPrinter. Credits to @timmaffett
329
- Add trailing new line to FileOutput. Credits to @narumishi
430
- Add functions as a log message. Credits to @smotastic
531

632
## 1.0.0
33+
734
- Stable nullsafety
835

936
## 1.0.0-nullsafety.0
@@ -22,7 +49,7 @@
2249
## 0.9.2
2350
- Add `PrefixPrinter`. Credits to @tkutcher.
2451
- Add `HybridPrinter`. Credits to @tkutcher.
25-
52+
2653
## 0.9.1
2754
- Fix logging output for Flutter Web. Credits to @nateshmbhat and @Cocotus.
2855

@@ -45,7 +72,7 @@
4572
- Fix SimplePrinter showTime #12
4673
- Remove buffer field
4774
- Update library structure (thanks @marcgraub!)
48-
75+
4976
## 0.7.0+1
5077
- Added `ProductionFilter`, `FileOutput`, `MemoryOutput`, `SimplePrinter`
5178
- Breaking: Changed `LogFilter`, `LogPrinter` and `LogOutput`

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MIT License
22

33
Copyright (c) 2019 Simon Leier
4+
Copyright (c) 2023 Severin Hamader
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Logger
22

33
[![pub package](https://img.shields.io/pub/v/logger.svg?logo=dart&logoColor=00b9fc)](https://pub.dartlang.org/packages/logger)
4-
[![CI](https://img.shields.io/github/workflow/status/leisim/logger/Dart%20CI/master?logo=github-actions&logoColor=white)](https://github.com/leisim/logger/actions)
5-
[![Last Commits](https://img.shields.io/github/last-commit/leisim/logger?logo=git&logoColor=white)](https://github.com/leisim/logger/commits/master)
6-
[![Pull Requests](https://img.shields.io/github/issues-pr/leisim/logger?logo=github&logoColor=white)](https://github.com/leisim/logger/pulls)
7-
[![Code size](https://img.shields.io/github/languages/code-size/leisim/logger?logo=github&logoColor=white)](https://github.com/leisim/logger)
8-
[![License](https://img.shields.io/github/license/leisim/logger?logo=open-source-initiative&logoColor=green)](https://github.com/leisim/logger/blob/master/LICENSE)
4+
[![CI](https://img.shields.io/github/actions/workflow/status/Bungeefan/logger/dart.yml?branch=master&logo=github-actions&logoColor=white)](https://github.com/Bungeefan/logger/actions)
5+
[![Last Commits](https://img.shields.io/github/last-commit/Bungeefan/logger?logo=git&logoColor=white)](https://github.com/Bungeefan/logger/commits/master)
6+
[![Pull Requests](https://img.shields.io/github/issues-pr/Bungeefan/logger?logo=github&logoColor=white)](https://github.com/Bungeefan/logger/pulls)
7+
[![Code size](https://img.shields.io/github/languages/code-size/Bungeefan/logger?logo=github&logoColor=white)](https://github.com/Bungeefan/logger)
8+
[![License](https://img.shields.io/github/license/Bungeefan/logger?logo=open-source-initiative&logoColor=green)](https://github.com/Bungeefan/logger/blob/master/LICENSE)
99

1010

1111
NOTICE: This repo is NOT LONGER leading! The new repo is here: https://github.com/Bungeefan/logger
@@ -16,13 +16,15 @@ Inspired by [logger](https://github.com/orhanobut/logger) for Android.
1616
**Show some ❤️ and star the repo to support the project**
1717

1818
### Resources:
19+
1920
- [Documentation](https://pub.dev/documentation/logger/latest/logger/logger-library.html)
2021
- [Pub Package](https://pub.dev/packages/logger)
21-
- [GitHub Repository](https://github.com/leisim/logger)
22+
- [GitHub Repository](https://github.com/Bungeefan/logger)
2223

2324
## Getting Started
2425

2526
Just create an instance of `Logger` and start logging:
27+
2628
```dart
2729
var logger = Logger();
2830
@@ -33,7 +35,7 @@ Instead of a string message, you can also pass other objects like `List`, `Map`
3335

3436
## Output
3537

36-
![](https://raw.githubusercontent.com/leisim/logger/master/art/screenshot.png)
38+
![](https://raw.githubusercontent.com/Bungeefan/logger/master/art/screenshot.png)
3739

3840
# Documentation
3941

@@ -80,32 +82,35 @@ If you use the `PrettyPrinter`, there are more options:
8082
```dart
8183
var logger = Logger(
8284
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
8991
),
9092
);
9193
```
9294

9395
### Auto detecting
9496

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`
98100
with `io.stdout.terminalColumns`.
99101

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
101103
import `io`, for example when using this library on the web.
102104

103105
## LogFilter
104106

105107
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.
107111

108112
You can create your own `LogFilter` like this:
113+
109114
```dart
110115
class MyFilter extends LogFilter {
111116
@override
@@ -114,15 +119,16 @@ class MyFilter extends LogFilter {
114119
}
115120
}
116121
```
117-
This will show all logs even in release mode. (**NOT** a good idea)
118122

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

120125
## LogPrinter
121126

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

125130
A very basic printer could look like this:
131+
126132
```dart
127133
class MyPrinter extends LogPrinter {
128134
@override
@@ -132,22 +138,26 @@ class MyPrinter extends LogPrinter {
132138
}
133139
```
134140

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+
:)
136144

137145
### Colors
138146

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
142151

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)
156+
decorator to achieve colored logs for any logger:
147157

148158
```dart
149159
var logger = Logger(
150-
printer: PrefixPrinter(PrettyPrinter(colors: false))
160+
printer: PrefixPrinter(PrettyPrinter(colors: false))
151161
);
152162
```
153163

@@ -167,33 +177,15 @@ class ConsoleOutput extends LogOutput {
167177
}
168178
```
169179

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.
172182

173183
## logger_flutter extension
174184

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.
176188

189+
# Acknowledgments
177190

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).

analysis_options.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options

lib/logger.dart

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,20 @@
22
library logger;
33

44
export 'src/ansi_color.dart';
5-
65
export 'src/filters/development_filter.dart';
76
export 'src/filters/production_filter.dart';
8-
7+
export 'src/log_filter.dart';
8+
export 'src/log_output.dart';
9+
export 'src/log_printer.dart';
10+
export 'src/logger.dart';
911
export 'src/outputs/console_output.dart';
10-
export 'src/outputs/stream_output.dart';
12+
export 'src/outputs/file_output_stub.dart'
13+
if (dart.library.io) 'src/outputs/file_output.dart';
1114
export 'src/outputs/memory_output.dart';
1215
export 'src/outputs/multi_output.dart';
13-
14-
export 'src/printers/pretty_printer.dart';
15-
export 'src/printers/logfmt_printer.dart';
16-
export 'src/printers/simple_printer.dart';
16+
export 'src/outputs/stream_output.dart';
1717
export 'src/printers/hybrid_printer.dart';
18+
export 'src/printers/logfmt_printer.dart';
1819
export 'src/printers/prefix_printer.dart';
19-
20-
export 'src/log_output.dart'
21-
if (dart.library.io) 'src/outputs/file_output.dart';
22-
23-
export 'src/log_filter.dart';
24-
export 'src/log_output.dart';
25-
export 'src/log_printer.dart';
26-
export 'src/logger.dart';
20+
export 'src/printers/pretty_printer.dart';
21+
export 'src/printers/simple_printer.dart';

lib/src/ansi_color.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class AnsiColor {
3636

3737
String call(String msg) {
3838
if (color) {
39+
// ignore: unnecessary_brace_in_string_interps
3940
return '${this}$msg$ansiDefault';
4041
} else {
4142
return msg;

lib/src/filters/development_filter.dart

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

44
/// Prints all logs with `level >= Logger.level` while in development mode (eg
55
/// when `assert`s are evaluated, Flutter calls this debug mode).

lib/src/filters/production_filter.dart

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

44
/// Prints all logs with `level >= Logger.level` even in production.
55
class ProductionFilter extends LogFilter {

0 commit comments

Comments
 (0)