The MonadLog
interface for logging error messages.
- getFileMap : m Lean.FileMap
- getRef : m Lean.Syntax
Return the current reference syntax being used to provide position information.
- getFileName : m String
The name of the file being processed.
- hasErrors : m Bool
Return
true
if errors have been logged. - logMessage : Lean.Message → m Unit
Log a new message.
Instances
Equations
- Lean.instMonadLog m n = Lean.MonadLog.mk (liftM Lean.MonadLog.getRef) (liftM Lean.getFileName) (liftM Lean.MonadLog.hasErrors) fun (msg : Lean.Message) => liftM (Lean.logMessage msg)
Return the position (as String.pos
) associated with the current reference syntax (i.e., the syntax object returned by getRef
.)
Equations
- Lean.getRefPos = do let ref ← Lean.MonadLog.getRef pure (Option.getD (Lean.Syntax.getPos? ref) 0)
Instances For
Return the line and column numbers associated with the current reference syntax (i.e., the syntax object returned by getRef
.)
Equations
- Lean.getRefPosition = do let fileMap ← Lean.getFileMap let __do_lift ← Lean.getRefPos pure (Lean.FileMap.toPosition fileMap __do_lift)
Instances For
If warningAsError
is set to true
, then warning messages are treated as errors.
Log the message msgData
at the position provided by ref
with the given severity
.
If getRef
has position information but ref
does not, we use getRef
.
We use the fileMap
to find the line and column numbers for the error message.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Log a new error message using the given message data. The position is provided by ref
.
Equations
- Lean.logErrorAt ref msgData = Lean.logAt ref msgData
Instances For
Log a new warning message using the given message data. The position is provided by ref
.
Equations
- Lean.logWarningAt ref msgData = Lean.logAt ref msgData Lean.MessageSeverity.warning
Instances For
Log a new information message using the given message data. The position is provided by ref
.
Equations
- Lean.logInfoAt ref msgData = Lean.logAt ref msgData Lean.MessageSeverity.information
Instances For
Log a new error/warning/information message using the given message data and severity
. The position is provided by getRef
.
Equations
- Lean.log msgData severity = do let ref ← Lean.MonadLog.getRef Lean.logAt ref msgData severity
Instances For
Log a new error message using the given message data. The position is provided by getRef
.
Equations
- Lean.logError msgData = Lean.log msgData
Instances For
Log a new warning message using the given message data. The position is provided by getRef
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Log a new information message using the given message data. The position is provided by getRef
.
Equations
- Lean.logInfo msgData = Lean.log msgData Lean.MessageSeverity.information
Instances For
Log the error message "unknown declaration"
Equations
- Lean.logUnknownDecl declName = Lean.logError (Lean.toMessageData "unknown declaration '" ++ Lean.toMessageData declName ++ Lean.toMessageData "'")