Equations
- Lake.instReprVerbosity = { reprPrec := Lake.reprVerbosity✝ }
Equations
- Lake.instOrdVerbosity = { compare := Lake.ordVerbosity✝ }
Equations
- Lake.instInhabitedVerbosity = { default := Lake.Verbosity.normal }
Returns whether to ANSI escape codes with the stream out.
Equations
Instances For
Wrap text in ANSI escape sequences to make it bold and color it the ANSI colorCode.
Resets all terminal font attributes at the end of the text.
Equations
Instances For
A pure representation of output stream.
- stdout : OutStream
- stderr : OutStream
- stream (s : IO.FS.Stream) : OutStream
Instances For
Equations
Equations
- Lake.instCoeHandleOutStream = { coe := fun (h : IO.FS.Handle) => Lake.OutStream.stream (IO.FS.Stream.ofHandle h) }
Equations
- Lake.instInhabitedLogLevel = { default := Lake.LogLevel.trace }
Equations
- Lake.instReprLogLevel = { reprPrec := Lake.reprLogLevel✝ }
Equations
- Lake.instOrdLogLevel = { compare := Lake.ordLogLevel✝ }
Equations
- Lake.instToJsonLogLevel = { toJson := Lake.toJsonLogLevel✝ }
Equations
- Lake.instFromJsonLogLevel = { fromJson? := Lake.fromJsonLogLevel✝ }
Unicode icon for representing the log level.
Equations
Instances For
ANSI escape code for coloring text of at the log level.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.LogLevel.trace.toString = "trace"
- Lake.LogLevel.info.toString = "info"
- Lake.LogLevel.warning.toString = "warning"
- Lake.LogLevel.error.toString = "error"
Instances For
Equations
- Lake.instToStringLogLevel = { toString := Lake.LogLevel.toString }
Equations
Instances For
Equations
Instances For
Equations
- Lake.instToJsonLogEntry = { toJson := Lake.toJsonLogEntry✝ }
Equations
- Lake.instFromJsonLogEntry = { fromJson? := Lake.fromJsonLogEntry✝ }
Equations
- Lake.instToStringLogEntry = { toString := fun (self : Lake.LogEntry) => self.toString }
Equations
- Lake.LogEntry.trace message = { level := Lake.LogLevel.trace, message := message }
Instances For
Equations
- Lake.LogEntry.info message = { level := Lake.LogLevel.info, message := message }
Instances For
Equations
- Lake.LogEntry.warning message = { level := Lake.LogLevel.warning, message := message }
Instances For
Equations
- Lake.LogEntry.error message = { level := Lake.LogLevel.error, message := message }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.LogEntry.ofMessage msg = do let __do_lift ← msg.serialize pure (inline (Lake.LogEntry.ofSerialMessage __do_lift))
Instances For
Equations
- Lake.logVerbose message = Lake.logEntry (Lake.LogEntry.trace message)
Instances For
Equations
- Lake.logWarning message = Lake.logEntry (Lake.LogEntry.warning message)
Instances For
Equations
Instances For
Equations
- Lake.logMessage msg = if msg.isSilent = true then pure PUnit.unit else do let __do_lift ← liftM (Lake.LogEntry.ofMessage msg) Lake.logEntry __do_lift
Instances For
Equations
Instances For
Equations
- Lake.MonadLog.nop = { logEntry := fun (x : Lake.LogEntry) => pure () }
Instances For
Equations
- Lake.MonadLog.instInhabitedOfPure = { default := Lake.MonadLog.nop }
Equations
- self.lift = { logEntry := fun (e : Lake.LogEntry) => liftM (Lake.logEntry e) }
Instances For
Equations
- Lake.MonadLog.stream out minLv useAnsi = { logEntry := fun (e : Lake.LogEntry) => liftM (Lake.logToStream e out minLv useAnsi) }
Instances For
Equations
- Lake.MonadLog.error msg = Lake.logError msg *> failure
Instances For
Equations
- self.logEntry e minLv ansiMode = do let out ← self.get let useAnsi ← Lake.AnsiMode.isEnabled out ansiMode Lake.logToStream e out minLv useAnsi
Instances For
Equations
Instances For
Equations
- Lake.MonadLog.stdout minLv ansiMode = Lake.OutStream.stdout.logger minLv ansiMode
Instances For
Equations
- Lake.MonadLog.stderr minLv ansiMode = Lake.OutStream.stderr.logger minLv ansiMode
Instances For
Equations
- out.getLogger minLv ansiMode = do let out ← out.get let useAnsi ← Lake.AnsiMode.isEnabled out ansiMode pure (Lake.MonadLog.stream out minLv useAnsi)
Instances For
A monad equipped with a MonadLog instance
Equations
- Lake.MonadLogT m n = ReaderT (Lake.MonadLog m) n
Instances For
Equations
- Lake.MonadLogT.instMonadLogOfMonadOfMonadLiftT = { logEntry := fun (e : Lake.LogEntry) => do let __do_lift ← read liftM (Lake.logEntry e) }
Equations
- Lake.instToJsonLog = { toJson := fun (x : Lake.Log) => Lean.toJson x.entries }
Equations
- Lake.instFromJsonLog = { fromJson? := fun (x : Lean.Json) => Lake.Log.mk <$> Lean.fromJson? x }
Equations
- Lake.instOrdPos = { compare := fun (x1 x2 : Lake.Log.Pos) => compare x1.val x2.val }
Equations
- Lake.instLTPos = { lt := fun (x1 x2 : Lake.Log.Pos) => x1.val < x2.val }
Equations
- Lake.instDecidableRelPosLt = inferInstanceAs (DecidableRel fun (x1 x2 : Lake.Log.Pos) => x1.val < x2.val)
Equations
- Lake.instLEPos = { le := fun (x1 x2 : Lake.Log.Pos) => x1.val ≤ x2.val }
Equations
- Lake.instDecidableRelPosLe = inferInstanceAs (DecidableRel fun (x1 x2 : Lake.Log.Pos) => x1.val ≤ x2.val)
Equations
- Lake.Log.instEmptyCollection = { emptyCollection := Lake.Log.empty }
Equations
- Lake.Log.instAppend = { append := Lake.Log.append }
Equations
- log.toString = Array.foldl (fun (x1 : String) (x2 : Lake.LogEntry) => x1 ++ x2.toString ++ "\n") "" log.entries
Instances For
Equations
- Lake.Log.instToString = { toString := Lake.Log.toString }
Equations
- log.replay = Array.forM (fun (e : Lake.LogEntry) => Lake.logEntry e) log.entries
Instances For
The max log level of entries in this log. If empty, returns trace.
Equations
- log.maxLv = Array.foldl (fun (x1 : Lake.LogLevel) (x2 : Lake.LogEntry) => max x1 x2.level) Lake.LogLevel.trace log.entries
Instances For
Equations
- Lake.MonadLog.ofMonadState = { logEntry := Lake.pushLogEntry }
Instances For
Returns the monad's log.
Equations
Instances For
Returns the current end position of the monad's log (i.e., its size).
Equations
- Lake.getLogPos = (fun (x : Lake.Log) => x.endPos) <$> Lake.getLog
Instances For
Removes the section monad's log starting and returns it.
Instances For
Returns the log from x while leaving it intact in the monad.
Equations
- Lake.extractLog x = do let iniPos ← Lake.getLogPos x let log ← Lake.getLog pure (log.takeFrom iniPos)
Instances For
Returns the log from x and its result while leaving it intact in the monad.
Equations
- Lake.withExtractLog x = do let iniPos ← Lake.getLogPos let a ← x let log ← Lake.getLog pure (a, log.takeFrom iniPos)
Instances For
Performs x and backtracks any error to the log position before x.
Equations
- Lake.withLogErrorPos self = do let iniPos ← Lake.getLogPos tryCatch self fun (x : Lake.Log.Pos) => throw iniPos
Instances For
Performs x and groups all logs generated into an error block.
Equations
- Lake.errorWithLog self = do let iniPos ← Lake.getLogPos tryCatch self fun (x : Lake.Log.Pos) => pure () throw iniPos
Instances For
Captures IO in x into an informational log entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Throw with the logged error message.
Equations
- Lake.ELog.error msg = Lake.errorWithLog (Lake.logError msg)
Instances For
MonadError instance for monads with Log state and Log.Pos errors.
Equations
- Lake.ELog.monadError = { error := fun {α : Type} => Lake.ELog.error }
Instances For
Fail without logging anything.
Equations
- Lake.ELog.failure = do let __do_lift ← Lake.getLogPos throw __do_lift
Instances For
Performs x. If it fails, drop its log and perform y.
Equations
- Lake.ELog.orElse x y = tryCatch x fun (errPos : Lake.Log.Pos) => do Lake.dropLogFrom errPos y ()
Instances For
Alternative instance for monads with Log state and Log.Pos errors.
Equations
- Lake.ELog.alternative = { toApplicative := inst✝².toApplicative, failure := fun {α : Type} => Lake.ELog.failure, orElse := fun {α : Type} => Lake.ELog.orElse }
Instances For
Run self with the log taken from the state of the monad n.
Warning: If lifting self from m to n fails, the log will be lost.
Thus, this is best used when the lift cannot fail.
Equations
- self.takeAndRun = do let __do_lift ← Lake.takeLog let __discr ← liftM (self __do_lift) match __discr with | (a, log) => do set log pure a
Instances For
A monad equipped with a log and the ability to error at some log position.
Equations
Instances For
Equations
Instances For
Equations
- self.run log = Lake.EStateT.run log self
Instances For
Equations
- Lake.ELogT.catchLog f self = Lake.EStateT.catchExceptions self fun (errPos : Lake.Log.Pos) => do let __do_lift ← Lake.takeLogFrom errPos f __do_lift
Instances For
Run self with the log taken from the state of the monad n,
Warning: If lifting self from m to n fails, the log will be lost.
Thus, this is best used when the lift cannot fail. This excludes the
native log position failure of ELogT, which are lifted safely.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Runs self in n and then replays the entries of the resulting log
using the new monad's logger. Translates an exception in this monad
to a none result.
Equations
- self.replayLog? = do let __do_lift ← liftM (self ∅) match __do_lift with | Lake.EResult.ok a log => log.replay *> pure (some a) | Lake.EResult.error a log => log.replay *> pure none
Instances For
Runs self in n and then replays the entries of the resulting log
using the new monad's logger. Translates an exception in this monad to
a failure in the new monad.
Equations
- self.replayLog = do let __do_lift ← liftM (self ∅) match __do_lift with | Lake.EResult.ok a log => log.replay *> pure a | Lake.EResult.error a log => log.replay *> failure
Instances For
A monad equipped with a log, a log error position, and the ability to perform I/O.
Equations
Instances For
Equations
- Lake.instMonadLiftIOLogIO = { monadLift := fun {α : Type} => Lake.MonadError.runIO }
Runs a LogIO action in BaseIO.
Prints log entries of at least minLv to out.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.LogIO.toBaseIO.replay log logger = log.replay
Instances For
A monad equipped with a log function and the ability to perform I/O.
Unlike LogIO, log entries are not retained by the monad but instead eagerly
passed to the log function.
Equations
Instances For
Equations
- Lake.instMonadErrorLoggerIO = { error := fun {α : Type} => Lake.MonadLog.error }
Equations
- Lake.instMonadLiftIOLoggerIO = { monadLift := fun {α : Type} => Lake.MonadError.runIO }
Equations
- Lake.instMonadLiftLogIOLoggerIO = { monadLift := fun {α : Type} => Lake.ELogT.replayLog }
Runs a LoggerIO action in BaseIO.
Prints log entries of at least minLv to out.