@@ -18,7 +18,7 @@ interface MongoLogOptions {
18
18
/** The maximal number of log files which are kept. */
19
19
maxLogFileCount ?: number ;
20
20
/** The maximal GB of log files which are kept. */
21
- logRetentionGB ?: number ;
21
+ retentionGB ?: number ;
22
22
/** A handler for warnings related to a specific filesystem path. */
23
23
onerror : ( err : Error , path : string ) => unknown | Promise < void > ;
24
24
/** A handler for errors related to a specific filesystem path. */
@@ -59,11 +59,10 @@ export class MongoLogManager {
59
59
fileSize ?: number ;
60
60
} > ( ( a , b ) => a . fileTimestamp - b . fileTimestamp ) ;
61
61
62
- const storageSizeLimit = this . _options . logRetentionGB
63
- ? this . _options . logRetentionGB * 1024 * 1024 * 1024
62
+ const storageSizeLimit = this . _options . retentionGB
63
+ ? this . _options . retentionGB * 1024 * 1024 * 1024
64
64
: Infinity ;
65
- let usedStorageSize = this . _options . logRetentionGB ? 0 : - Infinity ;
66
- // eslint-disable-next-line no-console
65
+ let usedStorageSize = this . _options . retentionGB ? 0 : - Infinity ;
67
66
68
67
for await ( const dirent of dirHandle ) {
69
68
// Cap the overall time spent inside this function. Consider situations like
@@ -94,12 +93,9 @@ export class MongoLogManager {
94
93
toDelete = {
95
94
fullPath,
96
95
} ;
97
- } else if (
98
- this . _options . logRetentionGB ||
99
- this . _options . maxLogFileCount
100
- ) {
96
+ } else if ( this . _options . retentionGB || this . _options . maxLogFileCount ) {
101
97
const fileSize = ( await fs . stat ( fullPath ) ) . size ;
102
- if ( this . _options . logRetentionGB ) {
98
+ if ( this . _options . retentionGB ) {
103
99
usedStorageSize += fileSize ;
104
100
}
105
101
0 commit comments