(error: object): SeverityReads the ErrorReporter.severity annotation from an error object,
falling back to "Info" when the annotation is unset or invalid.
When to use
Use to inspect the severity that reporter callbacks will receive for an object error.
export const const getSeverity: (
error: object
) => Severity
Reads the ErrorReporter.severity annotation from an error object,
falling back to "Info" when the annotation is unset or invalid.
When to use
Use to inspect the severity that reporter callbacks will receive for an
object error.
getSeverity = (error: objecterror: object): type Severity = "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace"Log levels that represent actual message severities, excluding the All and
None sentinel levels.
When to use
Use when typing emitted log message severities, such as explicit log calls,
current log level references, or error-report severity annotations, where
All and None are not valid values.
Severity => {
if (const severity: severityDefines the string property key used to override the severity level of an object error.
When to use
Use to type the property key that overrides the reporting severity for object
errors.
Details
When set to a valid LogLevel.Severity, the reporter callback receives this
value as severity. Missing or invalid values fall back to "Info".
Defines the runtime property key used to override the severity level of an object error.
When to use
Use to annotate object errors with the severity reporter callbacks should
receive.
Details
Set error[ErrorReporter.severity] to a valid LogLevel.Severity value.
Missing or invalid values fall back to "Info".
Example (Setting error severity annotations)
import { Data, ErrorReporter } from "effect"
class DeprecationWarning extends Data.TaggedError("DeprecationWarning")<{}> {
readonly [ErrorReporter.severity] = "Warn" as const
}
severity in error: objecterror && import LogLevelLogLevel.const values: ReadonlyArray<LogLevel>Returns all LogLevel values in order from All through the concrete severities to
None.
When to use
Use to enumerate or validate all accepted LogLevel string values, including
the All and None sentinel levels.
Details
The array order matches the module severity order: All, concrete
severities from Fatal to Trace, then None.
Gotchas
This list includes All and None, so it is not limited to concrete emitted
severities.
values.ReadonlyArray<LogLevel>.includes(searchElement: LogLevel.LogLevel, fromIndex?: number): booleanDetermines whether an array includes a certain element, returning true or false as appropriate.
includes(error: object &
Record<
"~effect/ErrorReporter/severity",
unknown
>
error[const severity: severityDefines the string property key used to override the severity level of an object error.
When to use
Use to type the property key that overrides the reporting severity for object
errors.
Details
When set to a valid LogLevel.Severity, the reporter callback receives this
value as severity. Missing or invalid values fall back to "Info".
Defines the runtime property key used to override the severity level of an object error.
When to use
Use to annotate object errors with the severity reporter callbacks should
receive.
Details
Set error[ErrorReporter.severity] to a valid LogLevel.Severity value.
Missing or invalid values fall back to "Info".
Example (Setting error severity annotations)
import { Data, ErrorReporter } from "effect"
class DeprecationWarning extends Data.TaggedError("DeprecationWarning")<{}> {
readonly [ErrorReporter.severity] = "Warn" as const
}
severity] as type Severity = "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace"Log levels that represent actual message severities, excluding the All and
None sentinel levels.
When to use
Use when typing emitted log message severities, such as explicit log calls,
current log level references, or error-report severity annotations, where
All and None are not valid values.
Severity)) {
return error: object &
Record<
"~effect/ErrorReporter/severity",
unknown
>
error[const severity: severityDefines the string property key used to override the severity level of an object error.
When to use
Use to type the property key that overrides the reporting severity for object
errors.
Details
When set to a valid LogLevel.Severity, the reporter callback receives this
value as severity. Missing or invalid values fall back to "Info".
Defines the runtime property key used to override the severity level of an object error.
When to use
Use to annotate object errors with the severity reporter callbacks should
receive.
Details
Set error[ErrorReporter.severity] to a valid LogLevel.Severity value.
Missing or invalid values fall back to "Info".
Example (Setting error severity annotations)
import { Data, ErrorReporter } from "effect"
class DeprecationWarning extends Data.TaggedError("DeprecationWarning")<{}> {
readonly [ErrorReporter.severity] = "Warn" as const
}
severity] as type Severity = "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace"Log levels that represent actual message severities, excluding the All and
None sentinel levels.
When to use
Use when typing emitted log message severities, such as explicit log calls,
current log level references, or error-report severity annotations, where
All and None are not valid values.
Severity
}
return "Info"
}