File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,20 @@ log.transports.file.archiveLogFn = async (file) => {
50
50
renameSync ( file , `${ backupPath } main-${ Date . now ( ) } .log` ) ;
51
51
52
52
let backupLogs = [ ] ;
53
+ let backupAmount = 3 ;
53
54
54
55
const storedConfig = await storageService . readConfig ( ) ;
56
+ if ( storedConfig . logBackups ) {
57
+ backupAmount = storedConfig . logBackups . value ;
58
+ }
55
59
56
60
readdir ( backupPath , ( err , files ) => {
57
61
files . forEach ( ( file ) => {
58
62
backupLogs . push ( file ) ;
59
63
} ) ;
60
- if ( backupLogs . length > storedConfig . logBackups . value ) {
64
+ if ( backupLogs . length > backupAmount ) {
61
65
backupLogs . reverse ( ) ;
62
- for ( let i = storedConfig . logBackups . value ; i < backupLogs . length ; i ++ ) {
66
+ for ( let i = backupAmount ; i < backupLogs . length ; i ++ ) {
63
67
rmSync ( backupPath + backupLogs [ i ] , { force : true } , ( err ) => {
64
68
if ( err ) throw err ;
65
69
} ) ;
You can’t perform that action at this time.
0 commit comments