[mirotalksfu] - logs refactoring

هذا الالتزام موجود في:
Miroslav Pejic
2025-11-04 15:56:55 +01:00
الأصل 274d63c516
التزام b26825f999
6 ملفات معدلة مع 23 إضافات و23 حذوفات

عرض الملف

@@ -44,7 +44,7 @@ function fixDurationOrRemux(inputPath, durationMs) {
if (hasFfmpeg() && (isWebm || isMp4)) { if (hasFfmpeg() && (isWebm || isMp4)) {
const ok = remuxWithFfmpeg(inputPath, isMp4 ? 'mp4' : 'webm'); const ok = remuxWithFfmpeg(inputPath, isMp4 ? 'mp4' : 'webm');
log.info('ffmpeg detected remuxWithFfmpeg:', ok); log.debug('ffmpeg detected remuxWithFfmpeg:', ok);
if (ok) return true; if (ok) return true;
} }
@@ -53,11 +53,11 @@ function fixDurationOrRemux(inputPath, durationMs) {
const outBuf = fixWebmDurationBuffer(inBuf, Number(durationMs)); const outBuf = fixWebmDurationBuffer(inBuf, Number(durationMs));
if (outBuf && outBuf.length) { if (outBuf && outBuf.length) {
fs.writeFileSync(inputPath, outBuf); fs.writeFileSync(inputPath, outBuf);
log.info('No ffmpeg detected fixWebmDurationBuffer - true'); log.debug('No ffmpeg detected fixWebmDurationBuffer - true');
return true; return true;
} }
} }
log.info('No ffmpeg detected fixWebmDurationBuffer - false'); log.debug('No ffmpeg detected fixWebmDurationBuffer - false');
return false; return false;
} }

عرض الملف

@@ -38,7 +38,7 @@ class RtmpFile {
'-f flv', // Output format '-f flv', // Output format
]) ])
.output(rtmpUrl) .output(rtmpUrl)
.on('start', (commandLine) => log.info('ffmpeg process starting with command:', commandLine)) .on('start', (commandLine) => log.debug('ffmpeg process starting with command:', commandLine))
.on('progress', (progress) => { .on('progress', (progress) => {
/* log.debug('Processing', progress); */ /* log.debug('Processing', progress); */
}) })
@@ -49,13 +49,13 @@ class RtmpFile {
} }
}) })
.on('end', () => { .on('end', () => {
log.info('FFmpeg processing finished'); log.debug('FFmpeg processing finished');
this.ffmpegProcess = null; this.ffmpegProcess = null;
this.handleEnd(); this.handleEnd();
}) })
.run(); .run();
log.info('RtmpFile started', rtmpUrl); log.debug('RtmpFile started', rtmpUrl);
return true; return true;
} catch (error) { } catch (error) {
log.error('Error starting RtmpFile', error.message); log.error('Error starting RtmpFile', error.message);
@@ -68,7 +68,7 @@ class RtmpFile {
try { try {
this.ffmpegProcess.kill('SIGTERM'); this.ffmpegProcess.kill('SIGTERM');
this.ffmpegProcess = null; this.ffmpegProcess = null;
log.info('RtmpFile stopped'); log.debug('RtmpFile stopped');
return true; return true;
} catch (error) { } catch (error) {
log.error('Error stopping RtmpFile', error.message); log.error('Error stopping RtmpFile', error.message);

عرض الملف

@@ -31,7 +31,7 @@ class RtmpStreamer {
.audioBitrate('128k') .audioBitrate('128k')
.outputOptions(['-f flv']) .outputOptions(['-f flv'])
.output(this.rtmpUrl) .output(this.rtmpUrl)
.on('start', (commandLine) => this.log.info('ffmpeg command', { id: this.rtmpKey, cmd: commandLine })) .on('start', (commandLine) => this.log.debug('ffmpeg command', { id: this.rtmpKey, cmd: commandLine }))
.on('progress', (progress) => { .on('progress', (progress) => {
/* log.debug('Processing', progress); */ /* log.debug('Processing', progress); */
}) })
@@ -42,7 +42,7 @@ class RtmpStreamer {
this.end(); this.end();
}) })
.on('end', () => { .on('end', () => {
this.log.info('FFmpeg process ended', this.rtmpKey); this.log.debug('FFmpeg process ended', this.rtmpKey);
this.end(); this.end();
}) })
.run(); .run();
@@ -60,12 +60,12 @@ class RtmpStreamer {
if (this.stream) { if (this.stream) {
this.stream.end(); this.stream.end();
this.stream = null; this.stream = null;
this.log.info('RTMP streaming stopped', this.rtmpKey); this.log.debug('RTMP streaming stopped', this.rtmpKey);
} }
if (this.ffmpegStream && !this.ffmpegStream.killed) { if (this.ffmpegStream && !this.ffmpegStream.killed) {
this.ffmpegStream.kill('SIGTERM'); this.ffmpegStream.kill('SIGTERM');
this.ffmpegStream = null; this.ffmpegStream = null;
this.log.info('FFMPEG closed successfully', this.rtmpKey); this.log.debug('FFMPEG closed successfully', this.rtmpKey);
} }
this.run = false; this.run = false;
} }

عرض الملف

@@ -34,7 +34,7 @@ class RtmpUrl {
.size('1280x720') // Scale video to 1280x720 resolution .size('1280x720') // Scale video to 1280x720 resolution
.format('flv') // Set output format to FLV .format('flv') // Set output format to FLV
.output(rtmpUrl) .output(rtmpUrl)
.on('start', (commandLine) => log.info('ffmpeg process starting with command:', commandLine)) .on('start', (commandLine) => log.debug('ffmpeg process starting with command:', commandLine))
.on('progress', (progress) => { .on('progress', (progress) => {
/* log.debug('Processing', progress); */ /* log.debug('Processing', progress); */
}) })
@@ -45,13 +45,13 @@ class RtmpUrl {
} }
}) })
.on('end', () => { .on('end', () => {
log.info('FFmpeg processing finished'); log.debug('FFmpeg processing finished');
this.ffmpegProcess = null; this.ffmpegProcess = null;
this.handleEnd(); this.handleEnd();
}) })
.run(); .run();
log.info('RtmpUrl started', rtmpUrl); log.debug('RtmpUrl started', rtmpUrl);
return true; return true;
} catch (error) { } catch (error) {
log.error('Error starting RtmpUrl', error.message); log.error('Error starting RtmpUrl', error.message);
@@ -64,7 +64,7 @@ class RtmpUrl {
try { try {
this.ffmpegProcess.kill('SIGTERM'); this.ffmpegProcess.kill('SIGTERM');
this.ffmpegProcess = null; this.ffmpegProcess = null;
log.info('RtmpUrl stopped'); log.debug('RtmpUrl stopped');
return true; return true;
} catch (error) { } catch (error) {
log.error('Error stopping RtmpUrl', error.message); log.error('Error stopping RtmpUrl', error.message);

عرض الملف

@@ -3487,11 +3487,11 @@ function startServer() {
const activeRooms = getActiveRooms(); const activeRooms = getActiveRooms();
log.info('[Disconnect] - Last peer - current active rooms', activeRooms); log.debug('[Disconnect] - Last peer - current active rooms', activeRooms);
const activeStreams = getRTMPActiveStreams(); const activeStreams = getRTMPActiveStreams();
log.info('[Disconnect] - Last peer - current active RTMP streams', activeStreams); log.debug('[Disconnect] - Last peer - current active RTMP streams', activeStreams);
} }
removeIP(socket); removeIP(socket);
@@ -3546,11 +3546,11 @@ function startServer() {
const activeRooms = getActiveRooms(); const activeRooms = getActiveRooms();
log.info('[REMOVE ME] - Last peer - current active rooms', activeRooms); log.debug('[REMOVE ME] - Last peer - current active rooms', activeRooms);
const activeStreams = getRTMPActiveStreams(); const activeStreams = getRTMPActiveStreams();
log.info('[REMOVE ME] - Last peer - current active RTMP streams', activeStreams); log.debug('[REMOVE ME] - Last peer - current active RTMP streams', activeStreams);
} }
removeIP(socket); removeIP(socket);
@@ -3681,12 +3681,12 @@ function startServer() {
if (room.isRtmpFileStreamerActive()) { if (room.isRtmpFileStreamerActive()) {
room.stopRTMP(); room.stopRTMP();
rtmpFileStreamsCount--; rtmpFileStreamsCount--;
log.info('[REMOVE ME] - Stop RTMP Stream From FIle', rtmpFileStreamsCount); log.debug('[REMOVE ME] - Stop RTMP Stream From FIle', rtmpFileStreamsCount);
} }
if (room.isRtmpUrlStreamerActive()) { if (room.isRtmpUrlStreamerActive()) {
room.stopRTMPfromURL(); room.stopRTMPfromURL();
rtmpUrlStreamsCount--; rtmpUrlStreamsCount--;
log.info('[REMOVE ME] - Stop RTMP Stream From URL', rtmpUrlStreamsCount); log.debug('[REMOVE ME] - Stop RTMP Stream From URL', rtmpUrlStreamsCount);
} }
} }
} }

عرض الملف

@@ -53,7 +53,7 @@ const transport = nodemailer.createTransport({
function sendEmailAlert(event, data) { function sendEmailAlert(event, data) {
if (!EMAIL_ALERT || !EMAIL_HOST || !EMAIL_PORT || !EMAIL_USERNAME || !EMAIL_PASSWORD || !EMAIL_SEND_TO) return; if (!EMAIL_ALERT || !EMAIL_HOST || !EMAIL_PORT || !EMAIL_USERNAME || !EMAIL_PASSWORD || !EMAIL_SEND_TO) return;
log.info('sendEMailAlert', { log.debug('sendEMailAlert', {
event: event, event: event,
data: data, data: data,
}); });
@@ -88,7 +88,7 @@ function sendEmailAlert(event, data) {
function sendEmailNotifications(event, data, notifications) { function sendEmailNotifications(event, data, notifications) {
if (!EMAIL_NOTIFY || !EMAIL_HOST || !EMAIL_PORT || !EMAIL_USERNAME || !EMAIL_PASSWORD) return; if (!EMAIL_NOTIFY || !EMAIL_HOST || !EMAIL_PORT || !EMAIL_USERNAME || !EMAIL_PASSWORD) return;
log.info('sendEmailNotifications', { log.debug('sendEmailNotifications', {
event: event, event: event,
data: data, data: data,
notifications: notifications, notifications: notifications,