| OLD | NEW |
| 1 ## Initializing | 1 ## Initializing |
| 2 | 2 |
| 3 By default, the logging package does not do anything useful with the | 3 By default, the logging package does not do anything useful with the |
| 4 log messages. You must configure the logging level and add a handler | 4 log messages. You must configure the logging level and add a handler |
| 5 for the log messages. | 5 for the log messages. |
| 6 | 6 |
| 7 Here is a simple logging configuration that logs all messages | 7 Here is a simple logging configuration that logs all messages |
| 8 via `print`. | 8 via `print`. |
| 9 | 9 |
| 10 ```dart | 10 ```dart |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 Here is an example of logging a debug message and an error: | 33 Here is an example of logging a debug message and an error: |
| 34 | 34 |
| 35 ```dart | 35 ```dart |
| 36 var future = doSomethingAsync().then((result) { | 36 var future = doSomethingAsync().then((result) { |
| 37 log.fine('Got the result: $result'); | 37 log.fine('Got the result: $result'); |
| 38 processResult(result); | 38 processResult(result); |
| 39 }).catchError((e, stackTrace) => log.severe('Oh noes!', e, stackTrace)); | 39 }).catchError((e, stackTrace) => log.severe('Oh noes!', e, stackTrace)); |
| 40 ``` | 40 ``` |
| 41 | 41 |
| 42 When logging more complex messages, you can pass a closure instead |
| 43 that will be evaluated only if the message is actually logged: |
| 44 |
| 45 ```dart |
| 46 log.fine(() => [1, 2, 3, 4, 5].map((e) => e * 4).join("-")); |
| 47 ``` |
| 48 |
| 42 See the [Logger] class for the different logging methods. | 49 See the [Logger] class for the different logging methods. |
| OLD | NEW |