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

Unified Diff: chrome/browser/resources/hotword/logging.js

Issue 601123002: Add a trivial logging wrapper around console.log, and add some useful log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/hotword/logging.js
diff --git a/chrome/browser/resources/hotword/logging.js b/chrome/browser/resources/hotword/logging.js
new file mode 100644
index 0000000000000000000000000000000000000000..c6c34e60ddc74d9556d6fd42d322e1de5dd4ee62
--- /dev/null
+++ b/chrome/browser/resources/hotword/logging.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
Dan Beam 2014/09/29 23:45:45 s/ (c)//
Anand Mistry (off Chromium) 2014/09/30 03:41:09 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('hotword', function() {
+ 'use strict';
+
+ var DEBUG = false;
Dan Beam 2014/09/29 23:45:44 why not some externally visible member (e.g. hotwo
Anand Mistry (off Chromium) 2014/09/30 03:41:10 Done.
+
+ /**
+ * Wrapper around console.log allowing debug log message to be enabled during
+ * development.
+ */
+ function Debug() {
+ if (DEBUG) {
Dan Beam 2014/09/29 23:45:45 nit: chrome-code generally doesn't use {} for 1-li
Anand Mistry (off Chromium) 2014/09/30 03:41:09 Oops. That one slipped by.
+ console.log.apply(console, arguments);
+ }
Dan Beam 2014/09/29 23:45:44 nit: if you already need to change the code locall
Anand Mistry (off Chromium) 2014/09/30 03:41:09 I like the idea to expose DEBUG so I can enable it
+ }
+
+ return {
+ Debug: Debug
Dan Beam 2014/09/29 23:45:44 Debug => debug
Anand Mistry (off Chromium) 2014/09/30 03:41:10 Done.
+ };
+});
« no previous file with comments | « chrome/browser/resources/component_extension_resources.grd ('k') | chrome/browser/resources/hotword/manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698