Disabled console debug log Statements from the production build output
This commit is contained in:
@@ -25,7 +25,7 @@ export function ServiceUptimeHistory({
|
||||
const { data: uptimeHistory, isLoading, error } = useQuery({
|
||||
queryKey: ['uptimeHistory', serviceId, serviceType, startDate?.toISOString(), endDate?.toISOString()],
|
||||
queryFn: () => {
|
||||
console.log(`ServiceUptimeHistory: Fetching for service ${serviceId} of type ${serviceType}`);
|
||||
// console.log(`ServiceUptimeHistory: Fetching for service ${serviceId} of type ${serviceType}`);
|
||||
return uptimeService.getUptimeHistory(serviceId, 200, startDate, endDate, serviceType);
|
||||
},
|
||||
enabled: !!serviceId && !!serviceType,
|
||||
|
||||
@@ -22,11 +22,11 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
|
||||
const notificationChannels = form.watch("notificationChannels") || [];
|
||||
const alertTemplate = form.watch("alertTemplate");
|
||||
|
||||
console.log("Current notification values:", {
|
||||
notificationStatus,
|
||||
notificationChannels,
|
||||
alertTemplate
|
||||
});
|
||||
// console.log("Current notification values:", {
|
||||
// notificationStatus,
|
||||
// notificationChannels,
|
||||
// alertTemplate
|
||||
// });
|
||||
|
||||
// Fetch alert configurations for notification channels
|
||||
const { data: alertConfigsData } = useQuery({
|
||||
@@ -42,16 +42,16 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
|
||||
setAlertConfigs(enabledChannels);
|
||||
|
||||
// Debug log to check what alert configs are loaded
|
||||
console.log("Loaded alert configurations:", enabledChannels);
|
||||
// console.log("Loaded alert configurations:", enabledChannels);
|
||||
}
|
||||
}, [alertConfigsData]);
|
||||
|
||||
// Log when form values change to debug
|
||||
useEffect(() => {
|
||||
console.log("Notification values changed:", {
|
||||
notificationStatus: form.getValues("notificationStatus"),
|
||||
notificationChannels: form.getValues("notificationChannels")
|
||||
});
|
||||
// console.log("Notification values changed:", {
|
||||
// notificationStatus: form.getValues("notificationStatus"),
|
||||
// notificationChannels: form.getValues("notificationChannels")
|
||||
// });
|
||||
}, [form.watch("notificationStatus"), form.watch("notificationChannels")]);
|
||||
|
||||
const handleChannelAdd = (channelId: string) => {
|
||||
@@ -161,7 +161,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
|
||||
render={({ field }) => {
|
||||
// Don't convert existing values to "default"
|
||||
const displayValue = field.value || "default";
|
||||
console.log("Rendering alert template field with value:", displayValue);
|
||||
// console.log("Rendering alert template field with value:", displayValue);
|
||||
|
||||
return (
|
||||
<FormItem>
|
||||
|
||||
@@ -39,7 +39,7 @@ export const ServiceRowActions = ({
|
||||
try {
|
||||
if (service.status === "paused") {
|
||||
// Resume monitoring
|
||||
console.log(`Resuming monitoring for service ${service.id} (${service.name}) from dropdown`);
|
||||
// console.log(`Resuming monitoring for service ${service.id} (${service.name}) from dropdown`);
|
||||
|
||||
// First ensure we update the status
|
||||
await serviceService.resumeMonitoring(service.id);
|
||||
@@ -53,7 +53,7 @@ export const ServiceRowActions = ({
|
||||
});
|
||||
} else {
|
||||
// Pause monitoring
|
||||
console.log(`Pausing monitoring for service ${service.id} (${service.name}) from dropdown`);
|
||||
// console.log(`Pausing monitoring for service ${service.id} (${service.name}) from dropdown`);
|
||||
await serviceService.pauseMonitoring(service.id);
|
||||
|
||||
toast({
|
||||
@@ -65,7 +65,7 @@ export const ServiceRowActions = ({
|
||||
// Call the parent handler to refresh the UI
|
||||
onPauseResume(service);
|
||||
} catch (error) {
|
||||
console.error("Error toggling monitoring:", error);
|
||||
// console.error("Error toggling monitoring:", error);
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Error",
|
||||
@@ -83,10 +83,10 @@ export const ServiceRowActions = ({
|
||||
|
||||
if (onMuteAlerts) {
|
||||
try {
|
||||
console.log(`Attempting to ${alertsMuted ? 'unmute' : 'mute'} alerts for service ${service.id} (${service.name})`);
|
||||
// console.log(`Attempting to ${alertsMuted ? 'unmute' : 'mute'} alerts for service ${service.id} (${service.name})`);
|
||||
await onMuteAlerts(service);
|
||||
} catch (error) {
|
||||
console.error("Error toggling alerts:", error);
|
||||
// console.error("Error toggling alerts:", error);
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Error",
|
||||
|
||||
@@ -161,6 +161,6 @@ export function useSystemSettings() {
|
||||
isUpdating: updateSettingsMutation.isPending,
|
||||
testEmailConnection: testEmailConnectionMutation.mutate,
|
||||
isTestingConnection: testEmailConnectionMutation.isPending,
|
||||
systemName: settings?.system_name || settings?.meta?.appName || 'ReamStack',
|
||||
systemName: settings?.system_name || settings?.meta?.appName || 'CheckCle',
|
||||
};
|
||||
}
|
||||
@@ -31,8 +31,8 @@ export async function pauseMonitoring(serviceId: string): Promise<void> {
|
||||
|
||||
// We'll skip the notification here since it will be handled by the UI component
|
||||
// This prevents duplicate notifications for the paused status
|
||||
console.log(`Service ${service.name} paused at ${now}, skipping notification to prevent duplication`);
|
||||
// console.log(`Service ${service.name} paused at ${now}, skipping notification to prevent duplication`);
|
||||
} catch (error) {
|
||||
console.error("Error pausing monitoring:", error);
|
||||
// console.error("Error pausing monitoring:", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
||||
// Fetch the current service to get its name for better logging
|
||||
const service = await pb.collection('services').getOne(serviceId);
|
||||
|
||||
console.log(`Resuming service ${service.name} at ${now}`);
|
||||
// console.log(`Resuming service ${service.name} at ${now}`);
|
||||
|
||||
// First, clear any existing interval just to be safe
|
||||
const existingInterval = monitoringIntervals.get(serviceId);
|
||||
@@ -57,7 +57,7 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
||||
const alertsMuted = service.alerts === "muted" || serviceForNotification.alerts === "muted";
|
||||
|
||||
if (!alertsMuted) {
|
||||
console.log(`Alerts NOT muted for service ${service.name}, sending resume notification`);
|
||||
// console.log(`Alerts NOT muted for service ${service.name}, sending resume notification`);
|
||||
// Send notification that service has been resumed
|
||||
await notificationService.sendNotification({
|
||||
service: serviceForNotification,
|
||||
@@ -65,7 +65,7 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
||||
timestamp: now
|
||||
});
|
||||
} else {
|
||||
console.log(`Alerts muted for service ${service.name}, skipping resume notification`);
|
||||
// console.log(`Alerts muted for service ${service.name}, skipping resume notification`);
|
||||
}
|
||||
|
||||
// IMPORTANT: Wait a brief moment to ensure the status update is processed
|
||||
@@ -76,6 +76,6 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
||||
|
||||
console.log(`Service ${service.name} resumed and ready for monitoring`);
|
||||
} catch (error) {
|
||||
console.error("Error resuming service:", error);
|
||||
// console.error("Error resuming service:", error);
|
||||
}
|
||||
}
|
||||
@@ -31,20 +31,20 @@ export const notificationService = {
|
||||
try {
|
||||
const { service, status, responseTime } = data;
|
||||
|
||||
console.log(`Preparing to send notification for service: ${service.name}, status: ${status}`);
|
||||
console.log(`Service alerts status: ${service.alerts}`);
|
||||
// console.log(`Preparing to send notification for service: ${service.name}, status: ${status}`);
|
||||
// console.log(`Service alerts status: ${service.alerts}`);
|
||||
|
||||
// First check if alerts are muted for this service
|
||||
// STRICT equality check against "muted" string value
|
||||
if (service.alerts === "muted") {
|
||||
console.log(`NOTIFICATION BLOCKED: Alerts are muted for service: ${service.name}`);
|
||||
// console.log(`NOTIFICATION BLOCKED: Alerts are muted for service: ${service.name}`);
|
||||
return true; // Return true as this is expected behavior
|
||||
}
|
||||
|
||||
// For paused status, check if this is a duplicate notification from another source
|
||||
// This helps prevent the double-notification issue
|
||||
if (status === "paused" && data._notificationSource === "duplicate_check") {
|
||||
console.log("NOTIFICATION BLOCKED: Duplicate pause notification detected");
|
||||
// console.log("NOTIFICATION BLOCKED: Duplicate pause notification detected");
|
||||
return true; // Return true as this is expected behavior
|
||||
}
|
||||
|
||||
@@ -62,20 +62,20 @@ export const notificationService = {
|
||||
if (timeSinceLastNotif < NOTIFICATION_COOLDOWN) {
|
||||
// Increment count only if we haven't reached max retries
|
||||
if (lastNotif.count < maxRetries) {
|
||||
console.log(`DOWN notification for ${service.name}: ${lastNotif.count + 1}/${maxRetries}`);
|
||||
// console.log(`DOWN notification for ${service.name}: ${lastNotif.count + 1}/${maxRetries}`);
|
||||
lastNotifications[serviceId].count += 1;
|
||||
} else {
|
||||
console.log(`DOWN notification for ${service.name} skipped: Max retries (${maxRetries}) reached. Next notification after cooldown.`);
|
||||
// console.log(`DOWN notification for ${service.name} skipped: Max retries (${maxRetries}) reached. Next notification after cooldown.`);
|
||||
return true; // Skip notification but return success
|
||||
}
|
||||
} else {
|
||||
// Reset count after cooldown period
|
||||
console.log(`Cooldown period elapsed for ${service.name}. Resetting notification count.`);
|
||||
// console.log(`Cooldown period elapsed for ${service.name}. Resetting notification count.`);
|
||||
lastNotifications[serviceId] = { timestamp: now, count: 1 };
|
||||
}
|
||||
} else {
|
||||
// First notification for this service
|
||||
console.log(`First DOWN notification for ${service.name}: 1/${maxRetries}`);
|
||||
// console.log(`First DOWN notification for ${service.name}: 1/${maxRetries}`);
|
||||
lastNotifications[serviceId] = { timestamp: now, count: 1 };
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ export const notificationService = {
|
||||
|
||||
// Check if notification channel is set
|
||||
if (!service.notificationChannel) {
|
||||
console.log(`No notification channel set for service: ${service.name}`);
|
||||
// console.log(`No notification channel set for service: ${service.name}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -93,12 +93,12 @@ export const notificationService = {
|
||||
const alertConfigRecord = await pb.collection('alert_configurations').getOne(service.notificationChannel);
|
||||
|
||||
if (!alertConfigRecord) {
|
||||
console.error(`Alert configuration not found for ID: ${service.notificationChannel}`);
|
||||
// console.error(`Alert configuration not found for ID: ${service.notificationChannel}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!alertConfigRecord.enabled) {
|
||||
console.log(`Alert configuration is disabled for service: ${service.name}`);
|
||||
// console.log(`Alert configuration is disabled for service: ${service.name}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ export const notificationService = {
|
||||
try {
|
||||
template = await templateService.getTemplate(service.alertTemplate);
|
||||
} catch (error) {
|
||||
console.error(`Error fetching template for ID: ${service.alertTemplate}`, error);
|
||||
// console.error(`Error fetching template for ID: ${service.alertTemplate}`, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export const notificationService = {
|
||||
message += `\n\nAlert ${retryInfo.count}/${maxRetries}`;
|
||||
}
|
||||
|
||||
console.log(`Prepared notification message: ${message}`);
|
||||
// console.log(`Prepared notification message: ${message}`);
|
||||
|
||||
// Send notification based on notification type
|
||||
const notificationType = alertConfig.notification_type;
|
||||
@@ -156,10 +156,10 @@ export const notificationService = {
|
||||
}
|
||||
|
||||
// For other types like discord, slack, etc. (not implemented yet)
|
||||
console.log(`Notification type ${notificationType} not implemented yet`);
|
||||
// console.log(`Notification type ${notificationType} not implemented yet`);
|
||||
return false;
|
||||
} catch (error) {
|
||||
console.error("Error sending notification:", error);
|
||||
// console.error("Error sending notification:", error);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -173,10 +173,10 @@ export const notificationService = {
|
||||
? `Service ${serviceName} is UP${responseTime ? ` (Response time: ${responseTime}ms)` : ''}`
|
||||
: `Service ${serviceName} is DOWN`;
|
||||
|
||||
console.log(`Test notification would have been sent: ${message}`);
|
||||
// console.log(`Test notification would have been sent: ${message}`);
|
||||
return true; // Just log, don't actually send
|
||||
} catch (error) {
|
||||
console.error("Error in test notification:", error);
|
||||
// console.error("Error in test notification:", error);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -187,7 +187,7 @@ export const notificationService = {
|
||||
*/
|
||||
resetNotificationCount(serviceId: string): void {
|
||||
if (lastNotifications[serviceId]) {
|
||||
console.log(`Resetting notification count for service ${serviceId}`);
|
||||
// console.log(`Resetting notification count for service ${serviceId}`);
|
||||
delete lastNotifications[serviceId];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user