This repository was archived by the owner on Oct 18, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +44
-5
lines changed
Expand file tree Collapse file tree 3 files changed +44
-5
lines changed Original file line number Diff line number Diff line change 1- ## 1.0.2-dev
1+ ## 1.0.2
2+
3+ * Update description.
4+ * Add example.
25
36## 1.0.1
47
Original file line number Diff line number Diff line change 1+ import 'package:logging/logging.dart' ;
2+
3+ final log = Logger ('ExampleLogger' );
4+
5+ /// Example of configuring a logger to print to stdout.
6+ ///
7+ /// This example will print:
8+ ///
9+ /// INFO: 2021-09-13 15:35:10.703401: recursion: n = 4
10+ /// INFO: 2021-09-13 15:35:10.707974: recursion: n = 3
11+ /// Fibonacci(4) is: 3
12+ /// Fibonacci(5) is: 5
13+ /// SHOUT: 2021-09-13 15:35:10.708087: Unexpected negative n: -42
14+ /// Fibonacci(-42) is: 1
15+ void main () {
16+ Logger .root.level = Level .ALL ; // defaults to Level.INFO
17+ Logger .root.onRecord.listen ((record) {
18+ print ('${record .level .name }: ${record .time }: ${record .message }' );
19+ });
20+
21+ print ('Fibonacci(4) is: ${fibonacci (4 )}' );
22+
23+ Logger .root.level = Level .SEVERE ; // skip logs less then severe.
24+ print ('Fibonacci(5) is: ${fibonacci (5 )}' );
25+
26+ print ('Fibonacci(-42) is: ${fibonacci (-42 )}' );
27+ }
28+
29+ int fibonacci (int n) {
30+ if (n <= 2 ) {
31+ if (n < 0 ) log.shout ('Unexpected negative n: $n ' );
32+ return 1 ;
33+ } else {
34+ log.info ('recursion: n = $n ' );
35+ return fibonacci (n - 2 ) + fibonacci (n - 1 );
36+ }
37+ }
Original file line number Diff line number Diff line change 11name : logging
2- version : 1.0.2-dev
2+ version : 1.0.2
33
44description : >-
5- Provides APIs for debugging and error logging. This library introduces
6- abstractions similar to those used in other languages, such as the Closure
7- JS Logger and java.util.logging.Logger.
5+ Provides APIs for debugging and error logging, similar to loggers in other
6+ languages, such as the Closure JS Logger and java.util.logging.Logger.
87repository : https://github.com/dart-lang/logging
98
109environment :
You can’t perform that action at this time.
0 commit comments