/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ImplementationError } from "#MatterError.js";
import { Console } from "./Console.js";
import { LogFormat } from "./LogFormat.js";
import { LogLevel } from "./LogLevel.js";
function LogDestination(config) {
  return {
    ...LogDestination.defaults,
    ...config
  };
}
((LogDestination2) => {
  LogDestination2.defaults = {
    name: "default",
    level: LogLevel.DEBUG,
    facilityLevels: {},
    add(message) {
      this.write(this.format(message), message);
    },
    format: LogFormat.formats.ansi,
    write: Console.write
  };
})(LogDestination || (LogDestination = {}));
function LogDestinations() {
  const destinations = {
    default: { ...LogDestination.defaults }
  };
  return new Proxy(destinations, {
    get(target, name, receiver) {
      if (typeof name === "string" && !(name in destinations)) {
        throw new ImplementationError(`Log destination "${name}" does not exist`);
      }
      return Reflect.get(target, name, receiver);
    }
  });
}
export {
  LogDestination,
  LogDestinations
};
//# sourceMappingURL=LogDestination.js.map
