@@ -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,10 +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 ;
65+ let usedStorageSize = this . _options . retentionGB ? 0 : - Infinity ;
6666 // eslint-disable-next-line no-console
6767
6868 for await ( const dirent of dirHandle ) {
@@ -94,12 +94,9 @@ export class MongoLogManager {
9494 toDelete = {
9595 fullPath,
9696 } ;
97- } else if (
98- this . _options . logRetentionGB ||
99- this . _options . maxLogFileCount
100- ) {
97+ } else if ( this . _options . retentionGB || this . _options . maxLogFileCount ) {
10198 const fileSize = ( await fs . stat ( fullPath ) ) . size ;
102- if ( this . _options . logRetentionGB ) {
99+ if ( this . _options . retentionGB ) {
103100 usedStorageSize += fileSize ;
104101 }
105102
0 commit comments