AI/ML
Error Log Card - ML System Error Monitoring
Track and visualize system errors and exceptions in ML pipelines. Monitor error trends, severity levels, and troubleshoot issues efficiently.
Error Log Card
The Error Log Card displays recent errors and exceptions from machine learning systems, helping teams quickly identify and debug issues.
Preview
Installation
npx shadcn@latest add https://vectormotion.vercel.app/registry/error-log-card.jsonError Log Card
'use client'import React from 'react';import { AlertCircle, AlertTriangle, XCircle } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx"import { twMerge } from "tailwind-merge"import { ResponsiveContainer, BarChart, Bar, XAxis, YAxis, Tooltip, Cell, Legend } from 'recharts';function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs))}interface ErrorData { type: string; count: number; fill: string; [key: string]: any;}interface ErrorLogCardProps { className?: string; title?: string; totalExceptions?: number; timeRange?: string; data?: ErrorData[];}const DEFAULT_DATA: ErrorData[] = [ { type: 'Timeout', count: 14, fill: '#ef4444' }, // Red-500 { type: 'OOM', count: 3, fill: '#f97316' }, // Orange-500 { type: 'Auth', count: 8, fill: '#eab308' }, // Yellow-500];const DEFAULT_TITLE = "Exceptions";const DEFAULT_TOTAL_EXCEPTIONS = 25;const DEFAULT_TIME_RANGE = "Last 24h";export const ErrorLogCard: React.FC<ErrorLogCardProps> = ({ className = "", title = DEFAULT_TITLE, totalExceptions = DEFAULT_TOTAL_EXCEPTIONS, timeRange = DEFAULT_TIME_RANGE, data = DEFAULT_DATA,}) => { return ( <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: 0.2 }} className={cn( "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-red-300 dark:hover:border-red-700 hover:shadow-md flex flex-col h-full", className )} > <div className="p-5 flex flex-col h-full relative z-10"> <div className="mb-4 flex items-start justify-between"> <div> <h3 className="font-bold text-lg text-foreground"> {title} </h3> <div className="flex items-center gap-2 mt-1"> <span className="text-2xl font-bold text-foreground">{totalExceptions}</span> <span className="text-xs font-medium text-red-500 bg-red-50 dark:bg-red-900/20 px-1.5 py-0.5 rounded-full"> {timeRange} </span> </div> </div> <div className="rounded-lg border-2 border-red-100 dark:border-red-800 p-2 text-red-500 dark:text-red-400 flex items-center justify-center"> <AlertCircle className="h-5 w-5" /> </div> </div> <div className="flex-1 w-full min-h-[140px] relative"> <ResponsiveContainer width="100%" height="100%"> <BarChart data={data} layout="vertical" margin={{ left: 10, right: 10 }}> <XAxis type="number" hide /> <YAxis type="category" dataKey="type" tick={{ fontSize: 10, fill: '#71717a' }} width={50} axisLine={false} tickLine={false} /> <Tooltip cursor={{ fill: 'transparent' }} content={({ active, payload }) => { if (active && payload && payload.length) { return ( <div className="rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 p-2 shadow-sm text-xs"> <span className="font-bold text-foreground"> {payload[0].payload.type}: </span> {payload[0].value} events </div> ); } return null; }} /> <Bar dataKey="count" radius={[0, 4, 4, 0]} barSize={20}> {data.map((entry, index) => ( <Cell key={`cell-${index}`} fill={entry.fill} /> ))} </Bar> </BarChart> </ResponsiveContainer> </div> <div className="flex items-center gap-2 text-[10px] text-muted-foreground mt-2 justify-center border-t border-border pt-2"> <span className="flex items-center gap-1"><div className="w-2 h-2 rounded-full bg-red-500" />Critical</span> <span className="flex items-center gap-1"><div className="w-2 h-2 rounded-full bg-orange-500" />Warning</span> <span className="flex items-center gap-1"><div className="w-2 h-2 rounded-full bg-yellow-500" />Info</span> </div> <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none"> <XCircle className="w-40 h-40 text-red-500" /> </div> </div> </motion.div> );};Props
Prop
Type
Usage
This component is a demo card displaying error logs with animated visualizations and dark mode support.