(that: LogLevel): (self: LogLevel) => boolean
(self: LogLevel, that: LogLevel): booleanDetermines if the first log level is more severe than or equal to the second.
When to use
Use to implement minimum log-level filtering by checking whether a message level meets a threshold.
Details
Returns true if self represents a level that is more severe than or equal to that.
Example (Filtering by minimum log level)
import { Logger, LogLevel } from "effect"
// Check if level meets minimum threshold
console.log(LogLevel.isGreaterThanOrEqualTo("Error", "Error")) // true
console.log(LogLevel.isGreaterThanOrEqualTo("Error", "Info")) // true
console.log(LogLevel.isGreaterThanOrEqualTo("Debug", "Info")) // false
// Create a logger that only logs Info and above
const infoLogger = Logger.make((options) => {
if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Info")) {
console.log(`[${options.logLevel}] ${options.message}`)
}
})
// Production logger - only Error and Fatal
const productionLogger = Logger.make((options) => {
if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Error")) {
console.error(
`${options.date.toISOString()} [${options.logLevel}] ${options.message}`
)
}
})
// Curried usage for filtering
const isInfoOrAbove = LogLevel.isGreaterThanOrEqualTo("Info")
const shouldLog = isInfoOrAbove("Error") // trueexport const const isGreaterThanOrEqualTo: {
(that: LogLevel): (self: LogLevel) => boolean
(self: LogLevel, that: LogLevel): boolean
}
Determines if the first log level is more severe than or equal to the second.
When to use
Use to implement minimum log-level filtering by checking whether a message
level meets a threshold.
Details
Returns true if self represents a level that is more severe than or equal to that.
Example (Filtering by minimum log level)
import { Logger, LogLevel } from "effect"
// Check if level meets minimum threshold
console.log(LogLevel.isGreaterThanOrEqualTo("Error", "Error")) // true
console.log(LogLevel.isGreaterThanOrEqualTo("Error", "Info")) // true
console.log(LogLevel.isGreaterThanOrEqualTo("Debug", "Info")) // false
// Create a logger that only logs Info and above
const infoLogger = Logger.make((options) => {
if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Info")) {
console.log(`[${options.logLevel}] ${options.message}`)
}
})
// Production logger - only Error and Fatal
const productionLogger = Logger.make((options) => {
if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Error")) {
console.error(
`${options.date.toISOString()} [${options.logLevel}] ${options.message}`
)
}
})
// Curried usage for filtering
const isInfoOrAbove = LogLevel.isGreaterThanOrEqualTo("Info")
const shouldLog = isInfoOrAbove("Error") // true
isGreaterThanOrEqualTo: {
(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 isGreaterThanOrEqualTo: <A>(
O: Order<A>
) => {
(that: A): (self: A) => boolean
(self: A, that: A): boolean
}
Checks whether one value is greater than or equal to another according to the given order.
When to use
Use when you need a boolean greater-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 greater-than-or-equal comparisons)
import { Order } from "effect"
const isGreaterThanOrEqualToNumber = Order.isGreaterThanOrEqualTo(Order.Number)
console.log(isGreaterThanOrEqualToNumber(2, 1)) // true
console.log(isGreaterThanOrEqualToNumber(1, 1)) // true
console.log(isGreaterThanOrEqualToNumber(1, 2)) // false
isGreaterThanOrEqualTo(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)