@@ -9,6 +9,7 @@ import { renderServicesTable } from './lib/ui.js';
99import { runDev } from './lib/dev.js' ;
1010import { startAdminDashboard } from './lib/admin.js' ;
1111import { runHotReload } from './lib/hotreload.js' ;
12+ import { viewLogs } from './lib/logs.js' ;
1213
1314const program = new Command ( ) ;
1415
@@ -177,6 +178,27 @@ program
177178 process . exit ( 1 ) ;
178179 }
179180 } ) ;
181+
182+ // Service logs viewer and management
183+ program
184+ . command ( 'logs' )
185+ . description ( 'View and manage service logs' )
186+ . argument ( '[service]' , 'Specific service name (optional, shows all services if omitted)' )
187+ . option ( '-f, --follow' , 'Follow log output in real-time' )
188+ . option ( '-t, --tail <lines>' , 'Number of recent lines to show (default: 50)' , '50' )
189+ . option ( '--since <time>' , 'Show logs since timestamp (ISO format or relative like "1h", "30m")' )
190+ . option ( '--filter <pattern>' , 'Filter logs by pattern (regex supported)' )
191+ . option ( '--level <level>' , 'Filter by log level (error, warn, info, debug)' )
192+ . option ( '--export <format>' , 'Export logs to file (json, csv, txt)' )
193+ . option ( '--clear' , 'Clear all logs for the specified service(s)' )
194+ . action ( async ( serviceName , opts ) => {
195+ try {
196+ await viewLogs ( serviceName , opts ) ;
197+ } catch ( e ) {
198+ console . error ( chalk . red ( 'Failed to view logs:' ) , e . message ) ;
199+ process . exit ( 1 ) ;
200+ }
201+ } ) ;
180202
181203program . parse ( ) ;
182204
0 commit comments