Refactor: Implement logging phases

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 17:08:36 +00:00
parent 12de4e2ec1
commit b6179372e6
27 changed files with 72 additions and 45 deletions

View File

@@ -23,6 +23,7 @@ import { User, MapPin, Calendar, Star, Trophy, Settings, Camera, Edit3, Save, X,
import { Profile as ProfileType } from '@/types/database';
import { supabase } from '@/integrations/supabase/client';
import { useToast } from '@/hooks/use-toast';
import { logger } from '@/lib/logger';
import { getErrorMessage } from '@/lib/errorHandler';
import { PhotoUpload } from '@/components/upload/PhotoUpload';
import { profileEditSchema } from '@/lib/validation';
@@ -215,7 +216,7 @@ export default function Profile() {
parkCount: parkCount
});
} catch (error) {
console.error('Error fetching calculated stats:', error);
logger.error('Error fetching calculated stats', { error });
toast({
variant: 'destructive',
description: getErrorMessage(error),
@@ -379,7 +380,7 @@ export default function Profile() {
setRecentActivity(combined);
} catch (error) {
console.error('Error fetching recent activity:', error);
logger.error('Error fetching recent activity', { error });
toast({
variant: 'destructive',
description: getErrorMessage(error),
@@ -440,7 +441,7 @@ export default function Profile() {
await fetchRecentActivity(data.user_id || '');
}
} catch (error) {
console.error('Error fetching profile:', error);
logger.error('Error fetching profile', { error });
toast({
variant: "destructive",
title: "Error loading profile",
@@ -481,7 +482,7 @@ export default function Profile() {
await fetchRecentActivity(user.id);
}
} catch (error) {
console.error('Error fetching profile:', error);
logger.error('Error fetching profile', { error });
toast({
variant: "destructive",
title: "Error loading profile",