@@ -44,50 +44,124 @@ class PrettyPrinter extends LogPrinter {
4444 };
4545
4646 /// Matches a stacktrace line as generated on Android/iOS devices.
47+ ///
4748 /// For example:
48- /// #1 Logger.log (package:logger/src/logger.dart:115:29)
49+ /// * #1 Logger.log (package:logger/src/logger.dart:115:29)
4950 static final _deviceStackTraceRegex =
5051 RegExp (r'#[0-9]+[\s]+(.+) \(([^\s]+)\)' );
5152
5253 /// Matches a stacktrace line as generated by Flutter web.
54+ ///
5355 /// For example:
54- /// packages/logger/src/printers/pretty_printer.dart 91:37
56+ /// * packages/logger/src/printers/pretty_printer.dart 91:37
5557 static final _webStackTraceRegex =
5658 RegExp (r'^((packages|dart-sdk)\/[^\s]+\/)' );
5759
5860 /// Matches a stacktrace line as generated by browser Dart.
61+ ///
5962 /// For example:
60- /// dart:sdk_internal
61- /// package:logger/src/logger.dart
63+ /// * dart:sdk_internal
64+ /// * package:logger/src/logger.dart
6265 static final _browserStackTraceRegex =
6366 RegExp (r'^(?:package:)?(dart:[^\s]+|[^\s]+)' );
6467
6568 static DateTime ? _startTime;
6669
67- /// The index which to begin the stack trace at
70+ /// The index at which the stack trace should start.
6871 ///
6972 /// This can be useful if, for instance, Logger is wrapped in another class and
7073 /// you wish to remove these wrapped calls from stack trace
74+ ///
75+ /// See also:
76+ /// * [excludePaths]
7177 final int stackTraceBeginIndex;
78+
79+ /// Controls the method count in created stack traces.
80+ ///
81+ /// This is used when no stack trace has been provided.
82+ ///
83+ /// Set to `0` to disable the creation of a stack trace.
84+ ///
85+ /// See also:
86+ /// * [errorMethodCount]
7287 final int methodCount;
88+
89+ /// Controls the method count in provided stack traces.
90+ ///
91+ /// This is used when a stack trace was provided via the error parameter.
92+ ///
93+ /// Set to `0` in order to disable printing the provided stack trace.
94+ ///
95+ /// See also:
96+ /// * [methodCount]
7397 final int errorMethodCount;
98+
99+ /// Controls the length of the divider lines.
74100 final int lineLength;
101+
102+ /// Whether ansi colors are used to color the output.
75103 final bool colors;
104+
105+ /// Whether emojis are prefixed to the log line.
76106 final bool printEmojis;
107+
108+ /// Whether [LogEvent.time] is printed.
77109 final bool printTime;
78110
79- /// To prevent ascii 'boxing' of any log [Level] include the level in map for excludeBox,
80- /// for example to prevent boxing of [Level.verbose] and [Level.info] use excludeBox:{Level.verbose:true, Level.info:true}
111+ /// Controls the ascii 'boxing' of different [Level] s.
112+ ///
113+ /// By default all levels are 'boxed',
114+ /// to prevent 'boxing' of a specific level,
115+ /// include it with `true` in the map.
116+ ///
117+ /// Example to prevent boxing of [Level.verbose] and [Level.info] :
118+ /// ```dart
119+ /// excludeBox: {
120+ /// Level.verbose: true,
121+ /// Level.info: true,
122+ /// },
123+ /// ```
124+ ///
125+ /// See also:
126+ /// * [noBoxingByDefault]
81127 final Map <Level , bool > excludeBox;
82128
83- /// To make the default for every level to prevent boxing entirely set [noBoxingByDefault] to true
84- /// (boxing can still be turned on for some levels by using something like excludeBox:{Level.error:false} )
129+ /// Whether the implicit `bool` s in [excludeBox] are `true` or `false` by default.
130+ ///
131+ /// By default all levels are 'boxed',
132+ /// this flips the default to no boxing for all levels.
133+ /// Individual boxing can still be turned on for specific
134+ /// levels by setting them manually to `false` in [excludeBox] .
135+ ///
136+ /// Example to specifically activate 'boxing' of [Level.error] :
137+ /// ```dart
138+ /// noBoxingByDefault: true,
139+ /// excludeBox: {
140+ /// Level.error: false,
141+ /// },
142+ /// ```
143+ ///
144+ /// See also:
145+ /// * [excludeBox]
85146 final bool noBoxingByDefault;
86147
87- /// To exclude user's custom path
88- /// for example if you made a Mylog util redirect to logger.log,
89- /// you can add your Mylog path in [excludePaths] .
148+ /// A list of custom paths that are excluded from the stack trace.
149+ ///
150+ /// For example, to exclude your `MyLog` util that redirects to this logger:
151+ /// ```dart
152+ /// excludePaths: [
153+ /// // To exclude a whole package
154+ /// "package:test",
155+ /// // To exclude a single file
156+ /// "package:test/util/my_log.dart",
157+ /// ],
158+ /// ```
159+ ///
160+ /// See also:
161+ /// * [stackTraceBeginIndex]
90162 final List <String > excludePaths;
163+
164+ /// Contains the parsed rules resulting from [excludeBox] and [noBoxingByDefault] .
91165 late final Map <Level , bool > includeBox;
92166
93167 String _topBorder = '' ;
0 commit comments