[mirotalk] - improve Sentry logs

This commit is contained in:
Miroslav Pejic
2025-07-03 21:04:50 +02:00
parent 66d2de7a22
commit a2152c04e8
6 changed files with 28 additions and 20 deletions
+1
View File
@@ -130,6 +130,7 @@ REDIRECT_URL='https://p2p.mirotalk.com'
# 3. Goto Settings/Projects/YourProjectName/Client Keys (DSN)
SENTRY_ENABLED=false # true or false
SENTRY_LOG_LEVELS=error # Log levels to capture in Sentry (e.g., error,warn)
SENTRY_DSN=YourClientKeyDSN
SENTRY_TRACES_SAMPLE_RATE=0.5
+21 -14
View File
@@ -45,7 +45,7 @@ dependencies: {
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.23
* @version 1.5.24
*
*/
@@ -234,20 +234,27 @@ if (sentryEnabled && typeof sentryDSN === 'string' && sentryDSN.trim()) {
tracesSampleRate: sentryTracesSampleRate,
});
const originalWarn = console.warn;
const originalError = console.error;
const logLevels = process.env.SENTRY_LOG_LEVELS
? process.env.SENTRY_LOG_LEVELS.split(',').map((level) => level.trim())
: ['error'];
console.warn = function (...args) {
Sentry.captureMessage(args.join(' '), 'warning');
originalWarn.apply(console, args);
};
console.error = function (...args) {
args[0] instanceof Error
? Sentry.captureException(args[0])
: Sentry.captureException(new Error(args.join(' ')));
originalError.apply(console, 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(' ')));
break;
}
originalConsole[level].apply(console, args);
};
});
// log.error('Sentry error', { foo: 'bar' });
// log.warn('Sentry warning');
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "mirotalk",
"version": "1.5.23",
"version": "1.5.24",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mirotalk",
"version": "1.5.23",
"version": "1.5.24",
"license": "AGPL-3.0",
"dependencies": {
"@mattermost/client": "10.8.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "mirotalk",
"version": "1.5.23",
"version": "1.5.24",
"description": "A free WebRTC browser-based video call",
"main": "server.js",
"scripts": {
+1 -1
View File
@@ -73,7 +73,7 @@ let brand = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: 'WebRTC P2P v1.5.23',
title: 'WebRTC P2P v1.5.24',
html: `
<button
id="support-button"
+2 -2
View File
@@ -15,7 +15,7 @@
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.23
* @version 1.5.24
*
*/
@@ -11239,7 +11239,7 @@ function showAbout() {
Swal.fire({
background: swBg,
position: 'center',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.23',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.24',
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
customClass: { image: 'img-about' },
html: `