import "@rocicorp/logger";
import { otelLogsEnabled } from "../../../otel/src/enabled.js";
import { createLogContext as createLogContext$1, getLogSink } from "../../../shared/src/logging.js";
import { OtelLogSink } from "./otel-log-sink.js";
function createLogContext({ log }, context, includeOtel = true) {
  return createLogContext$1(
    { log },
    context,
    createLogSink(log, includeOtel)
  );
}
function createLogSink(config, includeOtel) {
  const sink = getLogSink(config);
  if (includeOtel && otelLogsEnabled()) {
    const otelSink = new OtelLogSink();
    return new CompositeLogSink([otelSink, sink]);
  }
  return sink;
}
class CompositeLogSink {
  #sinks;
  constructor(sinks) {
    this.#sinks = sinks;
  }
  log(level, context, ...args) {
    for (const sink of this.#sinks) {
      sink.log(level, context, ...args);
    }
  }
}
export {
  createLogContext
};
//# sourceMappingURL=logging.js.map
