-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.js
31 lines (25 loc) · 825 Bytes
/
log.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
let isLoggingEnabled = true; // You can toggle this to enable/disable logging
export function log(...args) {
if (isLoggingEnabled) {
console.log(...args);
}
}
// Potentially toggle logs by persistent setting
/*
function updateLoggingPreference() {
getSetting('loggingEnabled', true).then(enabled => {
isLoggingEnabled = enabled;
});
}
chrome.runtime.onInstalled.addListener(function() {
saveSetting('loggingEnabled', true); // Default logging enabled
updateLoggingPreference();
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.toggleLogging !== undefined) {
saveSetting('loggingEnabled', request.toggleLogging);
isLoggingEnabled = request.toggleLogging;
}
});
chrome.runtime.sendMessage({toggleLogging: false}); // Call this to disable logging
*/