- quiet: Lake.Verbosity
- normal: Lake.Verbosity
- verbose: Lake.Verbosity
Instances For
Equations
- Lake.instReprVerbosity = { reprPrec := Lake.reprVerbosity✝ }
Equations
- Lake.instDecidableEqVerbosity x y = if h : x.toCtorIdx = y.toCtorIdx then isTrue ⋯ else isFalse ⋯
Whether to ANSI escape codes.
- auto: Lake.AnsiMode
Automatically determine whether to use ANSI escape codes based on whether the stream written to is a terminal.
- ansi: Lake.AnsiMode
Use ANSI escape codes.
- noAnsi: Lake.AnsiMode
Do not use ANSI escape codes.
Instances For
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: Lake.OutStream
- stderr: Lake.OutStream
- stream: IO.FS.Stream → Lake.OutStream
Instances For
Returns the real output stream associated with OutStream
.
Equations
- Lake.OutStream.stdout.get = IO.getStdout
- Lake.OutStream.stderr.get = IO.getStderr
- (Lake.OutStream.stream s).get = pure s
Instances For
Equations
- Lake.instCoeHandleOutStream = { coe := fun (h : IO.FS.Handle) => Lake.OutStream.stream (IO.FS.Stream.ofHandle h) }
- trace: Lake.LogLevel
- info: Lake.LogLevel
- warning: Lake.LogLevel
- error: Lake.LogLevel
Instances For
Equations
- Lake.instOrdLogLevel = { compare := Lake.ordLogLevel✝ }
Equations
- Lake.instFromJsonLogLevel = { fromJson? := Lake.fromJsonLogLevel✝ }
Unicode icon for representing the log level.
Equations
- Lake.LogLevel.trace.icon = 'ℹ'
- Lake.LogLevel.info.icon = 'ℹ'
- Lake.LogLevel.warning.icon = '⚠'
- Lake.LogLevel.error.icon = '✖'
Instances For
ANSI escape code for coloring text of at the log level.
Instances For
Equations
- Lake.LogLevel.info.toMessageSeverity = Lean.MessageSeverity.information
- Lake.LogLevel.trace.toMessageSeverity = Lean.MessageSeverity.information
- Lake.LogLevel.warning.toMessageSeverity = Lean.MessageSeverity.warning
- Lake.LogLevel.error.toMessageSeverity = Lean.MessageSeverity.error
Instances For
Equations
- Lake.instFromJsonLogEntry = { fromJson? := Lake.fromJsonLogEntry✝ }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.logVerbose message = Lake.logEntry { level := Lake.LogLevel.trace, message := message }
Instances For
Equations
- Lake.logInfo message = Lake.logEntry { level := Lake.LogLevel.info, message := message }
Instances For
Instances For
Equations
- Lake.logError message = Lake.logEntry { level := Lake.LogLevel.error, message := message }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.logToStream e out minLv useAnsi = if e.level ≥ minLv then EIO.catchExceptions (out.putStrLn (e.toString useAnsi)) fun (x : IO.Error) => pure () else pure PUnit.unit
Instances For
Equations
- Lake.MonadLog.nop = { logEntry := fun (x : Lake.LogEntry) => pure () }
Instances For
Equations
- Lake.MonadLog.instInhabitedOfPure = { default := Lake.MonadLog.nop }
Instances For
Instances For
Equations
- Lake.MonadLog.stream out minLv useAnsi = { logEntry := fun (e : Lake.LogEntry) => liftM (Lake.logToStream e out minLv useAnsi) }
Instances For
Instances For
Instances For
Equations
- out.logger minLv ansiMode = { logEntry := fun (e : Lake.LogEntry) => liftM (out.logEntry e minLv ansiMode) }
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
Instances For
Equations
- Lake.MonadLogT.instInhabitedOfPure = { default := fun (x : Lake.MonadLog m) => pure default }
Equations
- Lake.MonadLogT.adaptMethods f self = ReaderT.adapt f self
Instances For
Instances For
Equations
- Lake.instToJsonLog = { toJson := fun (x : Lake.Log) => Lean.toJson x.entries }
Equations
- Lake.Log.instInhabitedPos = { default := { val := default } }
Equations
- Lake.Log.instEmptyCollection = { emptyCollection := Lake.Log.empty }
Takes log entries between start
(inclusive) and stop
(exclusive).
Equations
- log.extract start stop = { entries := log.entries.extract start.val stop.val }
Instances For
Removes log entries after pos
(inclusive).
Instances For
Takes log entries before pos
(exclusive).
Instances For
Splits the log into two from pos
.
The first log is from the start to pos
(exclusive),
and the second log is from pos
(inclusive) to the end.
Equations
- log.split pos = (log.dropFrom pos, log.takeFrom pos)
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
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 current end position of the monad's log (i.e., its size).
Instances For
Removes the monad's log starting at pos
and returns it.
Useful for extracting logged errors after catching an error position
from an ELogT
(e.g., LogIO
).
Equations
- Lake.takeLogFrom pos = modifyGet fun (log : Lake.Log) => (log.takeFrom pos, log.dropFrom pos)
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.
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.
Instances For
Captures IO in x
into an informational log entry.
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.
Instances For
Fail without logging anything.
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 = Alternative.mk (fun {α : Type} => Lake.ELog.failure) fun {α : Type} => Lake.ELog.orElse
Instances For
Equations
- Lake.instMonadLogLogTOfMonad = Lake.MonadLog.ofMonadState
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.
Instances For
Runs self
in n
and then replays the entries of the resulting log
using the new monad's logger
.
Equations
Instances For
A monad equipped with a log and the ability to error at some log position.
Equations
Instances For
Equations
Instances For
Equations
- Lake.instMonadErrorELogTOfMonad = Lake.ELog.monadError
Equations
- self.run log = Lake.EStateT.run log self
Instances For
Instances For
Instances For
Instances For
Equations
- self.run?' log = Lake.EStateT.run?' log self
Instances For
Instances For
Equations
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
Runs a LogIO
action in BaseIO
.
Prints log entries of at least minLv
to out
.
Instances For
Equations
- Lake.LogIO.toBaseIO.replay log logger = log.replay
Instances For
Equations
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.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
.
Equations
- self.toBaseIO minLv ansiMode out = do let __do_lift ← out.getLogger minLv ansiMode (fun (x : Except PUnit α) => x.toOption) <$> (ReaderT.run self __do_lift).toBaseIO
Instances For
Equations
- One or more equations did not get rendered due to their size.