- 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 ⋯
Equations
- Lake.instOrdVerbosity = { compare := Lake.ordVerbosity✝ }
Equations
- Lake.instInhabitedVerbosity = { default := Lake.Verbosity.normal }
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
- Lake.AnsiMode.isEnabled out x = match x with | Lake.AnsiMode.auto => out.isTty | Lake.AnsiMode.ansi => pure true | Lake.AnsiMode.noAnsi => pure false
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
- x.get = match x with | Lake.OutStream.stdout => IO.getStdout | Lake.OutStream.stderr => IO.getStderr | Lake.OutStream.stream s => pure s
Instances For
Equations
- Lake.instCoeStreamOutStream = { coe := Lake.OutStream.stream }
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.instInhabitedLogLevel = { default := Lake.LogLevel.trace }
Equations
- Lake.instReprLogLevel = { reprPrec := Lake.reprLogLevel✝ }
Equations
- Lake.instDecidableEqLogLevel x y = if h : x.toCtorIdx = y.toCtorIdx then isTrue ⋯ else isFalse ⋯
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
- x.icon = match x with | Lake.LogLevel.trace => 'ℹ' | Lake.LogLevel.info => 'ℹ' | Lake.LogLevel.warning => '⚠' | Lake.LogLevel.error => '✖'
Instances For
ANSI escape code for coloring text of at the log level.
Equations
- x.ansiColor = match x with | Lake.LogLevel.trace => "34" | Lake.LogLevel.info => "34" | Lake.LogLevel.warning => "33" | Lake.LogLevel.error => "31"
Instances For
Equations
- x.toString = match x with | Lake.LogLevel.trace => "trace" | Lake.LogLevel.info => "info" | Lake.LogLevel.warning => "warning" | Lake.LogLevel.error => "error"
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.instToStringLogLevel = { toString := Lake.LogLevel.toString }
Equations
- x.minLogLv = match x with | Lake.Verbosity.quiet => Lake.LogLevel.warning | Lake.Verbosity.normal => Lake.LogLevel.info | Lake.Verbosity.verbose => Lake.LogLevel.trace
Instances For
Equations
- Lake.instInhabitedLogEntry = { default := { level := default, message := default } }
Equations
- Lake.instToJsonLogEntry = { toJson := Lake.toJsonLogEntry✝ }
Equations
- Lake.instFromJsonLogEntry = { fromJson? := Lake.fromJsonLogEntry✝ }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.instToStringLogEntry = { toString := fun (self : Lake.LogEntry) => self.toString }
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
Equations
- Lake.logWarning message = Lake.logEntry { level := Lake.LogLevel.warning, message := message }
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 }
Equations
- self.lift = { logEntry := fun (e : Lake.LogEntry) => liftM (Lake.logEntry e) }
Instances For
Equations
- Lake.MonadLog.instOfMonadLift = methods.lift
Equations
- Lake.MonadLog.io minLv = { logEntry := fun (e : Lake.LogEntry) => liftM (Lake.logToIO e minLv) }
Instances For
Equations
- Lake.MonadLog.stream out minLv useAnsi = { logEntry := fun (e : Lake.LogEntry) => liftM (Lake.logToStream e out minLv useAnsi) }
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
- 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
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.instInhabitedOfPure = { default := fun (x : Lake.MonadLog m) => pure default }
Equations
- Lake.MonadLogT.instMonadLogOfMonadOfMonadLiftT = { logEntry := fun (e : Lake.LogEntry) => do let __do_lift ← read liftM (Lake.logEntry e) }
Equations
- Lake.MonadLogT.adaptMethods f self = ReaderT.adapt f self
Instances For
Equations
- self.ignoreLog = self Lake.MonadLog.nop
Instances For
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.Log.instInhabitedPos = { default := { val := default } }
Equations
- Lake.instOfNatPos = { ofNat := { val := 0 } }
Equations
- Lake.Log.instEmptyCollection = { emptyCollection := Lake.Log.empty }
Equations
- Lake.Log.instAppend = { append := Lake.Log.append }
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).
Equations
- log.dropFrom pos = { entries := log.entries.shrink pos.val }
Instances For
Takes log entries before pos
(exclusive).
Equations
- log.takeFrom pos = log.extract pos log.endPos
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
- log.toString = Array.foldl (fun (x : String) (x_1 : Lake.LogEntry) => x ++ x_1.toString ++ "\n") "" log.entries 0
Instances For
Equations
- Lake.Log.instToString = { toString := Lake.Log.toString }
Equations
- log.replay = Array.forM (fun (e : Lake.LogEntry) => Lake.logEntry e) log.entries 0
Instances For
The max log level of entries in this log. If empty, returns trace
.
Equations
- log.maxLv = Array.foldl (fun (x : Lake.LogLevel) (x_1 : Lake.LogEntry) => max x x_1.level) Lake.LogLevel.trace log.entries 0
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.
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
Alternative
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.
Equations
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.instMonadLogELogTOfMonad = Lake.MonadLog.ofMonadState
Equations
- Lake.instMonadErrorELogTOfMonad = Lake.ELog.monadError
Equations
- Lake.instAlternativeELogTOfMonad = Lake.ELog.alternative
Equations
- self.run log = Lake.EStateT.run log self
Instances For
Equations
- self.run' log = Lake.EStateT.run' log self
Instances For
Equations
- self.toLogT = Lake.EStateT.toStateT self
Instances For
Equations
- self.toLogT? = Lake.EStateT.toStateT? self
Instances For
Equations
- self.run? log = Lake.EStateT.run? log self
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
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. Note 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
- 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 failure
in the new monad.
Equations
- One or more equations did not get rendered due to their size.
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 }
Equations
Instances For
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