Skip to content

Commit cf22210

Browse files
authored
feat: add metrics (#102)
Adding initial Metrics module
1 parent b8f5f2a commit cf22210

31 files changed

+16483
-9
lines changed

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { ConfigServiceInterface, EnvironmentVariablesService } from './config';
66
import {
77
Environment,
88
HandlerMethodDecorator,
9-
PowertoolLogData,
9+
LambdaFunctionContext,
1010
LogAttributes,
1111
ClassThatLogs,
1212
LoggerOptions,
13+
LogItemExtraInput,
14+
LogItemMessage,
1315
LogLevel,
1416
LogLevelThresholds,
15-
LambdaFunctionContext,
16-
LogItemMessage,
17-
LogItemExtraInput,
17+
PowertoolLogData,
1818
} from '../types';
1919
import { LogFormatterInterface, PowertoolLogFormatter } from './formatter';
2020

@@ -33,7 +33,7 @@ class Logger implements ClassThatLogs {
3333
private logLevel?: LogLevel;
3434

3535
private readonly logLevelThresholds: LogLevelThresholds = {
36-
'DEBUG' : 8,
36+
'DEBUG': 8,
3737
'INFO': 12,
3838
'WARN': 16,
3939
'ERROR': 20
@@ -99,7 +99,7 @@ class Logger implements ClassThatLogs {
9999
}
100100

101101
public injectLambdaContext(): HandlerMethodDecorator {
102-
return (target, propertyKey, descriptor ) => {
102+
return (target, propertyKey, descriptor) => {
103103
const originalMethod = descriptor.value;
104104

105105
descriptor.value = (event, context, callback) => {
@@ -166,7 +166,7 @@ class Logger implements ClassThatLogs {
166166
const attributes = (item instanceof Error) ? { error: item } : item;
167167
logItem.addAttributes(attributes);
168168
});
169-
169+
170170
return logItem;
171171
}
172172

@@ -228,7 +228,7 @@ class Logger implements ClassThatLogs {
228228
}
229229

230230
private setCustomConfigService(customConfigService?: ConfigServiceInterface): void {
231-
this.customConfigService = customConfigService? customConfigService : undefined;
231+
this.customConfigService = customConfigService ? customConfigService : undefined;
232232
}
233233

234234
private setEnvVarsService(): void {
@@ -298,7 +298,7 @@ class Logger implements ClassThatLogs {
298298
sampleRateValue: this.getSampleRateValue(),
299299
serviceName: serviceName || this.getCustomConfigService()?.getServiceName() || this.getEnvVarsService().getServiceName(),
300300
xRayTraceId: this.getEnvVarsService().getXrayTraceId(),
301-
}, persistentLogAttributes );
301+
}, persistentLogAttributes);
302302
}
303303

304304
private shouldPrint(logLevel: LogLevel): boolean {

0 commit comments

Comments
 (0)