Index: chrome/browser/resources/access_chromevox/common/abstract_logger.js |
=================================================================== |
--- chrome/browser/resources/access_chromevox/common/abstract_logger.js (revision 0) |
+++ chrome/browser/resources/access_chromevox/common/abstract_logger.js (revision 0) |
@@ -0,0 +1,62 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+/** |
+ * @fileoverview Base class for classes that can log their behavior. |
+ */ |
+ |
+goog.provide('cvox.AbstractLogger'); |
+ |
+/** |
+ * Creates a new instance. |
+ * @constructor |
+ */ |
+cvox.AbstractLogger = function() { |
+ if (this.logEnabled()) { |
+ this.debuglog = new Array(); |
+ } |
+}; |
+ |
+/** |
+ * @return {string} The human-readable name of this instance. |
+ */ |
+cvox.AbstractLogger.prototype.getName = function() { |
+ return 'AbstractLogger'; |
+}; |
+ |
+/** |
+ * @return {boolean} If logging is enabled. |
+ */ |
+cvox.AbstractLogger.prototype.logEnabled = function() { |
+ return true; |
+}; |
+ |
+/** |
+ * Debugging function - adds the string to the log of utterances. |
+ * @param {string} msgString The string of text to log. |
+ */ |
+cvox.AbstractLogger.prototype.log = function(msgString) { |
+ if (!this.logEnabled()) { |
+ return; |
+ } |
+ this.debuglog.push(msgString); |
+ if (console) { |
+ console.log(msgString); |
+ } |
+}; |
+ |
+/** |
+ * Debugging function - returns the log of utterances. |
+ * @return {Array} The log of utterances. |
+ */ |
+cvox.AbstractLogger.prototype.getLog = function() { |
+ return this.debuglog; |
+}; |
+ |
+/** |
+ * Debugging function - resets the log of utterances. |
+ */ |
+cvox.AbstractLogger.prototype.resetLog = function() { |
+ this.debuglog = new Array(); |
+}; |
Property changes on: chrome/browser/resources/access_chromevox/common/abstract_logger.js |
___________________________________________________________________ |
Added: svn:executable |
+ * |
Added: svn:eol-style |
+ LF |