import * as tsplus_module_1 from "@effect/core/io/Effect/operations/logging";
import * as tsplus_module_2 from "@effect/core/stream/Stream/operations/fromEffect";
import * as tsplus_module_3 from "@effect/core/io/FiberRef/operations/currentLogLevel";
import * as tsplus_module_4 from "@effect/core/io/FiberRef/operations/locallyScoped";
import * as tsplus_module_5 from "@effect/core/stream/Stream/operations/scoped";
import * as tsplus_module_6 from "@effect/core/io/LogSpan/definition";
import * as tsplus_module_7 from "@tsplus/stdlib/collections/List/prepend";
import * as tsplus_module_8 from "@effect/core/io/FiberRef/operations/currentLogSpan";
import * as tsplus_module_9 from "@effect/core/io/FiberRef/operations/get";
import * as tsplus_module_10 from "@effect/core/io/Effect/operations/flatMap";
/**
 * Logs the specified message at the current log level.
 *
 * @tsplus static ets/Stream/Ops log
 */

export function log(message, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.log(message, __tsplusTrace), __tsplusTrace);
}
/**
 * Logs the specified message at the debug log level.
 */

export function logDebug(message, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.logDebug(message, __tsplusTrace), __tsplusTrace);
}
/**
 * Logs the specified message at the error log level.
 */

export function logError(message, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.logError(message, __tsplusTrace), __tsplusTrace);
}
/**
 * Logs the specified cause as an error.
 */

export function logErrorCause(cause, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.logErrorCause(cause, __tsplusTrace), __tsplusTrace);
}
/**
 * Logs the specified message at the fatal log level.
 */

export function logFatal(message, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.logFatal(message, __tsplusTrace), __tsplusTrace);
}
/**
 * Logs the specified message at the informational log level.
 */

export function logInfo(message, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.logInfo(message, __tsplusTrace), __tsplusTrace);
}
/**
 * Logs the specified message at the warning log level.
 */

export function logWarning(message, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.logWarning(message, __tsplusTrace), __tsplusTrace);
}
/**
 * Logs the specified message at the trace log level.
 */

export function logTrace(message, __tsplusTrace) {
  return tsplus_module_2.fromEffect(() => tsplus_module_1.logTrace(message, __tsplusTrace), __tsplusTrace);
}
/**
 * Sets the log level for streams composed after this.
 */

export function logLevel(level, __tsplusTrace) {
  return tsplus_module_5.scoped(() => tsplus_module_4.locallyScoped_(tsplus_module_3.currentLogLevel.value, level(), __tsplusTrace), __tsplusTrace);
}
/**
 * Adjusts the label for the logging span for streams composed after this.
 */

export function logSpan(label, __tsplusTrace) {
  return tsplus_module_5.scoped(() => tsplus_module_10.flatMap_(tsplus_module_9.get(tsplus_module_8.currentLogSpan.value, __tsplusTrace), stack => {
    const now = Date.now();
    const logSpan = tsplus_module_6.apply(label(), now);
    return tsplus_module_4.locallyScoped_(tsplus_module_8.currentLogSpan.value, tsplus_module_7.prepend_(stack, logSpan), __tsplusTrace);
  }, __tsplusTrace), __tsplusTrace);
}
//# sourceMappingURL=logging.mjs.map