Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: pkg/logging/README.md

Issue 420553007: updated logging package to accept functions or other non-string objects when logging (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: "bump version and add example for logging with a closure" Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/logging/lib/logging.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
OLDNEW
« no previous file with comments | « no previous file | pkg/logging/lib/logging.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698