@effect/io
Advanced tools
Comparing version 0.29.0 to 0.29.1
@@ -6,14 +6,6 @@ "use strict"; | ||
}); | ||
exports.tracerTag = exports.nativeTracer = exports.make = exports.logger = exports.TracerTypeId = exports.NativeSpan = void 0; | ||
exports.tracerTag = exports.nativeTracer = exports.make = exports.TracerTypeId = exports.NativeSpan = void 0; | ||
var Context = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Context")); | ||
var _Global = /*#__PURE__*/require("@effect/data/Global"); | ||
var List = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/List")); | ||
var MutableRef = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/MutableRef")); | ||
var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Option")); | ||
var Cause = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Cause")); | ||
var Pretty = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/cause-pretty")); | ||
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/core")); | ||
var _fiberId = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/fiberId")); | ||
var fiberRefs = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/fiberRefs")); | ||
var _logger = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/logger")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
@@ -59,4 +51,4 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
}; | ||
this.event = (name, attributes) => { | ||
this.events.push([name, attributes ?? {}]); | ||
this.event = (name, startTime, attributes) => { | ||
this.events.push([name, startTime, attributes ?? {}]); | ||
}; | ||
@@ -76,18 +68,3 @@ this.status = { | ||
}); | ||
/** @internal */ | ||
exports.nativeTracer = nativeTracer; | ||
const logger = /*#__PURE__*/_logger.makeLogger((fiberId, logLevel, message, cause, context, _spans, annotations) => { | ||
const span = Option.flatMap(fiberRefs.get(context, core.currentTracerSpan), List.head); | ||
if (Option.isNone(span)) { | ||
return; | ||
} | ||
const attributes = Object.fromEntries(annotations); | ||
attributes["effect.fiberId"] = _fiberId.threadName(fiberId); | ||
attributes["effect.logLevel"] = logLevel.label; | ||
if (cause !== null && cause !== Cause.empty) { | ||
attributes["effect.cause"] = Pretty.pretty(cause); | ||
} | ||
span.value.event(message, attributes); | ||
}); | ||
exports.logger = logger; | ||
//# sourceMappingURL=tracer.js.map |
@@ -208,2 +208,7 @@ /** | ||
*/ | ||
export declare const tracerLogger: Logger<string, void>; | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
*/ | ||
export declare const logFmt: Layer.Layer<never, never, never>; | ||
@@ -210,0 +215,0 @@ /** |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.zipRight = exports.zipLeft = exports.zip = exports.withMinimumLogLevel = exports.test = exports.sync = exports.succeed = exports.stringLogger = exports.simple = exports.replaceScoped = exports.replaceEffect = exports.replace = exports.remove = exports.none = exports.minimumLogLevel = exports.map = exports.make = exports.logfmtLogger = exports.logFmt = exports.filterLogLevel = exports.defaultLogger = exports.contramap = exports.addScoped = exports.addEffect = exports.add = exports.LoggerTypeId = void 0; | ||
exports.zipRight = exports.zipLeft = exports.zip = exports.withMinimumLogLevel = exports.tracerLogger = exports.test = exports.sync = exports.succeed = exports.stringLogger = exports.simple = exports.replaceScoped = exports.replaceEffect = exports.replace = exports.remove = exports.none = exports.minimumLogLevel = exports.map = exports.make = exports.logfmtLogger = exports.logFmt = exports.filterLogLevel = exports.defaultLogger = exports.contramap = exports.addScoped = exports.addEffect = exports.add = exports.LoggerTypeId = void 0; | ||
var fiberRuntime = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/fiberRuntime")); | ||
@@ -170,2 +170,8 @@ var circular = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/layer/circular")); | ||
exports.stringLogger = stringLogger; | ||
const tracerLogger = fiberRuntime.tracerLogger; | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
*/ | ||
exports.tracerLogger = tracerLogger; | ||
const logFmt = /*#__PURE__*/replace(fiberRuntime.defaultLogger, fiberRuntime.logFmtLogger); | ||
@@ -172,0 +178,0 @@ /** |
{ | ||
"name": "@effect/io", | ||
"version": "0.29.0", | ||
"version": "0.29.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -14,2 +14,3 @@ import type * as Chunk from "@effect/data/Chunk" | ||
import * as core from "@effect/io/internal_effect_untraced/core" | ||
import * as _fiberId from "@effect/io/internal_effect_untraced/fiberId" | ||
import * as random from "@effect/io/internal_effect_untraced/random" | ||
@@ -16,0 +17,0 @@ import * as tracer from "@effect/io/internal_effect_untraced/tracer" |
@@ -6,11 +6,6 @@ /** | ||
import { globalValue } from "@effect/data/Global" | ||
import * as List from "@effect/data/List" | ||
import * as MutableRef from "@effect/data/MutableRef" | ||
import * as Option from "@effect/data/Option" | ||
import * as Cause from "@effect/io/Cause" | ||
import type * as Option from "@effect/data/Option" | ||
import type * as Exit from "@effect/io/Exit" | ||
import * as Pretty from "@effect/io/internal_effect_untraced/cause-pretty" | ||
import * as core from "@effect/io/internal_effect_untraced/core" | ||
import * as _fiberId from "@effect/io/internal_effect_untraced/fiberId" | ||
import * as fiberRefs from "@effect/io/internal_effect_untraced/fiberRefs" | ||
import * as _logger from "@effect/io/internal_effect_untraced/logger" | ||
@@ -43,3 +38,3 @@ import type * as Tracer from "@effect/io/Tracer" | ||
attributes: Map<string, Tracer.AttributeValue> | ||
events: Array<[name: string, attributes: Record<string, Tracer.AttributeValue>]> = [] | ||
events: Array<[name: string, startTime: bigint, attributes: Record<string, Tracer.AttributeValue>]> = [] | ||
@@ -73,4 +68,4 @@ constructor( | ||
event = (name: string, attributes?: Record<string, Tracer.AttributeValue>): void => { | ||
this.events.push([name, attributes ?? {}]) | ||
event = (name: string, startTime: bigint, attributes?: Record<string, Tracer.AttributeValue>): void => { | ||
this.events.push([name, startTime, attributes ?? {}]) | ||
} | ||
@@ -83,30 +78,1 @@ } | ||
}) | ||
/** @internal */ | ||
export const logger = _logger.makeLogger<string, void>(( | ||
fiberId, | ||
logLevel, | ||
message, | ||
cause, | ||
context, | ||
_spans, | ||
annotations | ||
) => { | ||
const span = Option.flatMap(fiberRefs.get(context, core.currentTracerSpan), List.head) | ||
if (Option.isNone(span)) { | ||
return | ||
} | ||
const attributes = Object.fromEntries(annotations) | ||
attributes["effect.fiberId"] = _fiberId.threadName(fiberId) | ||
attributes["effect.logLevel"] = logLevel.label | ||
if (cause !== null && cause !== Cause.empty) { | ||
attributes["effect.cause"] = Pretty.pretty(cause) | ||
} | ||
span.value.event( | ||
message, | ||
attributes | ||
) | ||
}) |
@@ -298,2 +298,8 @@ /** | ||
*/ | ||
export const tracerLogger: Logger<string, void> = fiberRuntime.tracerLogger | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
*/ | ||
export const logFmt: Layer.Layer<never, never, never> = replace(fiberRuntime.defaultLogger, fiberRuntime.logFmtLogger) | ||
@@ -300,0 +306,0 @@ |
@@ -10,3 +10,2 @@ /** | ||
import * as internal from "@effect/io/internal_effect_untraced/tracer" | ||
import type * as Logger from "@effect/io/Logger" | ||
@@ -83,3 +82,3 @@ /** | ||
readonly attribute: (key: string, value: AttributeValue) => void | ||
readonly event: (name: string, attributes?: Record<string, AttributeValue>) => void | ||
readonly event: (name: string, startTime: bigint, attributes?: Record<string, AttributeValue>) => void | ||
} | ||
@@ -110,9 +109,1 @@ /** | ||
defaultServices.tracerWith | ||
/** | ||
* A Logger which adds log entries as events to the current span. | ||
* | ||
* @since 1.0.0 | ||
* @category loggers | ||
*/ | ||
export const logger: Logger.Logger<string, void> = internal.logger |
@@ -8,3 +8,2 @@ /** | ||
import type * as Exit from "@effect/io/Exit"; | ||
import type * as Logger from "@effect/io/Logger"; | ||
/** | ||
@@ -69,3 +68,3 @@ * @since 1.0.0 | ||
readonly attribute: (key: string, value: AttributeValue) => void; | ||
readonly event: (name: string, attributes?: Record<string, AttributeValue>) => void; | ||
readonly event: (name: string, startTime: bigint, attributes?: Record<string, AttributeValue>) => void; | ||
} | ||
@@ -92,9 +91,2 @@ /** | ||
export declare const tracerWith: <R, E, A>(f: (tracer: Tracer) => Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>; | ||
/** | ||
* A Logger which adds log entries as events to the current span. | ||
* | ||
* @since 1.0.0 | ||
* @category loggers | ||
*/ | ||
export declare const logger: Logger.Logger<string, void>; | ||
//# sourceMappingURL=Tracer.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.tracerWith = exports.make = exports.logger = exports.TracerTypeId = exports.Tracer = void 0; | ||
exports.tracerWith = exports.make = exports.TracerTypeId = exports.Tracer = void 0; | ||
var defaultServices = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/defaultServices")); | ||
@@ -34,11 +34,3 @@ var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/tracer")); | ||
const tracerWith = defaultServices.tracerWith; | ||
/** | ||
* A Logger which adds log entries as events to the current span. | ||
* | ||
* @since 1.0.0 | ||
* @category loggers | ||
*/ | ||
exports.tracerWith = tracerWith; | ||
const logger = internal.logger; | ||
exports.logger = logger; | ||
//# sourceMappingURL=Tracer.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6952638
119291