const fileName_1 = "(@effect/core) _src/io/Effect/operations/logging.ts";
import * as tsplus_module_1 from "@effect/core/io/LogLevel/definition";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_3 from "@effect/core/io/Cause/definition";
import * as tsplus_module_4 from "@effect/core/io/LogSpan/definition";
import * as tsplus_module_5 from "@tsplus/stdlib/collections/List/prepend";
import * as tsplus_module_6 from "@effect/core/io/FiberRef/operations/currentLogSpan";
import * as tsplus_module_7 from "@effect/core/io/FiberRef/operations/locally";
import * as tsplus_module_8 from "@effect/core/io/Effect/operations/suspendSucceed";
import * as tsplus_module_9 from "@effect/core/io/FiberRef/operations/get";
import * as tsplus_module_10 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_11 from "@tsplus/stdlib/collections/ImmutableMap/set";
import * as tsplus_module_12 from "@effect/core/io/FiberRef/operations/currentLogAnnotations";
import * as tsplus_module_13 from "@tsplus/stdlib/collections/HashSet/empty";
import * as tsplus_module_14 from "@effect/core/io/RuntimeConfig/operations/make";
import * as tsplus_module_15 from "@effect/core/io/Effect/operations/withRuntimeConfig";
import * as tsplus_module_16 from "@effect/core/io/Effect/operations/runtimeConfig";
import { ILogged } from "@effect/core/io/Effect/definition/primitives";
const someFatal = /*#__PURE__*/tsplus_module_2.some(tsplus_module_1.Fatal);
const someError = /*#__PURE__*/tsplus_module_2.some(tsplus_module_1.Error);
const someWarning = /*#__PURE__*/tsplus_module_2.some(tsplus_module_1.Warning);
const someTrace = /*#__PURE__*/tsplus_module_2.some(tsplus_module_1.Trace);
const someInfo = /*#__PURE__*/tsplus_module_2.some(tsplus_module_1.Info);
const someDebug = /*#__PURE__*/tsplus_module_2.some(tsplus_module_1.Debug);
/**
 * Logs the specified message at the current log level.
 *
 * @tsplus static ets/Effect/Ops log
 */

export function log(message, __tsplusTrace) {
  return new ILogged(message, () => tsplus_module_3.empty, tsplus_module_2.none, null, null, __tsplusTrace);
}
/**
 * Logs the specified message at the debug log level.
 *
 * @tsplus static ets/Effect/Ops logDebug
 */

export function logDebug(message, __tsplusTrace) {
  return new ILogged(message, () => tsplus_module_3.empty, someDebug, null, null, __tsplusTrace);
}
/**
 * Logs the specified cause at the debug log level.
 *
 * @tsplus static ets/Effect/Ops logDebugCause
 */

export function logDebugCause(cause, __tsplusTrace) {
  return new ILogged(() => "", cause, someDebug, null, null, __tsplusTrace);
}
/**
 * Logs the specified message and cause at the debug log level.
 *
 * @tsplus static ets/Effect/Ops logDebugCauseMessage
 */

export function logDebugCauseMessage(message, cause, __tsplusTrace) {
  return new ILogged(message, cause, someDebug, null, null, __tsplusTrace);
}
/**
 * Logs the specified message at the error log level.
 *
 * @tsplus static ets/Effect/Ops logError
 */

export function logError(message, __tsplusTrace) {
  return new ILogged(message, () => tsplus_module_3.empty, someError, null, null, __tsplusTrace);
}
/**
 * Logs the specified cause at the error log level.
 *
 * @tsplus static ets/Effect/Ops logErrorCause
 */

export function logErrorCause(cause, __tsplusTrace) {
  return new ILogged(() => "", cause, someError, null, null, __tsplusTrace);
}
/**
 * Logs the specified message and cause at the error log level.
 *
 * @tsplus static ets/Effect/Ops logErrorCauseMessage
 */

export function logErrorCauseMessage(message, cause, __tsplusTrace) {
  return new ILogged(message, cause, someError, null, null, __tsplusTrace);
}
/**
 * Logs the specified message at the fatal log level.
 *
 * @tsplus static ets/Effect/Ops logFatal
 */

export function logFatal(message, __tsplusTrace) {
  return new ILogged(message, () => tsplus_module_3.empty, someFatal, null, null, __tsplusTrace);
}
/**
 * Logs the specified cause at the fatal log level.
 *
 * @tsplus static ets/Effect/Ops logFatalCause
 */

export function logFatalCause(cause, __tsplusTrace) {
  return new ILogged(() => "", cause, someFatal, null, null, __tsplusTrace);
}
/**
 * Logs the specified message and cause at the fatal log level.
 *
 * @tsplus static ets/Effect/Ops logFatalCauseMessage
 */

export function logFatalCauseMessage(message, cause, __tsplusTrace) {
  return new ILogged(message, cause, someFatal, null, null, __tsplusTrace);
}
/**
 * Logs the specified message at the informational log level.
 *
 * @tsplus static ets/Effect/Ops logInfo
 */

export function logInfo(message, __tsplusTrace) {
  return new ILogged(message, () => tsplus_module_3.empty, someInfo, null, null, __tsplusTrace);
}
/**
 * Logs the specified cause at the informational log level.
 *
 * @tsplus static ets/Effect/Ops logInfoCause
 */

export function logInfoCause(cause, __tsplusTrace) {
  return new ILogged(() => "", cause, someInfo, null, null, __tsplusTrace);
}
/**
 * Logs the specified message and cause at the informational log level.
 *
 * @tsplus static ets/Effect/Ops logInfoCauseMessage
 */

export function logInfoCauseMessage(message, cause, __tsplusTrace) {
  return new ILogged(message, cause, someInfo, null, null, __tsplusTrace);
}
/**
 * Logs the specified message at the warning log level.
 *
 * @tsplus static ets/Effect/Ops logWarning
 */

export function logWarning(message, __tsplusTrace) {
  return new ILogged(message, () => tsplus_module_3.empty, someWarning, null, null, __tsplusTrace);
}
/**
 * Logs the specified cause at the warning log level.
 *
 * @tsplus static ets/Effect/Ops logWarningCause
 */

export function logWarningCause(cause, __tsplusTrace) {
  return new ILogged(() => "", cause, someWarning, null, null, __tsplusTrace);
}
/**
 * Logs the specified message and cause at the warning log level.
 *
 * @tsplus static ets/Effect/Ops logWarningCauseMessage
 */

export function logWarningCauseMessage(message, cause, __tsplusTrace) {
  return new ILogged(message, cause, someWarning, null, null, __tsplusTrace);
}
/**
 * Logs the specified message at the trace log level.
 *
 * @tsplus static ets/Effect/Ops logTrace
 */

export function logTrace(message, __tsplusTrace) {
  return new ILogged(message, () => tsplus_module_3.empty, someTrace, null, null, __tsplusTrace);
}
/**
 * Logs the specified cause at the trace log level.
 *
 * @tsplus static ets/Effect/Ops logTraceCause
 */

export function logTraceCause(cause, __tsplusTrace) {
  return new ILogged(() => "", cause, someTrace, null, null, __tsplusTrace);
}
/**
 * Logs the specified message and cause at the trace log level.
 *
 * @tsplus static ets/Effect/Ops logTraceCauseMessage
 */

export function logTraceCauseMessage(message, cause, __tsplusTrace) {
  return new ILogged(message, cause, someTrace, null, null, __tsplusTrace);
}
/**
 * Adjusts the label for the current logging span.
 *
 * @tsplus static ets/Effect/Ops logSpan
 */

export function logSpan(label) {
  return (effect, __tsplusTrace) => tsplus_module_10.flatMap_(tsplus_module_9.get(tsplus_module_6.currentLogSpan.value, fileName_1 + ":233:38"), stack => tsplus_module_8.suspendSucceed(() => {
    const now = Date.now();
    const logSpan = tsplus_module_4.apply(label(), now);
    return tsplus_module_7.locally_(tsplus_module_6.currentLogSpan.value, tsplus_module_5.prepend_(stack, logSpan), fileName_1 + ":238:48")(effect);
  }, fileName_1 + ":234:28"), fileName_1 + ":233:48");
}
/**
 * Annotates each log in this effect with the specified log annotation.
 *
 * @tsplus static ets/Effect/Ops logAnnotate
 */

export function logAnnotate(key, value) {
  return (effect, __tsplusTrace) => tsplus_module_10.flatMap_(tsplus_module_9.get(tsplus_module_12.currentLogAnnotations.value, fileName_1 + ":252:11"), annotations => tsplus_module_8.suspendSucceed(() => tsplus_module_7.locally_(tsplus_module_12.currentLogAnnotations.value, tsplus_module_11.set_(annotations, key(), value()), fileName_1 + ":256:57")(effect), fileName_1 + ":254:30"), fileName_1 + ":253:15");
}
/**
 * Retrieves the log annotations associated with the current scope.
 *
 * @tsplus static ets/Effect/Ops logAnnotations
 */

export function logAnnotations(__tsplusTrace) {
  return tsplus_module_9.get(tsplus_module_12.currentLogAnnotations.value, __tsplusTrace);
}
/**
 * An aspect that disables logging for the specified effect.
 *
 * @tsplus static ets/Effect/Ops disableLogging
 */

export function disableLogging(effect) {
  return tsplus_module_10.flatMap_(tsplus_module_16.runtimeConfig, runtimeConfig => tsplus_module_15.withRuntimeConfig(() => tsplus_module_14.make({ ...runtimeConfig.value,
    loggers: tsplus_module_13.empty()
  }), () => effect, fileName_1 + ":280:29"), fileName_1 + ":279:38");
}
//# sourceMappingURL=logging.mjs.map