mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 10:16:49 +00:00
- add a shared structured logging service with bounded retention - expose native /api/logs endpoints and the dashboard /logs route - wire focused runtime emitters, cleanup support, and feature tests Refs #926
19 lines
474 B
TypeScript
19 lines
474 B
TypeScript
import type { LogEntry } from './log-types';
|
|
|
|
let recentEntries: LogEntry[] = [];
|
|
|
|
export function pushRecentLogEntry(entry: LogEntry, maxEntries: number): void {
|
|
recentEntries.push(entry);
|
|
if (recentEntries.length > maxEntries) {
|
|
recentEntries = recentEntries.slice(recentEntries.length - maxEntries);
|
|
}
|
|
}
|
|
|
|
export function getRecentLogEntries(): LogEntry[] {
|
|
return [...recentEntries];
|
|
}
|
|
|
|
export function clearRecentLogEntries(): void {
|
|
recentEntries = [];
|
|
}
|