Skip to content

Commit

Permalink
More format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschmeling committed Apr 22, 2024
1 parent d1d05c4 commit 89139ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions __tests__/bin/vip-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe( 'getLogs', () => {
},
type: 'app',
limit: 500,
format: 'text',
format: 'table',
};
} );

Expand Down Expand Up @@ -81,7 +81,7 @@ describe( 'getLogs', () => {
type: 'app',
limit: 500,
follow: false,
format: 'text',
format: 'table',
};

expect( tracker.trackEvent ).toHaveBeenCalledTimes( 2 );
Expand Down Expand Up @@ -253,7 +253,7 @@ describe( 'getLogs', () => {
type: 'app',
limit: 500,
follow: false,
format: 'text',
format: 'table',
};

expect( tracker.trackEvent ).toHaveBeenCalledTimes( 2 );
Expand Down Expand Up @@ -296,7 +296,7 @@ describe( 'getLogs', () => {

expect( exit.withError ).toHaveBeenCalledTimes( 1 );
expect( exit.withError ).toHaveBeenCalledWith(
'Invalid format: jso. The supported formats are: csv, json, text.'
'Invalid format: jso. The supported formats are: csv, json, table.'
);

expect( logsLib.getRecentLogs ).not.toHaveBeenCalled();
Expand Down
8 changes: 4 additions & 4 deletions __tests__/bin/vip-slowlogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe( 'getSlowlogs', () => {
isK8sResident: true,
},
limit: 500,
format: 'text',
format: 'table',
};
} );

Expand Down Expand Up @@ -105,7 +105,7 @@ describe( 'getSlowlogs', () => {
env_id: 3,
limit: 500,
follow: false,
format: 'text',
format: 'table',
};

expect( tracker.trackEvent ).toHaveBeenCalledTimes( 2 );
Expand Down Expand Up @@ -270,7 +270,7 @@ describe( 'getSlowlogs', () => {
env_id: 3,
limit: 500,
follow: false,
format: 'text',
format: 'table',
};

expect( tracker.trackEvent ).toHaveBeenNthCalledWith(
Expand Down Expand Up @@ -309,7 +309,7 @@ describe( 'getSlowlogs', () => {
env_id: 3,
limit: 500,
follow: false,
format: 'text',
format: 'table',
};

expect( tracker.trackEvent ).toHaveBeenCalledTimes( 2 );
Expand Down
6 changes: 3 additions & 3 deletions src/bin/vip-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { trackEvent } from '../lib/tracker';
const LIMIT_MIN = 1;
const LIMIT_MAX = 5000;
const ALLOWED_TYPES = [ 'app', 'batch' ];
const ALLOWED_FORMATS = [ 'csv', 'json', 'text' ];
const ALLOWED_FORMATS = [ 'csv', 'json', 'table' ];
const DEFAULT_POLLING_DELAY_IN_SECONDS = 30;
const MIN_POLLING_DELAY_IN_SECONDS = 5;
const MAX_POLLING_DELAY_IN_SECONDS = 300;
Expand Down Expand Up @@ -142,7 +142,7 @@ function printLogs( logs, format ) {
} );

let output = '';
if ( format && 'text' === format ) {
if ( format && 'table' === format ) {
const rows = [];
for ( const { timestamp, message } of logs ) {
rows.push( `${ timestamp } ${ message }` );
Expand Down Expand Up @@ -204,7 +204,7 @@ command( {
.option( 'type', 'The type of logs to be returned: "app" or "batch"', 'app' )
.option( 'limit', 'The maximum number of log lines', 500 )
.option( 'follow', 'Keep fetching new logs as they are generated' )
.option( 'format', 'Output the log lines in CSV or JSON format', 'text' )
.option( 'format', 'Output the log lines in CSV or JSON format', 'table' )
.examples( [
{
usage: 'vip @mysite.production logs',
Expand Down

0 comments on commit 89139ad

Please sign in to comment.