שאלה | למי שמבין בייצוא קונסול של שגיאות ב F12
-
שלום רב.
הרבה פעמים הבינה מבקשת ממני להביא לה את השגיאות שרצות בקונסול.
אני לא יודע איך לעשות את זה בצורה נורמלית.
אז ביקשתי שיכתוב קוד לטרמונסקי שמוריד את זה בטקסט.
אני מחפש מישהו שמבין בזה עבור 2 דברים.- כיצד ניתן לעשות זאת בדרך נורמלית?
- האם הפתרון שהוא כתב לי נורמלי ומועיל?
זה הקוד, מכניסים בטרמונסקי ומורידים קובץ טקסט עם הלוג.
אשמח למידע.
// ==UserScript== // @name ייצוא לוג קונסולה לקובץ V2 // @namespace http://tampermonkey.net/ // @version 2.0 // @description תופס את כל הודעות הקונסולה ומאפשר הורדתם כקובץ טקסט // @author Grok // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // מערך לאחסון הודעות const logs = []; // פונקציה לעיצוב זמן function formatDateTime() { return new Date().toISOString().replace('T', ' ').replace('Z', ''); } // יירוט כל סוגי ההודעות ['log', 'error', 'warn', 'info'].forEach((method) => { const original = console[method]; console[method] = function(...args) { logs.push(`[${method.toUpperCase()}] ${formatDateTime()}: ${args.join(' ')}`); original.apply(console, args); }; }); // יצירת כפתור הורדה function createDownloadButton() { const button = document.createElement('button'); button.textContent = 'הורד לוג קונסולה'; button.style.position = 'fixed'; button.style.top = '10px'; button.style.right = '10px'; button.style.zIndex = '10000'; button.style.padding = '8px 16px'; button.style.background = '#1a73e8'; button.style.color = '#fff'; button.style.border = 'none'; button.style.borderRadius = '4px'; button.style.cursor = 'pointer'; button.style.fontFamily = 'Arial, sans-serif'; button.addEventListener('click', () => { const blob = new Blob([logs.join('\n')], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `console_log_${formatDateTime().replace(/[:.]/g, '-')}.txt`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }); document.body.appendChild(button); } // אתחול window.addEventListener('load', () => { createDownloadButton(); console.log('סקריפט ייצוא לוג V2 נטען בהצלחה'); console.info('מוכן לתפוס הודעות קונסולה'); }); })(); -
שלום רב.
הרבה פעמים הבינה מבקשת ממני להביא לה את השגיאות שרצות בקונסול.
אני לא יודע איך לעשות את זה בצורה נורמלית.
אז ביקשתי שיכתוב קוד לטרמונסקי שמוריד את זה בטקסט.
אני מחפש מישהו שמבין בזה עבור 2 דברים.- כיצד ניתן לעשות זאת בדרך נורמלית?
- האם הפתרון שהוא כתב לי נורמלי ומועיל?
זה הקוד, מכניסים בטרמונסקי ומורידים קובץ טקסט עם הלוג.
אשמח למידע.
// ==UserScript== // @name ייצוא לוג קונסולה לקובץ V2 // @namespace http://tampermonkey.net/ // @version 2.0 // @description תופס את כל הודעות הקונסולה ומאפשר הורדתם כקובץ טקסט // @author Grok // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // מערך לאחסון הודעות const logs = []; // פונקציה לעיצוב זמן function formatDateTime() { return new Date().toISOString().replace('T', ' ').replace('Z', ''); } // יירוט כל סוגי ההודעות ['log', 'error', 'warn', 'info'].forEach((method) => { const original = console[method]; console[method] = function(...args) { logs.push(`[${method.toUpperCase()}] ${formatDateTime()}: ${args.join(' ')}`); original.apply(console, args); }; }); // יצירת כפתור הורדה function createDownloadButton() { const button = document.createElement('button'); button.textContent = 'הורד לוג קונסולה'; button.style.position = 'fixed'; button.style.top = '10px'; button.style.right = '10px'; button.style.zIndex = '10000'; button.style.padding = '8px 16px'; button.style.background = '#1a73e8'; button.style.color = '#fff'; button.style.border = 'none'; button.style.borderRadius = '4px'; button.style.cursor = 'pointer'; button.style.fontFamily = 'Arial, sans-serif'; button.addEventListener('click', () => { const blob = new Blob([logs.join('\n')], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `console_log_${formatDateTime().replace(/[:.]/g, '-')}.txt`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }); document.body.appendChild(button); } // אתחול window.addEventListener('load', () => { createDownloadButton(); console.log('סקריפט ייצוא לוג V2 נטען בהצלחה'); console.info('מוכן לתפוס הודעות קונסולה'); }); })(); -
@מים-אחרונים זה מובנה
לחצן ימני > Save as...

@צדיק-תמים תודה.
גרוק נשאר 0. -
@צדיק-תמים תודה.
גרוק נשאר 0.@מים-אחרונים
ואוו , לגמרי ..
שלום! נראה שהשיחה הזו מעניינת אותך, אבל עדיין אין לך חשבון.
נמאס לכם לגלול בין אותם הפוסטים בכל ביקור? כשנרשמים לחשבון, תמיד תחזרו בדיוק למקום שבו הייתם קודם, ותוכלו לבחור לקבל התראות על תגובות חדשות (בין אם במייל, ובין אם בהתראת פוש). תוכלו גם לשמור סימניות ולפרגן ב-upvote לפוסטים כדי להביע הערכה לחברי קהילה אחרים.
בעזרת התרומה שלך, הפוסט הזה יכול להיות אפילו טוב יותר 💗
הרשמה התחברות