@@ -18,7 +18,7 @@ interface MongoLogOptions {
1818 /** The maximal number of log files which are kept. */
1919 maxLogFileCount ?: number ;
2020 /** The maximal GB of log files which are kept. */
21- logRetentionGB ?: number ;
21+ retentionGB ?: number ;
2222 /** A handler for warnings related to a specific filesystem path. */
2323 onerror : ( err : Error , path : string ) => unknown | Promise < void > ;
2424 /** A handler for errors related to a specific filesystem path. */
@@ -59,11 +59,10 @@ export class MongoLogManager {
5959 fileSize ?: number ;
6060 } > ( ( a , b ) => a . fileTimestamp - b . fileTimestamp ) ;
6161
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
6464 : Infinity ;
65- let usedStorageSize = this . _options . logRetentionGB ? 0 : - Infinity ;
66- // eslint-disable-next-line no-console
65+ let usedStorageSize = this . _options . retentionGB ? 0 : - Infinity ;
6766
6867 for await ( const dirent of dirHandle ) {
6968 // Cap the overall time spent inside this function. Consider situations like
@@ -94,12 +93,9 @@ export class MongoLogManager {
9493 toDelete = {
9594 fullPath,
9695 } ;
97- } else if (
98- this . _options . logRetentionGB ||
99- this . _options . maxLogFileCount
100- ) {
96+ } else if ( this . _options . retentionGB || this . _options . maxLogFileCount ) {
10197 const fileSize = ( await fs . stat ( fullPath ) ) . size ;
102- if ( this . _options . logRetentionGB ) {
98+ if ( this . _options . retentionGB ) {
10399 usedStorageSize += fileSize ;
104100 }
105101
0 commit comments