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

Side by Side Diff: pkg/logging/lib/logging.dart

Issue 10989013: Change IllegalArgumentException to ArgumentError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated co19 test expectations. Created 8 years, 2 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
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 /** 5 /**
6 * Provides APIs for debugging and error logging. This library introduces 6 * Provides APIs for debugging and error logging. This library introduces
7 * abstractions similar to those used in other languages, such as the Closure JS 7 * abstractions similar to those used in other languages, such as the Closure JS
8 * Logger and java.util.logging.Logger. 8 * Logger and java.util.logging.Logger.
9 */ 9 */
10 #library('logging'); 10 #library('logging');
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 /** Handlers used to process log entries in this logger. */ 46 /** Handlers used to process log entries in this logger. */
47 List<LoggerHandler> _handlers; 47 List<LoggerHandler> _handlers;
48 48
49 /** 49 /**
50 * Singleton constructor. Calling `new Logger(name)` will return the same 50 * Singleton constructor. Calling `new Logger(name)` will return the same
51 * actual instance whenever it is called with the same string name. 51 * actual instance whenever it is called with the same string name.
52 */ 52 */
53 factory Logger(String name) { 53 factory Logger(String name) {
54 if (name.startsWith('.')) { 54 if (name.startsWith('.')) {
55 throw new IllegalArgumentException("name shouldn't start with a '.'"); 55 throw new ArgumentError("name shouldn't start with a '.'");
56 } 56 }
57 if (_loggers == null) _loggers = <String, Logger>{}; 57 if (_loggers == null) _loggers = <String, Logger>{};
58 if (_loggers.containsKey(name)) return _loggers[name]; 58 if (_loggers.containsKey(name)) return _loggers[name];
59 59
60 // Split hierarchical names (separated with '.'). 60 // Split hierarchical names (separated with '.').
61 int dot = name.lastIndexOf('.'); 61 int dot = name.lastIndexOf('.');
62 Logger parent = null; 62 Logger parent = null;
63 String thisName; 63 String thisName;
64 if (dot == -1) { 64 if (dot == -1) {
65 if (name != '') parent = new Logger(''); 65 if (name != '') parent = new Logger('');
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 /** Associated exception message (if any) when recording errors messages. */ 326 /** Associated exception message (if any) when recording errors messages. */
327 String exceptionText; 327 String exceptionText;
328 328
329 LogRecord( 329 LogRecord(
330 this.level, this.message, this.loggerName, 330 this.level, this.message, this.loggerName,
331 [time, this.exception, this.exceptionText]) : 331 [time, this.exception, this.exceptionText]) :
332 this.time = (time == null) ? new Date.now() : time, 332 this.time = (time == null) ? new Date.now() : time,
333 this.sequenceNumber = LogRecord._nextNumber++; 333 this.sequenceNumber = LogRecord._nextNumber++;
334 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698