@@ -117,7 +117,7 @@ class Logger extends Utility implements LoggerInterface {
117
117
/**
118
118
* Custom config service instance used to configure the logger.
119
119
*/
120
- private customConfigService ?: ConfigServiceInterface ;
120
+ private readonly customConfigService ?: ConfigServiceInterface ;
121
121
/**
122
122
* Whether to print the Lambda invocation event in the logs.
123
123
*/
@@ -149,7 +149,7 @@ class Logger extends Utility implements LoggerInterface {
149
149
/**
150
150
* Standard attributes managed by Powertools that will be logged in all log items.
151
151
*/
152
- private powertoolsLogData : PowertoolsLogData = < PowertoolsLogData > {
152
+ private readonly powertoolsLogData : PowertoolsLogData = < PowertoolsLogData > {
153
153
sampleRateValue : 0 ,
154
154
} ;
155
155
/**
@@ -169,14 +169,14 @@ class Logger extends Utility implements LoggerInterface {
169
169
/**
170
170
* Flag used to determine if the logger is initialized.
171
171
*/
172
- #isInitialized = false ;
172
+ readonly #isInitialized: boolean = false ;
173
173
/**
174
174
* Map used to hold the list of keys and their type.
175
175
*
176
176
* Because keys of different types can be overwritten, we keep a list of keys that were added and their last
177
177
* type. We then use this map at log preparation time to pick the last one.
178
178
*/
179
- #keys: Map < string , 'temp' | 'persistent' > = new Map ( ) ;
179
+ readonly #keys: Map < string , 'temp' | 'persistent' > = new Map ( ) ;
180
180
/**
181
181
* This is the initial log leval as set during the initialization of the logger.
182
182
*
@@ -263,7 +263,9 @@ class Logger extends Utility implements LoggerInterface {
263
263
public constructor ( options : ConstructorOptions = { } ) {
264
264
super ( ) ;
265
265
const { customConfigService, ...rest } = options ;
266
- this . setCustomConfigService ( customConfigService ) ;
266
+ this . customConfigService = customConfigService
267
+ ? customConfigService
268
+ : undefined ;
267
269
// all logs are buffered until the logger is initialized
268
270
this . setOptions ( rest ) ;
269
271
this . #isInitialized = true ;
@@ -1135,20 +1137,6 @@ class Logger extends Utility implements LoggerInterface {
1135
1137
} ;
1136
1138
}
1137
1139
1138
- /**
1139
- * Set the Logger's customer config service instance, which will be used
1140
- * to fetch environment variables.
1141
- *
1142
- * @param customConfigService - The custom config service
1143
- */
1144
- private setCustomConfigService (
1145
- customConfigService ?: ConfigServiceInterface
1146
- ) : void {
1147
- this . customConfigService = customConfigService
1148
- ? customConfigService
1149
- : undefined ;
1150
- }
1151
-
1152
1140
/**
1153
1141
* Set the initial Logger log level based on the following order:
1154
1142
* 1. If a log level is set using AWS Lambda Advanced Logging Controls, it sets it.
@@ -1199,8 +1187,6 @@ class Logger extends Utility implements LoggerInterface {
1199
1187
if ( this . isValidLogLevel ( logLevelValue ) ) {
1200
1188
this . logLevel = LogLevelThreshold [ logLevelValue ] ;
1201
1189
this . #initialLogLevel = this . logLevel ;
1202
-
1203
- return ;
1204
1190
}
1205
1191
}
1206
1192
0 commit comments