- 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
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 (s : 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.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
- 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.
Equations
- Lake.LogLevel.trace.ansiColor = "34"
- Lake.LogLevel.info.ansiColor = "34"
- Lake.LogLevel.warning.ansiColor = "33"
- Lake.LogLevel.error.ansiColor = "31"
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
- 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.Verbosity.quiet.minLogLv = Lake.LogLevel.warning
- Lake.Verbosity.normal.minLogLv = Lake.LogLevel.info
- Lake.Verbosity.verbose.minLogLv = 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 }
- logEntry (e : Lake.LogEntry) : m PUnit
Instances
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
- 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
- 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.take 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 (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 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
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.
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. 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
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.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
.
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.
Instances For
Instances For
Equations
- self.run?' logger = (fun (x : Except PUnit α) => x.toOption) <$> (ReaderT.run self { logEntry := logger }).toBaseIO