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

Side by Side Diff: lib/src/log.dart

Issue 1267853002: Add verbosity levels for warnings and errors. (Closed) Base URL: https://github.com/dart-lang/pub.git@master
Patch Set: Created 5 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
« no previous file with comments | « lib/src/git.dart ('k') | test/pub_test.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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Message logging. 5 /// Message logging.
6 library pub.log; 6 library pub.log;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 /// Silence all logging. 104 /// Silence all logging.
105 static const NONE = const Verbosity._("none", const { 105 static const NONE = const Verbosity._("none", const {
106 Level.ERROR: null, 106 Level.ERROR: null,
107 Level.WARNING: null, 107 Level.WARNING: null,
108 Level.MESSAGE: null, 108 Level.MESSAGE: null,
109 Level.IO: null, 109 Level.IO: null,
110 Level.SOLVER: null, 110 Level.SOLVER: null,
111 Level.FINE: null 111 Level.FINE: null
112 }); 112 });
113 113
114 /// Shows only errors.
115 static const ERROR = const Verbosity._("error", const {
116 Level.ERROR: _logToStderr,
117 Level.WARNING: null,
118 Level.MESSAGE: null,
119 Level.IO: null,
120 Level.SOLVER: null,
121 Level.FINE: null
122 });
123
114 /// Shows only errors and warnings. 124 /// Shows only errors and warnings.
115 static const WARNING = const Verbosity._("warning", const { 125 static const WARNING = const Verbosity._("warning", const {
116 Level.ERROR: _logToStderr, 126 Level.ERROR: _logToStderr,
117 Level.WARNING: _logToStderr, 127 Level.WARNING: _logToStderr,
118 Level.MESSAGE: null, 128 Level.MESSAGE: null,
119 Level.IO: null, 129 Level.IO: null,
120 Level.SOLVER: null, 130 Level.SOLVER: null,
121 Level.FINE: null 131 Level.FINE: null
122 }); 132 });
123 133
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 this.message(errorJson); 548 this.message(errorJson);
539 } 549 }
540 550
541 /// Encodes [message] to JSON and prints it if JSON output is enabled. 551 /// Encodes [message] to JSON and prints it if JSON output is enabled.
542 void message(message) { 552 void message(message) {
543 if (!enabled) return; 553 if (!enabled) return;
544 554
545 print(JSON.encode(message)); 555 print(JSON.encode(message));
546 } 556 }
547 } 557 }
OLDNEW
« no previous file with comments | « lib/src/git.dart ('k') | test/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698