From 0b3264a99d3b04edcd9d1e846d7fd7c0cf036230 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 30 Mar 2010 14:12:59 -0700 Subject: [PATCH] Enable default logger in debug frameworks. Add configurable options to index-debug.html. --- Objective-J/CPLog.js | 7 +++++++ Objective-J/Debug.js | 2 ++ .../Resources/Templates/Application/index-debug.html | 7 +++++++ Tools/capp/Resources/Templates/Application/index.html | 2 +- .../Resources/Templates/NibApplication/index-debug.html | 9 ++++++++- Tools/capp/Resources/Templates/NibApplication/index.html | 2 +- .../Resources/Templates/ThemeDescriptor/index-debug.html | 2 +- .../capp/Resources/Templates/ThemeDescriptor/index.html | 2 +- 8 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Objective-J/CPLog.js b/Objective-J/CPLog.js index 8ad4ec238..b4d69c84f 100644 --- a/Objective-J/CPLog.js +++ b/Objective-J/CPLog.js @@ -357,3 +357,10 @@ function _CPLogInitPopup(logWindow) }, false); } #endif + + +#if COMMONJS +CPLogDefault = CPLogPrint; +#else +CPLogDefault = (typeof window === "object" && window.console) ? CPLogConsole : CPLogPopup; +#endif diff --git a/Objective-J/Debug.js b/Objective-J/Debug.js index 27af496b9..68f5aa5d0 100644 --- a/Objective-J/Debug.js +++ b/Objective-J/Debug.js @@ -20,6 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +CPLogRegister(CPLogDefault); + // formatting helpers function objj_debug_object_format(aReceiver) diff --git a/Tools/capp/Resources/Templates/Application/index-debug.html b/Tools/capp/Resources/Templates/Application/index-debug.html index 0bd1d11fe..a0e57f42c 100644 --- a/Tools/capp/Resources/Templates/Application/index-debug.html +++ b/Tools/capp/Resources/Templates/Application/index-debug.html @@ -35,6 +35,13 @@ // Uncomment (along with both above) to print backtraces on type check errors: //objj_typecheck_prints_backtrace = true; + + // Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise): + //CPLogUnregister(CPLogDefault); + + // Uncomment to enable a specific logger: + //CPLogRegister(CPLogConsole); + //CPLogRegister(CPLogPopup);