@@ -511,42 +511,31 @@ class Logger extends Utility implements LoggerInterface {
511
511
}
512
512
513
513
/**
514
- * Alias for removePersistentLogAttributes .
514
+ * It removes attributes based on provided keys to all log items generated by this Logger instance .
515
515
*
516
516
* @param {string[] } keys
517
517
* @returns {void }
518
518
*/
519
519
public removeKeys ( keys : string [ ] ) : void {
520
- this . removePersistentLogAttributes ( keys ) ;
521
- this . removeTemporaryLogAttributes ( keys ) ;
522
- }
523
-
524
- /**
525
- * It removes persistent attributes based on provided keys to all log items generated by this Logger instance.
526
- *
527
- * @param {string[] } keys
528
- * @returns {void }
529
- */
530
- public removePersistentLogAttributes ( keys : string [ ] ) : void {
531
- for ( const key of keys ) {
532
- if ( this . persistentLogAttributes && key in this . persistentLogAttributes ) {
533
- delete this . persistentLogAttributes [ key ] ;
520
+ const removeKey = ( attributes : LogAttributes , key : string ) : void => {
521
+ if ( attributes && key in attributes ) {
522
+ delete attributes [ key ] ;
534
523
}
524
+ } ;
525
+ for ( const key of keys ) {
526
+ removeKey ( this . persistentLogAttributes , key ) ;
527
+ removeKey ( this . temporaryLogAttributes , key ) ;
535
528
}
536
529
}
537
530
538
531
/**
539
- * It removes temporary attributes based on provided keys to all log items generated by this Logger instance .
532
+ * Alias for removeKeys() .
540
533
*
541
534
* @param {string[] } keys
542
535
* @returns {void }
543
536
*/
544
- public removeTemporaryLogAttributes ( keys : string [ ] ) : void {
545
- for ( const key of keys ) {
546
- if ( this . temporaryLogAttributes && key in this . temporaryLogAttributes ) {
547
- delete this . temporaryLogAttributes [ key ] ;
548
- }
549
- }
537
+ public removePersistentLogAttributes ( keys : string [ ] ) : void {
538
+ this . removeKeys ( keys ) ;
550
539
}
551
540
552
541
/**
0 commit comments