ti-metrics
v1.1.2
Published
#### usage
Downloads
374
Readme
ti-metrics
usage
- install package
yarn add ti-metrics
//local
yarn add ti-metrics@file:$PATH/ti-metrics
- build package
yarn build
- usage
# main.ts
import tiMetrics from 'ti-metrics';
tiMetrics.Metrics.getInstance().setup('appName');
app.useGlobalInterceptors(
new tiMetrics.LoggingHttpInterceptor(
['password', 'cellphone'],
['/metrics'],
),
);
#api.module.ts
import tiMetrics from 'ti-metrics';
controllers: [tiMetrics.HttpMetricsController],
#custom log
tiMetrics.Logger.log({
headers: request.headers,
request: request.body,
response: {
statusCode: 401,
message: 'Unauthorized',
},
url: request.originalUrl,
statusCode: 401,
ip,
method,
time: t1 - t0,
route: path,
params,
query,
memory,
});