(that: LogLevel): (self: LogLevel) => boolean
(self: LogLevel, that: LogLevel): booleanDetermines if the first log level is less severe than or equal to the second.
When to use
Use to implement maximum log-level filtering by checking whether a level is at or below a threshold.
Details
Returns true if self represents a level that is less severe than or equal to that.
Example (Filtering by maximum log level)
import { Logger, LogLevel } from "effect"
// Check if level is at or below threshold
console.log(LogLevel.isLessThanOrEqualTo("Info", "Info")) // true
console.log(LogLevel.isLessThanOrEqualTo("Debug", "Info")) // true
console.log(LogLevel.isLessThanOrEqualTo("Error", "Info")) // false
// Create a logger that suppresses verbose logs
const quietLogger = Logger.make((options) => {
if (LogLevel.isLessThanOrEqualTo(options.logLevel, "Info")) {
console.log(`[${options.logLevel}] ${options.message}`)
}
})
// Development logger - suppress trace logs
const devLogger = Logger.make((options) => {
if (LogLevel.isLessThanOrEqualTo(options.logLevel, "Debug")) {
console.log(`[${options.logLevel}] ${options.message}`)
}
})
// Curried usage for filtering
const isInfoOrBelow = LogLevel.isLessThanOrEqualTo("Info")
const shouldLog = isInfoOrBelow("Debug") // trueexport const const isLessThanOrEqualTo: {
(that: LogLevel): (self: LogLevel) => boolean
(self: LogLevel, that: LogLevel): boolean
}
Determines if the first log level is less severe than or equal to the second.
When to use
Use to implement maximum log-level filtering by checking whether a level is
at or below a threshold.
Details
Returns true if self represents a level that is less severe than or equal to that.
Example (Filtering by maximum log level)
import { Logger, LogLevel } from "effect"
// Check if level is at or below threshold
console.log(LogLevel.isLessThanOrEqualTo("Info", "Info")) // true
console.log(LogLevel.isLessThanOrEqualTo("Debug", "Info")) // true
console.log(LogLevel.isLessThanOrEqualTo("Error", "Info")) // false
// Create a logger that suppresses verbose logs
const quietLogger = Logger.make((options) => {
if (LogLevel.isLessThanOrEqualTo(options.logLevel, "Info")) {
console.log(`[${options.logLevel}] ${options.message}`)
}
})
// Development logger - suppress trace logs
const devLogger = Logger.make((options) => {
if (LogLevel.isLessThanOrEqualTo(options.logLevel, "Debug")) {
console.log(`[${options.logLevel}] ${options.message}`)
}
})
// Curried usage for filtering
const isInfoOrBelow = LogLevel.isLessThanOrEqualTo("Info")
const shouldLog = isInfoOrBelow("Debug") // true
isLessThanOrEqualTo: {
(that: LogLevelthat: type LogLevel =
| "All"
| "Fatal"
| "Error"
| "Warn"
| "Info"
| "Debug"
| "Trace"
| "None"
Represents every level used by Effect logging, including concrete message
severities and the All and None sentinel levels.
When to use
Use to type values that may be either concrete log message severities or
logging configuration sentinels.
Details
The levels are ordered from most severe to least severe:
All - Special level that allows all messages
Fatal - System is unusable, immediate attention required
Error - Error conditions that should be investigated
Warn - Warning conditions that may indicate problems
Info - Informational messages about normal operation
Debug - Debug information useful during development
Trace - Very detailed trace information
None - Special level that suppresses all messages
Example (Using log levels)
import { Effect } from "effect"
// Using log levels with Effect logging
const program = Effect.gen(function*() {
yield* Effect.logFatal("System failure")
yield* Effect.logError("Database error")
yield* Effect.logWarning("High memory usage")
yield* Effect.logInfo("User logged in")
yield* Effect.logDebug("Processing request")
yield* Effect.logTrace("Variable state")
})
// Type-safe log level variables
const errorLevel = "Error" // LogLevel
const debugLevel = "Debug" // LogLevel
LogLevel): (self: LogLevelself: type LogLevel =
| "All"
| "Fatal"
| "Error"
| "Warn"
| "Info"
| "Debug"
| "Trace"
| "None"
Represents every level used by Effect logging, including concrete message
severities and the All and None sentinel levels.
When to use
Use to type values that may be either concrete log message severities or
logging configuration sentinels.
Details
The levels are ordered from most severe to least severe:
All - Special level that allows all messages
Fatal - System is unusable, immediate attention required
Error - Error conditions that should be investigated
Warn - Warning conditions that may indicate problems
Info - Informational messages about normal operation
Debug - Debug information useful during development
Trace - Very detailed trace information
None - Special level that suppresses all messages
Example (Using log levels)
import { Effect } from "effect"
// Using log levels with Effect logging
const program = Effect.gen(function*() {
yield* Effect.logFatal("System failure")
yield* Effect.logError("Database error")
yield* Effect.logWarning("High memory usage")
yield* Effect.logInfo("User logged in")
yield* Effect.logDebug("Processing request")
yield* Effect.logTrace("Variable state")
})
// Type-safe log level variables
const errorLevel = "Error" // LogLevel
const debugLevel = "Debug" // LogLevel
LogLevel) => boolean
(self: LogLevelself: type LogLevel =
| "All"
| "Fatal"
| "Error"
| "Warn"
| "Info"
| "Debug"
| "Trace"
| "None"
Represents every level used by Effect logging, including concrete message
severities and the All and None sentinel levels.
When to use
Use to type values that may be either concrete log message severities or
logging configuration sentinels.
Details
The levels are ordered from most severe to least severe:
All - Special level that allows all messages
Fatal - System is unusable, immediate attention required
Error - Error conditions that should be investigated
Warn - Warning conditions that may indicate problems
Info - Informational messages about normal operation
Debug - Debug information useful during development
Trace - Very detailed trace information
None - Special level that suppresses all messages
Example (Using log levels)
import { Effect } from "effect"
// Using log levels with Effect logging
const program = Effect.gen(function*() {
yield* Effect.logFatal("System failure")
yield* Effect.logError("Database error")
yield* Effect.logWarning("High memory usage")
yield* Effect.logInfo("User logged in")
yield* Effect.logDebug("Processing request")
yield* Effect.logTrace("Variable state")
})
// Type-safe log level variables
const errorLevel = "Error" // LogLevel
const debugLevel = "Debug" // LogLevel
LogLevel, that: LogLevelthat: type LogLevel =
| "All"
| "Fatal"
| "Error"
| "Warn"
| "Info"
| "Debug"
| "Trace"
| "None"
Represents every level used by Effect logging, including concrete message
severities and the All and None sentinel levels.
When to use
Use to type values that may be either concrete log message severities or
logging configuration sentinels.
Details
The levels are ordered from most severe to least severe:
All - Special level that allows all messages
Fatal - System is unusable, immediate attention required
Error - Error conditions that should be investigated
Warn - Warning conditions that may indicate problems
Info - Informational messages about normal operation
Debug - Debug information useful during development
Trace - Very detailed trace information
None - Special level that suppresses all messages
Example (Using log levels)
import { Effect } from "effect"
// Using log levels with Effect logging
const program = Effect.gen(function*() {
yield* Effect.logFatal("System failure")
yield* Effect.logError("Database error")
yield* Effect.logWarning("High memory usage")
yield* Effect.logInfo("User logged in")
yield* Effect.logDebug("Processing request")
yield* Effect.logTrace("Variable state")
})
// Type-safe log level variables
const errorLevel = "Error" // LogLevel
const debugLevel = "Debug" // LogLevel
LogLevel): boolean
} = import OrdOrd.const isLessThanOrEqualTo: <A>(
O: Order<A>
) => {
(that: A): (self: A) => boolean
(self: A, that: A): boolean
}
Checks whether one value is less than or equal to another according to the given order.
When to use
Use when you need a boolean less-than-or-equal predicate using an Order.
Details
Returns true if the order returns -1 or 0, and returns false only if
the order returns 1.
Example (Checking less-than-or-equal comparisons)
import { Order } from "effect"
const isLessThanOrEqualToNumber = Order.isLessThanOrEqualTo(Order.Number)
console.log(isLessThanOrEqualToNumber(1, 2)) // true
console.log(isLessThanOrEqualToNumber(1, 1)) // true
console.log(isLessThanOrEqualToNumber(2, 1)) // false
isLessThanOrEqualTo(const Order: Ord.Order<LogLevel>Order instance for LogLevel that defines the severity ordering.
When to use
Use to sort or compare log levels according to Effect's severity order.
Details
This order treats "All" as the least restrictive level and "None" as the most restrictive,
with Fatal being the most severe actual log level.
Example (Ordering log levels)
import { LogLevel } from "effect"
// Compare log levels using Order
console.log(LogLevel.Order("Error", "Info")) // 1 (Error > Info)
console.log(LogLevel.Order("Debug", "Error")) // -1 (Debug < Error)
console.log(LogLevel.Order("Info", "Info")) // 0 (Info == Info)
Order)