asset-s/QuoteRequestor: info log Objects, not strs
In the QuoteRequestor class, when _infoLogger() is used, log objects directly, rather than stringifying them first. This changes the 0x API log rendering from {"level":"info","time":1588209135290,"pid":13022,"hostname":"precision5510","msg":"{\"aggregatedRfqtLatencyMs\":4}","v":1} to {"level":"info","time":1588224481908,"pid":3637,"hostname":"precision5510","aggregatedRfqtLatencyMs":2,"v":1} This facilitates parsing of these logs by Kibana.
This commit is contained in:
@@ -86,10 +86,8 @@ export class QuoteRequestor {
|
||||
|
||||
constructor(
|
||||
private readonly _rfqtAssetOfferings: RfqtMakerAssetOfferings,
|
||||
private readonly _warningLogger: (s: string) => void = s => logUtils.warn(s),
|
||||
private readonly _infoLogger: (s: string) => void = () => {
|
||||
return;
|
||||
},
|
||||
private readonly _warningLogger: (a: any) => void = a => logUtils.warn(a),
|
||||
private readonly _infoLogger: (a: any) => void = () => undefined,
|
||||
private readonly _expiryBufferMs: number = constants.DEFAULT_SWAP_QUOTER_OPTS.expiryBufferMs,
|
||||
) {}
|
||||
|
||||
@@ -131,7 +129,7 @@ export class QuoteRequestor {
|
||||
return undefined;
|
||||
}),
|
||||
);
|
||||
this._infoLogger(JSON.stringify({ aggregatedRfqtLatencyMs: Date.now() - timeBeforeAwait }));
|
||||
this._infoLogger({ aggregatedRfqtLatencyMs: Date.now() - timeBeforeAwait });
|
||||
|
||||
const responses = responsesIfDefined.filter(
|
||||
(respIfDefd): respIfDefd is AxiosResponse<SignedOrder> => respIfDefd !== undefined,
|
||||
@@ -229,7 +227,7 @@ export class QuoteRequestor {
|
||||
return undefined;
|
||||
}),
|
||||
);
|
||||
this._infoLogger(JSON.stringify({ aggregatedRfqtLatencyMs: Date.now() - timeBeforeAwait }));
|
||||
this._infoLogger({ aggregatedRfqtLatencyMs: Date.now() - timeBeforeAwait });
|
||||
|
||||
const axiosResponses = axiosResponsesIfDefined.filter(
|
||||
(respIfDefd): respIfDefd is AxiosResponse<RfqtIndicativeQuoteResponse> => respIfDefd !== undefined,
|
||||
|
Reference in New Issue
Block a user