Skip to content

Commit f4f80ab

Browse files
committed
chore(logger): lint fix
1 parent b42c940 commit f4f80ab

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

Diff for: packages/logger/src/Logger.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,6 @@ class Logger extends Utility implements ClassThatLogs {
178178
merge(this.persistentLogAttributes, attributes);
179179
}
180180

181-
/**
182-
* It removes attributes based on provided keys to all log items generated by this Logger instance.
183-
*
184-
* @param {string[]} keys
185-
* @returns {void}
186-
*/
187-
public removePersistentLogAttributes(keys: string[]): void {
188-
keys.forEach((key) => {
189-
if(this.persistentLogAttributes && key in this.persistentLogAttributes) {
190-
delete this.persistentLogAttributes[key];
191-
}
192-
})
193-
}
194-
195181
/**
196182
* Alias for addPersistentLogAttributes.
197183
*
@@ -202,16 +188,6 @@ class Logger extends Utility implements ClassThatLogs {
202188
this.addPersistentLogAttributes(attributes);
203189
}
204190

205-
/**
206-
* Alias for removePersistentLogAttributes.
207-
*
208-
* @param {string[]} keys
209-
* @returns {void}
210-
*/
211-
public removeKeys(keys: string[]): void {
212-
this.removePersistentLogAttributes(keys);
213-
}
214-
215191
/**
216192
* It creates a separate Logger instance, identical to the current one
217193
* It's possible to overwrite the new instance options by passing them.
@@ -298,6 +274,30 @@ class Logger extends Utility implements ClassThatLogs {
298274
this.setLogsSampled();
299275
}
300276

277+
/**
278+
* Alias for removePersistentLogAttributes.
279+
*
280+
* @param {string[]} keys
281+
* @returns {void}
282+
*/
283+
public removeKeys(keys: string[]): void {
284+
this.removePersistentLogAttributes(keys);
285+
}
286+
287+
/**
288+
* It removes attributes based on provided keys to all log items generated by this Logger instance.
289+
*
290+
* @param {string[]} keys
291+
* @returns {void}
292+
*/
293+
public removePersistentLogAttributes(keys: string[]): void {
294+
keys.forEach((key) => {
295+
if (this.persistentLogAttributes && key in this.persistentLogAttributes) {
296+
delete this.persistentLogAttributes[key];
297+
}
298+
});
299+
}
300+
301301
/**
302302
* It sets the user-provided sample rate value.
303303
*

Diff for: packages/logger/tests/e2e/basicFeatures.middy.test.FunctionCode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const testFunction = async (event: APIGatewayProxyEvent, context: Context): Prom
2424
// Test feature 2: Context data
2525
// Test feature 3: Add and remove persistent additional log keys and value
2626
// Test feature 4: X-Ray Trace ID injection
27-
logger.removeKeys([ REMOVABLE_KEY ]);
27+
logger.removeKeys([REMOVABLE_KEY]);
2828
logger.debug('##### This should not appear');
2929
logger.info('This is an INFO log with context and persistent key');
3030

Diff for: packages/logger/tests/e2e/basicFeatures.middy.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ const lambdaFunctionCodeFile = 'basicFeatures.middy.test.FunctionCode.ts';
4343
// Text to be used by Logger in the Lambda function
4444
const PERSISTENT_KEY = 'persistentKey';
4545
const PERSISTENT_VALUE = `a persistent value that will be put in every log ${uuid}`;
46-
const REMOVABLE_KEY = "removableKey";
47-
const REMOVABLE_VALUE = "a persistent value that will be removed and not displayed in any log ${uuid}";
46+
const REMOVABLE_KEY = 'removableKey';
47+
const REMOVABLE_VALUE = 'a persistent value that will be removed and not displayed in any log ${uuid}';
4848
const SINGLE_LOG_ITEM_KEY = `keyForSingleLogItem${uuid}`;
4949
const SINGLE_LOG_ITEM_VALUE = `a value for a single log item${uuid}`;
5050
const ERROR_MSG = `error-${uuid}`;

Diff for: packages/logger/tests/unit/Logger.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ describe('Class: Logger', () => {
720720
});
721721

722722
// Act
723-
logger.removeKeys(["aws_account_id", "aws_region"]);
723+
logger.removeKeys([ 'aws_account_id', 'aws_region' ]);
724724

725725
// Assess
726726
expect(logger).toEqual(expect.objectContaining({
@@ -748,7 +748,7 @@ describe('Class: Logger', () => {
748748
const loggerBeforeKeysAreRemoved = { ...logger };
749749

750750
// Act
751-
logger.removeKeys(["not_existing_key"]);
751+
logger.removeKeys(['not_existing_key']);
752752

753753
// Assess
754754
expect(logger).toEqual(loggerBeforeKeysAreRemoved);
@@ -780,8 +780,8 @@ describe('Class: Logger', () => {
780780
});
781781

782782
// Act
783-
logger.removeKeys(["aws_account_id", "aws_region"]);
784-
logger.removeKeys(["aws_account_id", "aws_region"]);
783+
logger.removeKeys([ 'aws_account_id', 'aws_region' ]);
784+
logger.removeKeys([ 'aws_account_id', 'aws_region' ]);
785785

786786
// Assess
787787
expect(logger).toEqual(expect.objectContaining({

0 commit comments

Comments
 (0)