Skip to content

Commit 1d610a1

Browse files
committed
chore: git detailed logging preference and menu
1 parent 7706142 commit 1d610a1

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

src/extensions/default/DebugCommands/main.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ define(function (require, exports, module) {
8080
DEBUG_ENABLE_PHNODE_INSPECTOR = "debug.enablePhNodeInspector",
8181
DEBUG_GET_PHNODE_INSPECTOR_URL = "debug.getPhNodeInspectorURL",
8282
DEBUG_LIVE_PREVIEW_LOGGING = "debug.livePreviewLogging",
83+
DEBUG_GIT_EXTENSION_LOGGING = "debug.gitLogging",
8384
DEBUG_OPEN_VFS = "debug.openVFS",
8485
DEBUG_OPEN_EXTENSION_FOLDER = "debug.openExtensionFolders",
8586
DEBUG_OPEN_VIRTUAL_SERVER = "debug.openVirtualServer",
@@ -88,7 +89,8 @@ define(function (require, exports, module) {
8889
DEBUG_DRAG_AND_DROP = "debug.dragAndDrop";
8990

9091
const LOG_TO_CONSOLE_KEY = logger.loggingOptions.LOCAL_STORAGE_KEYS.LOG_TO_CONSOLE_KEY,
91-
LOG_LIVE_PREVIEW_KEY = logger.loggingOptions.LOCAL_STORAGE_KEYS.LOG_LIVE_PREVIEW;
92+
LOG_LIVE_PREVIEW_KEY = logger.loggingOptions.LOCAL_STORAGE_KEYS.LOG_LIVE_PREVIEW,
93+
LOG_GIT_KEY = logger.loggingOptions.LOCAL_STORAGE_KEYS.LOG_GIT;
9294

9395
// define a preference to turn off opening preferences in split-view.
9496
var prefs = PreferencesManager.getExtensionPrefs("preferencesView");
@@ -697,7 +699,9 @@ define(function (require, exports, module) {
697699
CommandManager.get(DEBUG_ENABLE_LOGGING).setChecked(isLogging);
698700
CommandManager.get(DEBUG_LIVE_PREVIEW_LOGGING).setEnabled(isLogging);
699701
logger.loggingOptions.logLivePreview = window.isLoggingEnabled(LOG_LIVE_PREVIEW_KEY);
702+
logger.loggingOptions.logGit = window.isLoggingEnabled(LOG_GIT_KEY);
700703
CommandManager.get(DEBUG_LIVE_PREVIEW_LOGGING).setChecked(logger.loggingOptions.logLivePreview);
704+
CommandManager.get(DEBUG_GIT_EXTENSION_LOGGING).setChecked(logger.loggingOptions.logGit);
701705
CommandManager.get(DEBUG_ENABLE_PHNODE_INSPECTOR).setChecked(NodeConnector.isInspectEnabled());
702706
}
703707

@@ -735,6 +739,11 @@ define(function (require, exports, module) {
735739
_updateLogToConsoleMenuItemChecked();
736740
}
737741

742+
function _handleGitLogging() {
743+
window.toggleLoggingKey(LOG_GIT_KEY);
744+
_updateLogToConsoleMenuItemChecked();
745+
}
746+
738747
ExtensionManager.on("statusChange", function (id) {
739748
// Seems like an extension(s) got installed.
740749
// Need to recompute the default prefs.
@@ -787,6 +796,7 @@ define(function (require, exports, module) {
787796
CommandManager.register(Strings.CMD_ENABLE_PHNODE_INSPECTOR, DEBUG_ENABLE_PHNODE_INSPECTOR, _handlePhNodeInspectEnable);
788797
CommandManager.register(Strings.CMD_GET_PHNODE_INSPECTOR_URL, DEBUG_GET_PHNODE_INSPECTOR_URL, _handleGetPhNodeInspectURL);
789798
CommandManager.register(Strings.CMD_ENABLE_LIVE_PREVIEW_LOGS, DEBUG_LIVE_PREVIEW_LOGGING, _handleLivePreviewLogging);
799+
CommandManager.register(Strings.CMD_ENABLE_GIT_LOGS, DEBUG_GIT_EXTENSION_LOGGING, _handleGitLogging);
790800
CommandManager.register(Strings.CMD_OPEN_VFS, DEBUG_OPEN_VFS, _openVFS);
791801
CommandManager.register(Strings.CMD_OPEN_EXTENSIONS_FOLDER, DEBUG_OPEN_EXTENSION_FOLDER, _openExtensionsFolder);
792802
CommandManager.register(Strings.CMD_OPEN_VIRTUAL_SERVER, DEBUG_OPEN_VIRTUAL_SERVER, _openVirtualServer);
@@ -823,6 +833,9 @@ define(function (require, exports, module) {
823833
hideWhenCommandDisabled: true
824834
});
825835
diagnosticsSubmenu.addMenuItem(DEBUG_LIVE_PREVIEW_LOGGING);
836+
if(Phoenix.isNativeApp) {
837+
diagnosticsSubmenu.addMenuItem(DEBUG_GIT_EXTENSION_LOGGING);
838+
}
826839
diagnosticsSubmenu.addMenuDivider();
827840
diagnosticsSubmenu.addMenuItem(DEBUG_SHOW_PERF_DATA);
828841
diagnosticsSubmenu.addMenuItem(DEBUG_OPEN_VFS);

src/loggerSetup.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@
9898
LOCAL_STORAGE_KEYS: {
9999
// change these keys in devEnable.html too
100100
LOG_TO_CONSOLE_KEY: "logToConsole",
101-
LOG_LIVE_PREVIEW: "logLivePreview"
101+
LOG_LIVE_PREVIEW: "logLivePreview",
102+
// these need not be dev enable for now
103+
LOG_GIT: "logGitDebugMode"
102104
},
103105
healthDataDisabled: false,
106+
logGit: false,
104107
logLivePreview: false // logLivePreview will be setup below
105108
},
106109
livePreview: {
@@ -163,6 +166,8 @@
163166

164167
logger.loggingOptions.logLivePreview = window.isLoggingEnabled(
165168
logger.loggingOptions.LOCAL_STORAGE_KEYS.LOG_LIVE_PREVIEW);
169+
logger.loggingOptions.logGit = window.isLoggingEnabled(
170+
logger.loggingOptions.LOCAL_STORAGE_KEYS.LOG_GIT);
166171

167172
function _shouldDiscardError(errors = []) {
168173
if(!window.Phoenix || !window.Phoenix.VFS){

src/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,7 @@ define({
852852
"CMD_ENABLE_PHNODE_INSPECTOR": "Enable PhNode Inspector",
853853
"CMD_GET_PHNODE_INSPECTOR_URL": "How to Inspect PhNode",
854854
"CMD_ENABLE_LIVE_PREVIEW_LOGS": "Live Preview Logs",
855+
"CMD_ENABLE_GIT_LOGS": "Git Verbose Logs",
855856
"CMD_OPEN_BRACKETS_SOURCE": "Open {APP_NAME} Source",
856857

857858
"CREATING_LAUNCH_SCRIPT_TITLE": "{APP_NAME} Command Line Shortcut",

test/SpecRunner.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ window.logger = {
5959

6060
loggingOptions: {
6161
LOCAL_STORAGE_KEYS: {
62-
LOG_LIVE_PREVIEW: "logLivePreview"
62+
LOG_LIVE_PREVIEW: "logLivePreview",
63+
// these need not be dev enable for now
64+
LOG_GIT: "logGitDebugMode"
6365
},
6466
healthDataDisabled: false,
6567
logLivePreview: false // logLivePreview will be setup below

0 commit comments

Comments
 (0)