LogLevel
Constructors
Signature
declare const All: LogLevelSignature
declare const allLevels: readonly Array<LogLevel>Signature
declare const Debug: LogLevelSignature
declare const Error: LogLevelSignature
declare const Fatal: LogLevelSignature
declare const Info: LogLevelSignature
declare const None: LogLevelSignature
declare const Trace: LogLevelSignature
declare const Warning: LogLevelConversions
fromLiteral
Added in v2.0.0
Source
Signature
declare function fromLiteral(literal: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None"): LogLevelInstances
Model
Signature
interface All extends Pipeable { readonly _tag: "All"; readonly label: "ALL"; readonly ordinal: number; readonly syslog: 0;}Signature
interface Debug extends Pipeable { readonly _tag: "Debug"; readonly label: "DEBUG"; readonly ordinal: number; readonly syslog: 7;}Signature
interface Error extends Pipeable { readonly _tag: "Error"; readonly label: "ERROR"; readonly ordinal: number; readonly syslog: 3;}Signature
interface Fatal extends Pipeable { readonly _tag: "Fatal"; readonly label: "FATAL"; readonly ordinal: number; readonly syslog: 2;}Signature
interface Info extends Pipeable { readonly _tag: "Info"; readonly label: "INFO"; readonly ordinal: number; readonly syslog: 6;}Signature
type Literal = LogLevel["_tag"]A LogLevel represents the log level associated with an individual logging
operation. Log levels are used both to describe the granularity (or
importance) of individual log statements, as well as to enable tuning
verbosity of log output.
Signature
type LogLevel = All | Fatal | Error | Warning | Info | Debug | Trace | NoneSignature
interface None extends Pipeable { readonly _tag: "None"; readonly label: "OFF"; readonly ordinal: number; readonly syslog: 7;}Signature
interface Trace extends Pipeable { readonly _tag: "Trace"; readonly label: "TRACE"; readonly ordinal: number; readonly syslog: 7;}Signature
interface Warning extends Pipeable { readonly _tag: "Warning"; readonly label: "WARN"; readonly ordinal: number; readonly syslog: 4;}Ordering
greaterThan
Added in v2.0.0
Source
Signature
declare const greaterThan: { (that: LogLevel): (self: LogLevel) => boolean; (self: LogLevel, that: LogLevel): boolean;}greaterThanEqual
Added in v2.0.0
Source
Signature
declare const greaterThanEqual: { (that: LogLevel): (self: LogLevel) => boolean; (self: LogLevel, that: LogLevel): boolean;}Signature
declare const lessThan: { (that: LogLevel): (self: LogLevel) => boolean; (self: LogLevel, that: LogLevel): boolean;}lessThanEqual
Added in v2.0.0
Source
Signature
declare const lessThanEqual: { (that: LogLevel): (self: LogLevel) => boolean; (self: LogLevel, that: LogLevel): boolean;}Utils
Temporarily sets a LogLevel for an Effect workflow.
Details
This function allows you to apply a specific LogLevel locally to an
Effect workflow. Once the workflow completes, the LogLevel reverts to its
previous state.
When to Use
This is particularly useful when you want to adjust the verbosity of logging for specific parts of your program without affecting the global log level.
Signature
declare const locally: { (self: LogLevel): <A, E, R>(use: Effect<A, E, R>) => Effect<A, E, R>; <A, E, R>(use: Effect<A, E, R>, self: LogLevel): Effect<A, E, R>;}Example
import { Effect, LogLevel } from "effect"
const program = Effect.gen(function*() { yield* Effect.log("message1") yield* Effect.gen(function*() { yield* Effect.log("message2") yield* Effect.log("message3") }).pipe(LogLevel.locally(LogLevel.Warning))})
Effect.runFork(program)// timestamp=... level=INFO fiber=#0 message=message1// timestamp=... level=WARN fiber=#0 message=message2// timestamp=... level=WARN fiber=#0 message=message3