|
1 | 1 | import 'dart:convert';
|
2 | 2 |
|
3 |
| -import 'package:logger/src/ansi_color.dart'; |
4 | 3 | import 'package:logger/src/logger.dart';
|
5 | 4 | import 'package:logger/src/log_printer.dart';
|
6 |
| -import 'package:logger/src/platform/platform.dart'; |
| 5 | +import 'package:logger/src/ansi_color.dart'; |
7 | 6 |
|
8 | 7 | /// Default implementation of [LogPrinter].
|
9 | 8 | ///
|
10 |
| -/// Output looks like this: |
| 9 | +/// Outut looks like this: |
11 | 10 | /// ```
|
12 | 11 | /// ┌──────────────────────────
|
13 | 12 | /// │ Error info
|
@@ -64,52 +63,30 @@ class PrettyPrinter extends LogPrinter {
|
64 | 63 |
|
65 | 64 | static DateTime _startTime;
|
66 | 65 |
|
67 |
| - /// Amount of [StackTrace] lines to show with message (non-error log). |
68 |
| - /// Defaults to LogPlatform.DEFAULT_METHOD_COUNT. |
69 | 66 | final int methodCount;
|
70 |
| - |
71 |
| - /// Amount of error [StackTrace] lines to show with message. |
72 |
| - /// Defaults to LogPlatform.DEFAULT_ERROR_METHOD_COUNT. |
73 | 67 | final int errorMethodCount;
|
74 |
| - |
75 |
| - /// Columns length to format log. |
76 |
| - /// Defaults to LogPlatform.DEFAULT_LINE_LENGTH. |
77 | 68 | final int lineLength;
|
78 |
| - |
79 |
| - /// If [true] uses colors for logging. |
80 |
| - /// Defaults to LogPlatform.DEFAULT_USE_COLORS. |
81 | 69 | final bool colors;
|
82 |
| - |
83 |
| - /// If [true] uses emojis to identify logging types. |
84 |
| - /// Defaults to LogPlatform.DEFAULT_USE_EMOJI. |
85 | 70 | final bool printEmojis;
|
86 |
| - |
87 |
| - /// If [true] shows a line with log event time. |
88 |
| - /// Defaults to false. |
89 | 71 | final bool printTime;
|
90 | 72 |
|
91 | 73 | String _topBorder = '';
|
92 | 74 | String _middleBorder = '';
|
93 | 75 | String _bottomBorder = '';
|
94 | 76 |
|
95 | 77 | PrettyPrinter({
|
96 |
| - int methodCount, |
97 |
| - int errorMethodCount, |
98 |
| - int lineLength, |
99 |
| - bool colors, |
100 |
| - bool printEmojis, |
| 78 | + this.methodCount = 2, |
| 79 | + this.errorMethodCount = 8, |
| 80 | + this.lineLength = 120, |
| 81 | + this.colors = true, |
| 82 | + this.printEmojis = true, |
101 | 83 | this.printTime = false,
|
102 |
| - }) : methodCount = methodCount ?? LogPlatform.DEFAULT_METHOD_COUNT, |
103 |
| - errorMethodCount = |
104 |
| - errorMethodCount ?? LogPlatform.DEFAULT_ERROR_METHOD_COUNT, |
105 |
| - lineLength = lineLength ?? LogPlatform.DEFAULT_LINE_LENGTH, |
106 |
| - colors = colors ?? LogPlatform.DEFAULT_USE_COLORS, |
107 |
| - printEmojis = printEmojis ?? LogPlatform.DEFAULT_USE_EMOJI { |
| 84 | + }) { |
108 | 85 | _startTime ??= DateTime.now();
|
109 | 86 |
|
110 | 87 | var doubleDividerLine = StringBuffer();
|
111 | 88 | var singleDividerLine = StringBuffer();
|
112 |
| - for (var i = 0; i < this.lineLength - 1; i++) { |
| 89 | + for (var i = 0; i < lineLength - 1; i++) { |
113 | 90 | doubleDividerLine.write(doubleDivider);
|
114 | 91 | singleDividerLine.write(singleDivider);
|
115 | 92 | }
|
|
0 commit comments