[mirotalksfu] - improve Sentry logs

هذا الالتزام موجود في:
Miroslav Pejic
2025-07-03 20:59:21 +02:00
الأصل 5c4e110f23
التزام 3292e7d058
8 ملفات معدلة مع 32 إضافات و21 حذوفات

عرض الملف

@@ -189,6 +189,7 @@ NGROK_AUTH_TOKEN= # Ngrok authentication token
# Sentry Error Tracking # Sentry Error Tracking
SENTRY_ENABLED=false # Enable Sentry error tracking (true|false) SENTRY_ENABLED=false # Enable Sentry error tracking (true|false)
SENTRY_LOG_LEVELS=error # Log levels to capture (comma-separated)
SENTRY_DSN= # Sentry DSN URL SENTRY_DSN= # Sentry DSN URL
SENTRY_TRACES_SAMPLE_RATE=0.2 # Error sampling rate (0-1) SENTRY_TRACES_SAMPLE_RATE=0.2 # Error sampling rate (0-1)

عرض الملف

@@ -178,7 +178,7 @@ const restApi = {
// Sentry monitoring // Sentry monitoring
const sentryEnabled = config.integrations?.sentry?.enabled || false; const sentryEnabled = config.integrations?.sentry?.enabled || false;
const sentryDSN = config.integrations.sentry.DSN; const sentryDSN = config.integrations.sentry.DSN;
const sentryTracesSampleRate = parseFloat(config.integrations.sentry.tracesSampleRate || '0.0'); const sentryTracesSampleRate = config.integrations.sentry.tracesSampleRate;
if (sentryEnabled && typeof sentryDSN === 'string' && sentryDSN.trim()) { if (sentryEnabled && typeof sentryDSN === 'string' && sentryDSN.trim()) {
log.info('Sentry monitoring started...'); log.info('Sentry monitoring started...');
@@ -187,20 +187,26 @@ if (sentryEnabled && typeof sentryDSN === 'string' && sentryDSN.trim()) {
tracesSampleRate: sentryTracesSampleRate, tracesSampleRate: sentryTracesSampleRate,
}); });
const originalWarn = console.warn; // Accept logLevels as an array, e.g., ['warn', 'error']
const originalError = console.error; const logLevels = config.integrations?.sentry?.logLevels || ['error'];
console.warn = function (...args) { const originalConsole = {};
//Sentry.captureMessage(args.join(' '), 'warning'); logLevels.forEach((level) => {
originalWarn.apply(console, args); originalConsole[level] = console[level];
}; console[level] = function (...args) {
switch (level) {
console.error = function (...args) { case 'warn':
Sentry.captureMessage(args.join(' '), 'warning');
break;
case 'error':
args[0] instanceof Error args[0] instanceof Error
? Sentry.captureException(args[0]) ? Sentry.captureException(args[0])
: Sentry.captureException(new Error(args.join(' '))); : Sentry.captureException(new Error(args.join(' ')));
originalError.apply(console, args); break;
}
originalConsole[level].apply(console, args);
}; };
});
// log.error('Sentry error', { foo: 'bar' }); // log.error('Sentry error', { foo: 'bar' });
// log.warn('Sentry warning'); // log.warn('Sentry warning');

عرض الملف

@@ -830,6 +830,7 @@ module.exports = {
* Core Settings: * Core Settings:
* ------------- * -------------
* enabled : Enable/disable Sentry [true/false] (default: false) * enabled : Enable/disable Sentry [true/false] (default: false)
* logLevels : Array of log levels to capture (default: ['error'])
* DSN : Data Source Name (from Sentry dashboard) * DSN : Data Source Name (from Sentry dashboard)
* tracesSampleRate : Percentage of transactions to capture (0.0-1.0) * tracesSampleRate : Percentage of transactions to capture (0.0-1.0)
* *
@@ -842,6 +843,9 @@ module.exports = {
*/ */
sentry: { sentry: {
enabled: process.env.SENTRY_ENABLED === 'true', enabled: process.env.SENTRY_ENABLED === 'true',
logLevels: process.env.SENTRY_LOG_LEVELS
? process.env.SENTRY_LOG_LEVELS.split(splitChar).map((level) => level.trim())
: ['error'],
DSN: process.env.SENTRY_DSN || '', DSN: process.env.SENTRY_DSN || '',
tracesSampleRate: Math.min(Math.max(parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE) || 0.5, 0), 1), tracesSampleRate: Math.min(Math.max(parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE) || 0.5, 0), 1),
}, },

4
package-lock.json مولّد
عرض الملف

@@ -1,12 +1,12 @@
{ {
"name": "mirotalksfu", "name": "mirotalksfu",
"version": "1.8.78", "version": "1.8.79",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mirotalksfu", "name": "mirotalksfu",
"version": "1.8.78", "version": "1.8.79",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.842.0", "@aws-sdk/client-s3": "^3.842.0",

عرض الملف

@@ -1,6 +1,6 @@
{ {
"name": "mirotalksfu", "name": "mirotalksfu",
"version": "1.8.78", "version": "1.8.79",
"description": "WebRTC SFU browser-based video calls", "description": "WebRTC SFU browser-based video calls",
"main": "Server.js", "main": "Server.js",
"scripts": { "scripts": {

عرض الملف

@@ -64,7 +64,7 @@ let BRAND = {
}, },
about: { about: {
imageUrl: '../images/mirotalk-logo.gif', imageUrl: '../images/mirotalk-logo.gif',
title: '<strong>WebRTC SFU v1.8.78</strong>', title: '<strong>WebRTC SFU v1.8.79</strong>',
html: ` html: `
<button <button
id="support-button" id="support-button"

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com * @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.8.78 * @version 1.8.79
* *
*/ */
@@ -5479,7 +5479,7 @@ function showAbout() {
position: 'center', position: 'center',
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about, imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
customClass: { image: 'img-about' }, customClass: { image: 'img-about' },
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.8.78', title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.8.79',
html: ` html: `
<br /> <br />
<div id="about"> <div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com * @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.8.78 * @version 1.8.79
* *
*/ */