mirror of
https://github.com/sussy-code/backend.git
synced 2026-05-08 02:59:57 +00:00
Ignore healthcheck and metrics
This commit is contained in:
parent
effe139683
commit
1cecc2cccd
1 changed files with 5 additions and 0 deletions
|
|
@ -64,6 +64,8 @@ export function scopedLogger(service: string, meta: object = {}) {
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ignoredUrls = ['/healthcheck', '/metrics'];
|
||||||
|
|
||||||
export function makeFastifyLogger(logger: winston.Logger) {
|
export function makeFastifyLogger(logger: winston.Logger) {
|
||||||
logger.format = winston.format.combine(
|
logger.format = winston.format.combine(
|
||||||
winston.format((info) => {
|
winston.format((info) => {
|
||||||
|
|
@ -78,6 +80,9 @@ export function makeFastifyLogger(logger: winston.Logger) {
|
||||||
let url = request.url;
|
let url = request.url;
|
||||||
try {
|
try {
|
||||||
const pathParts = (request.url as string).split('?', 2);
|
const pathParts = (request.url as string).split('?', 2);
|
||||||
|
|
||||||
|
if (ignoredUrls.includes(pathParts[0])) return false;
|
||||||
|
|
||||||
if (pathParts[1]) {
|
if (pathParts[1]) {
|
||||||
const searchParams = new URLSearchParams(pathParts[1]);
|
const searchParams = new URLSearchParams(pathParts[1]);
|
||||||
pathParts[1] = searchParams.toString();
|
pathParts[1] = searchParams.toString();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue