import { initializeLogger as O } from "@seamless/logger";
import { isPlainObject as R } from "../../core/utilities.mjs";
import { LOG_LEVEL as n } from "../levels.mjs";
class L {
  config;
  constructor(r) {
    this.config = r;
  }
  report(r, t) {
    const { enabled: e, env: o = "PROD", namespace: g, tenant: c, service: p, version: m } = this.config, { args: f, date: l, group: d, level: s } = t;
    if (e && (s === n.ERROR || s === n.DEFAULT)) {
      const u = O(g, {
        tenant: c,
        configs: {
          env: o,
          service: p,
          version: m
        }
      }), a = [];
      for (const i of f)
        a.push(R(i) ? JSON.parse(JSON.stringify(i)) : i);
      u.error(`${r}`, { date: l, group: d, data: a });
    }
  }
  reportInfo(r, t, ...e) {
  }
  reportWarning(r, t, ...e) {
  }
  reportError(r, t, ...e) {
    const o = new Intl.DateTimeFormat(["pt-PT", "de-DE", "en-GB"], {
      year: "numeric",
      month: "2-digit",
      day: "2-digit",
      hour: "2-digit",
      minute: "2-digit",
      second: "2-digit"
    }).format(Date.now());
    this.report(r, { level: n.ERROR, date: o, group: t, args: e });
  }
  getOptions() {
    return this.config;
  }
}
export {
  L as DatadogReporter
};
