[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_ENABLED=false # Enable Sentry error tracking (true|false)
SENTRY_LOG_LEVELS=error # Log levels to capture (comma-separated)
SENTRY_DSN= # Sentry DSN URL
SENTRY_TRACES_SAMPLE_RATE=0.2 # Error sampling rate (0-1)

عرض الملف

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

عرض الملف

@@ -830,6 +830,7 @@ module.exports = {
* Core Settings:
* -------------
* enabled : Enable/disable Sentry [true/false] (default: false)
* logLevels : Array of log levels to capture (default: ['error'])
* DSN : Data Source Name (from Sentry dashboard)
* tracesSampleRate : Percentage of transactions to capture (0.0-1.0)
*
@@ -842,6 +843,9 @@ module.exports = {
*/
sentry: {
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 || '',
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",
"version": "1.8.78",
"version": "1.8.79",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mirotalksfu",
"version": "1.8.78",
"version": "1.8.79",
"license": "AGPL-3.0",
"dependencies": {
"@aws-sdk/client-s3": "^3.842.0",

عرض الملف

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

عرض الملف

@@ -64,7 +64,7 @@ let BRAND = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: '<strong>WebRTC SFU v1.8.78</strong>',
title: '<strong>WebRTC SFU v1.8.79</strong>',
html: `
<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 CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.8.78
* @version 1.8.79
*
*/
@@ -5479,7 +5479,7 @@ function showAbout() {
position: 'center',
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.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: `
<br />
<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 CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.8.78
* @version 1.8.79
*
*/