Skip to content
Snippets Groups Projects
Commit a335941a authored by Lucie Bader's avatar Lucie Bader
Browse files

Robustesse logger.js

parent aecc6915
No related branches found
No related tags found
1 merge request!8Test final
...@@ -38,6 +38,11 @@ ...@@ -38,6 +38,11 @@
"default_title": "ff2BaLex" "default_title": "ff2BaLex"
}, },
"options_ui": {
"page": "src/options/options.html",
"open_in_tab": false
},
"sidebar_action": { "sidebar_action": {
"default_title": "BaLex", "default_title": "BaLex",
"default_panel": "src/sidebar/sidebar.html", "default_panel": "src/sidebar/sidebar.html",
...@@ -59,7 +64,16 @@ ...@@ -59,7 +64,16 @@
"src/utils/stats.js"], "src/utils/stats.js"],
"css": ["src/context_menu/custom_context_menu.css"], "css": ["src/context_menu/custom_context_menu.css"],
"run_at": "document_idle" "run_at": "document_idle"
},
{
"matches": ["<all_urls>"],
"js": [
"src/utils/logger.js",
"src/utils/stats.js"
],
"run_at": "document_end"
} }
], ],
"web_accessible_resources": [ "web_accessible_resources": [
......
...@@ -2,16 +2,30 @@ ...@@ -2,16 +2,30 @@
* Mode debug : affiche les logs dans la console * Mode debug : affiche les logs dans la console
* Mode prod : masque les logs ainsi que les identifiants des lexiques * Mode prod : masque les logs ainsi que les identifiants des lexiques
*/ */
const DEBUG = true; // false en prod (function () {
if (typeof window !== 'undefined') {
function log(...args) { if (typeof window.DEBUG === 'undefined') {
if (DEBUG) { window.DEBUG = true; // ou false en production
console.log(...args); }
if (!window.log) {
function log(...args) {
if (window.DEBUG) {
console.log(...args);
}
}
window.log = log;
}
} else if (typeof self !== 'undefined') {
if (typeof self.DEBUG === 'undefined') {
self.DEBUG = true;
}
if (!self.log) {
function log(...args) {
if (self.DEBUG) {
console.log(...args);
}
}
self.log = log;
}
} }
} })();
if (typeof window !== 'undefined') {
window.log = log;
} else if (typeof self !== 'undefined') {
self.log = log;
}
log("Stats.js chargé.");
(function () { (function () {
if (window.hasRun) { if (window.hasRun) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment