diff --git a/samples/metricLogger1.sample.ts b/samples/metricLogger1.sample.ts index a4628c6..015b85f 100644 --- a/samples/metricLogger1.sample.ts +++ b/samples/metricLogger1.sample.ts @@ -19,7 +19,7 @@ const yourHandler = async () => { // 4) Send the metric to Mezmo, this will be logged as a JSON object // Should send once per execution to avoid duplicate metric - metricLogger.sendMetric(metric); + metricLogger.sendMetric(); }; // Example if you use Metric Logger in your handler diff --git a/samples/metricLogger2.sample.ts b/samples/metricLogger2.sample.ts index fb8e59d..9e98c74 100644 --- a/samples/metricLogger2.sample.ts +++ b/samples/metricLogger2.sample.ts @@ -19,7 +19,7 @@ const yourHandler = async () => { // 4) Send the metric to Mezmo, this will be logged as a JSON object // Should send once per execution to avoid duplicate metric - metricLogger.sendMetric(metric); + metricLogger.sendMetric(); }; // Example if you use Metric Logger in your handler diff --git a/src/MetricLogger/index.ts b/src/MetricLogger/index.ts index 630567a..67f4839 100644 --- a/src/MetricLogger/index.ts +++ b/src/MetricLogger/index.ts @@ -20,7 +20,7 @@ export class MetricLogger { * @param metric * @param stringifyMetric */ - sendMetric(metric: T, stringifyMetric = true): void { + sendMetric(metric: T = this._metric, stringifyMetric = true): void { if (!this._isTest) { const metricToSend = stringifyMetric ? JSON.stringify(metric) : metric; this._logger.info(metricToSend);