@effect/io
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
logLevelOverride: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined; | ||
defaultLogLevel: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None"; | ||
/** | ||
@@ -18,3 +18,3 @@ * When specified it will be used to collect call traces at runtime. | ||
*/ | ||
traceExtractor: ((at: number) => string | undefined) | undefined; | ||
getCallTrace: ((at: number) => string | undefined) | undefined; | ||
/** | ||
@@ -25,18 +25,6 @@ * A function that is used to filter which traces to show and collect. | ||
/** | ||
* Enables execution tracing in the fiber runtime. | ||
* Sets a limit on how many stack traces should be rendered. | ||
*/ | ||
traceExecutionEnabled: boolean; | ||
traceStackLimit: number; | ||
/** | ||
* Renders the execution trace in the error cause when it is available. | ||
*/ | ||
traceExecutionEnabledInCause: boolean; | ||
/** | ||
* Renders the stack trace in the error cause when it is available. | ||
*/ | ||
traceStackEnabledInCause: boolean; | ||
/** | ||
* Renders the span trace in the error cause when it is available. | ||
*/ | ||
traceSpanEnabledInCause: boolean; | ||
/** | ||
* Sets a limit on how many execution traces should be rendered. | ||
@@ -46,6 +34,2 @@ */ | ||
/** | ||
* Sets a limit on how many stack traces should be rendered. | ||
*/ | ||
traceStackLimit: number; | ||
/** | ||
* Enables debug logging of execution traces. | ||
@@ -55,6 +39,2 @@ */ | ||
/** | ||
* Enables tracing. | ||
*/ | ||
traceEnabled: boolean; | ||
/** | ||
* Listens to execution traces. | ||
@@ -77,2 +57,6 @@ */ | ||
*/ | ||
export declare const isTraceEnabled: () => boolean; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const withCallTrace: (trace: string) => <A>(value: A) => A; | ||
@@ -79,0 +63,0 @@ /** |
29
Debug.js
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.withCallTrace = exports.runtimeDebug = exports.nodeSourceMapExtractor = exports.getCallTrace = void 0; | ||
exports.withCallTrace = exports.runtimeDebug = exports.nodeSourceMapExtractor = exports.isTraceEnabled = exports.getCallTrace = void 0; | ||
var _Function = /*#__PURE__*/require("@fp-ts/data/Function"); | ||
@@ -18,14 +18,9 @@ /** | ||
const runtimeDebug = { | ||
logLevelOverride: undefined, | ||
traceExecutionEnabled: true, | ||
traceExecutionLogEnabled: false, | ||
traceExecutionEnabledInCause: true, | ||
traceSpanEnabledInCause: true, | ||
traceStackEnabledInCause: true, | ||
defaultLogLevel: "Info", | ||
traceExecutionLimit: 5, | ||
traceStackLimit: 5, | ||
traceExtractor: undefined, | ||
getCallTrace: undefined, | ||
traceFilter: () => true, | ||
traceEnabled: true, | ||
traceExecutionHook: [] | ||
traceExecutionHook: [], | ||
traceExecutionLogEnabled: false | ||
}; | ||
@@ -72,4 +67,9 @@ /** | ||
*/ | ||
const isTraceEnabled = () => runtimeDebug.traceStackLimit > 0 || runtimeDebug.traceExecutionLimit > 0; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
exports.isTraceEnabled = isTraceEnabled; | ||
const withCallTrace = trace => { | ||
if (runtimeDebug.traceEnabled && !runtimeDebug.traceExtractor) { | ||
if (!runtimeDebug.getCallTrace) { | ||
stack.push(trace); | ||
@@ -85,8 +85,5 @@ return cleanup; | ||
const getCallTrace = () => { | ||
if (!runtimeDebug.traceEnabled) { | ||
return; | ||
if (runtimeDebug.getCallTrace) { | ||
return orUndefined(runtimeDebug.getCallTrace(4)); | ||
} | ||
if (runtimeDebug.traceExtractor) { | ||
return orUndefined(runtimeDebug.traceExtractor(4)); | ||
} | ||
return orUndefined(stack[stack.length - 1]); | ||
@@ -93,0 +90,0 @@ }; |
@@ -75,3 +75,3 @@ "use strict"; | ||
traced(trace) { | ||
if (!_Debug.runtimeDebug.traceEnabled || trace === this["trace"]) { | ||
if (!(0, _Debug.isTraceEnabled)() || trace === this["trace"]) { | ||
return this; | ||
@@ -78,0 +78,0 @@ } |
@@ -21,5 +21,4 @@ "use strict"; | ||
/** @internal */ | ||
const consoleLoggerLayer = (minLevel = LogLevel.Info) => { | ||
const newMin = _Debug.runtimeDebug.logLevelOverride ? LogLevel.fromLiteral(_Debug.runtimeDebug.logLevelOverride) : minLevel; | ||
return layer.flatMap(() => addLogger(_logger.map(_Function.constVoid)(_logger.filterLogLevel(LogLevel.greaterThanEqual(newMin))(_logger.consoleLogger()))))(removeDefaultLoggers()); | ||
const consoleLoggerLayer = (minLevel = LogLevel.fromLiteral(_Debug.runtimeDebug.defaultLogLevel)) => { | ||
return layer.flatMap(() => addLogger(_logger.map(_Function.constVoid)(_logger.filterLogLevel(LogLevel.greaterThanEqual(minLevel))(_logger.consoleLogger()))))(removeDefaultLoggers()); | ||
}; | ||
@@ -26,0 +25,0 @@ /** @internal */ |
@@ -172,3 +172,3 @@ "use strict"; | ||
exports.zipRight = zipRight; | ||
const defaultLogger = /*#__PURE__*/map(_Function.constVoid)( /*#__PURE__*/filterLogLevel(LogLevel.greaterThanEqual(_Debug.runtimeDebug.logLevelOverride ? LogLevel.fromLiteral(_Debug.runtimeDebug.logLevelOverride) : LogLevel.Info))( /*#__PURE__*/consoleLogger())); | ||
const defaultLogger = /*#__PURE__*/map(_Function.constVoid)( /*#__PURE__*/filterLogLevel(LogLevel.greaterThanEqual(LogLevel.fromLiteral(_Debug.runtimeDebug.defaultLogLevel)))( /*#__PURE__*/consoleLogger())); | ||
/** @internal */ | ||
@@ -175,0 +175,0 @@ exports.defaultLogger = defaultLogger; |
@@ -22,3 +22,3 @@ "use strict"; | ||
if ((0, _Equal.equals)(value, MutableList.tail(this.values))) { | ||
return this.values; | ||
return false; | ||
} | ||
@@ -29,3 +29,3 @@ if (MutableList.length(this.values) - this.ignored >= this.size) { | ||
MutableList.append(value)(this.values); | ||
return this.values; | ||
return true; | ||
} | ||
@@ -32,0 +32,0 @@ pop() { |
{ | ||
"name": "@effect/io", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
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 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
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
3985091
66316