File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ import moment from 'moment';
4
4
export const generateFileNameWithTimestamp = ( prefix : string = 'logs' , fileType : string = 'zip' ) =>
5
5
`${ prefix } -${ moment . utc ( ) . format ( 'YYYY-MM-DDTHHmmss.0SSS' ) } Z.${ fileType } ` ;
6
6
7
- export const getFileNameWithTimestamp = ( prefix : string = 'logs' , fileType : string = 'zip' ) => ( fileName : string ) =>
7
+ export const isFileNameWithTimestamp = ( prefix : string = 'logs' , fileType : string = 'zip' ) => ( fileName : string ) =>
8
8
fileName . match ( RegExp ( `(${ prefix } -)([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}.0[0-9]{3}Z)(.${ fileType } )` ) ) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import log from 'electron-log';
4
4
import moment from 'moment' ;
5
5
import ensureDirectoryExists from './ensureDirectoryExists' ;
6
6
import { pubLogsFolderPath , appLogsFolderPath , APP_NAME } from '../config' ;
7
- import { getFileNameWithTimestamp } from '../../common/fileName' ;
7
+ import { isFileNameWithTimestamp } from '../../common/fileName' ;
8
8
9
9
const isTest = process . env . NODE_ENV === 'test' ;
10
10
@@ -25,7 +25,7 @@ export const setupLogging = () => {
25
25
// Removes existing compressed logs
26
26
fs . readdir ( appLogsFolderPath , ( err , files ) => {
27
27
files
28
- . filter ( getFileNameWithTimestamp ( ) )
28
+ . filter ( isFileNameWithTimestamp ( ) )
29
29
. forEach ( ( logFileName ) => {
30
30
const logFile = path . join ( appLogsFolderPath , logFileName ) ;
31
31
try {
Original file line number Diff line number Diff line change 1
1
import http from 'http' ;
2
2
import FormData from 'form-data/lib/form_data' ;
3
3
import fs from 'fs' ;
4
- import { getFileNameWithTimestamp } from '../../../../common/fileName' ;
4
+ import { isFileNameWithTimestamp } from '../../../../common/fileName' ;
5
5
6
6
export type RequestOptions = {
7
7
hostname : string ,
@@ -41,7 +41,7 @@ function typedHttpRequest<Response>(
41
41
// prepare file stream (attachment)
42
42
if ( payload . compressedLog ) {
43
43
const stream = fs . createReadStream ( payload . compressedLog ) ;
44
- const [ fileName ] = getFileNameWithTimestamp ( ) ( payload . compressedLog ) ;
44
+ const [ fileName ] = isFileNameWithTimestamp ( ) ( payload . compressedLog ) ;
45
45
formData . append ( fileName , stream ) ;
46
46
}
47
47
You can’t perform that action at this time.
0 commit comments