File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ export type DockerComposeConfigVolumesResult = {
6565
6666export interface IDockerComposeLogOptions extends IDockerComposeOptions {
6767 follow ?: boolean
68+ timestamps ?: boolean
6869}
6970
7071export interface IDockerComposeBuildOptions extends IDockerComposeOptions {
@@ -675,10 +676,13 @@ export const logs = function (
675676 services : string | string [ ] ,
676677 options : IDockerComposeLogOptions = { }
677678) : Promise < IDockerComposeResult > {
678- let args = Array . isArray ( services ) ? services : [ services ]
679+ const args = Array . isArray ( services ) ? services : [ services ]
679680
680681 if ( options . follow ) {
681- args = [ '--follow' , ...args ]
682+ args . unshift ( '--follow' )
683+ }
684+ if ( options . timestamps ) {
685+ args . unshift ( '--timestamps' )
682686 }
683687
684688 return execCompose ( 'logs' , args , options )
Original file line number Diff line number Diff line change @@ -890,6 +890,18 @@ describe('logs command', (): void => {
890890 expect ( std . out . includes ( 'compose_test_proxy' ) ) . toBeTruthy ( )
891891 await compose . downAll ( { cwd : path . join ( __dirname ) , log : logOutput } )
892892 } )
893+
894+ it ( 'does include timestamps' , async ( ) : Promise < void > => {
895+ await compose . upAll ( { cwd : path . join ( __dirname ) , log : logOutput } )
896+ const std = await compose . logs ( 'proxy' , {
897+ cwd : path . join ( __dirname ) ,
898+ log : logOutput ,
899+ timestamps : true
900+ } )
901+
902+ expect ( std . out . includes ( 'compose_test_proxy' ) ) . toBeTruthy ( )
903+ await compose . downAll ( { cwd : path . join ( __dirname ) , log : logOutput } )
904+ } )
893905} )
894906
895907describe ( 'port command' , ( ) : void => {
You can’t perform that action at this time.
0 commit comments