Filter log files to rpt

This commit is contained in:
Björn Dahlgren 2021-02-28 14:41:12 +01:00 committed by Björn Dahlgren
parent ac985f98a9
commit a33c866644
2 changed files with 6 additions and 4 deletions

View File

@ -25,7 +25,7 @@ Logs.generateLogFileName = function (suffix) {
.replace(/:/g, '-') // Replace time dividers with dash
.replace(/T/, '_') // Remove date and time divider
.replace(/\..+/, '') // Remove milliseconds
return 'arma3server_' + dateStr + '_' + suffix + '.log'
return 'arma3server_' + dateStr + '_' + suffix + '.rpt'
}
Logs.prototype.delete = function (filename, callback) {
@ -86,7 +86,9 @@ Logs.prototype.logFiles = function (callback) {
return
}
files = files.map(function (file) {
files = files.filter(function (file) {
return file.endsWith('.rpt')
}).map(function (file) {
return {
name: file,
path: path.join(directory, file)

View File

@ -19,13 +19,13 @@ describe('Logs', function () {
describe('generateLogFileName()', function () {
it('should generate valid file name', function () {
Logs.generateLogFileName('test').should.eql('arma3server_2015-10-21_19-28-32_test.log')
Logs.generateLogFileName('test').should.eql('arma3server_2015-10-21_19-28-32_test.rpt')
})
})
describe('generateLogFilePath()', function () {
it('should generate valid file path', function () {
logs.generateLogFilePath('test').should.eql(path.join('/tmp', 'logs', 'arma3server_2015-10-21_19-28-32_test.log'))
logs.generateLogFilePath('test').should.eql(path.join('/tmp', 'logs', 'arma3server_2015-10-21_19-28-32_test.rpt'))
})
})
})