11import { Command } from "@commander-js/extra-typings" ;
22import { execa } from "execa" ;
3- import { getProjectName } from "../base.js" ;
3+ import { getProjectName , getServiceInfo } from "../base.js" ;
44
55export const createLogsCommand = ( ) => {
66 return new Command ( "logs" )
@@ -10,7 +10,6 @@ export const createLogsCommand = () => {
1010 "name of project (used by docker compose and cartesi-rollups-node)" ,
1111 )
1212 . option ( "-f, --follow" , "Follow log output" )
13- . option ( "--no-color" , "Produce monochrome output" )
1413 . option (
1514 "--since <string>" ,
1615 "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)" ,
@@ -26,24 +25,25 @@ export const createLogsCommand = () => {
2625 )
2726 . configureHelp ( { showGlobalOptions : true } )
2827 . action ( async ( options ) => {
29- const { follow, color , since, tail, until } = options ;
28+ const { follow, since, tail, until } = options ;
3029 const projectName = getProjectName ( options ) ;
31- const logOptions : string [ ] = [ "--no-log-prefix" ] ;
30+ const logOptions : string [ ] = [ ] ;
3231 if ( follow ) logOptions . push ( "--follow" ) ;
33- if ( color === false ) logOptions . push ( "--no-color" ) ;
3432 if ( since ) logOptions . push ( "--since" , since ) ;
3533 if ( tail ) logOptions . push ( "--tail" , tail ) ;
3634 if ( until ) logOptions . push ( "--until" , until ) ;
35+
36+ const serviceInfo = await getServiceInfo ( {
37+ projectName,
38+ service : "rollups-node" ,
39+ } ) ;
40+ if ( ! serviceInfo ) {
41+ throw new Error ( `service rollups-node not found` ) ;
42+ }
43+
3744 await execa (
3845 "docker" ,
39- [
40- "compose" ,
41- "--project-name" ,
42- projectName ,
43- "logs" ,
44- ...logOptions ,
45- "rollups-node" ,
46- ] ,
46+ [ "container" , "logs" , ...logOptions , serviceInfo . ID ] ,
4747 { stdio : "inherit" } ,
4848 ) ;
4949 } ) ;
0 commit comments