Documentation

Lean.Log

class Lean.MonadLog (m : TypeType) extends Lean.MonadFileMap :
  • Return the current reference syntax being used to provide position information.

    getRef : m Lean.Syntax
  • The name of the file being processed.

    getFileName : m String
  • Return true if errors have been logged.

    hasErrors : m Bool
  • Log a new message.

    logMessage : Lean.Messagem Unit

The MonadLog interface for logging error messages.

Instances
    instance Lean.instMonadLog (m : TypeType) (n : TypeType) [inst : MonadLift m n] [inst : Lean.MonadLog m] :
    Equations
    def Lean.getRefPos {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] :

    Return the position (as String.pos) associated with the current reference syntax (i.e., the syntax object returned by getRef.)

    Equations
    def Lean.getRefPosition {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] :

    Return the line and column numbers associated with the current reference syntax (i.e., the syntax object returned by getRef.)

    Equations

    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.
    def Lean.logErrorAt {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] [inst : Lean.AddMessageContext m] [inst : Lean.MonadOptions m] (ref : Lean.Syntax) (msgData : Lean.MessageData) :

    Log a new error message using the given message data. The position is provided by ref.

    Equations
    def Lean.logWarningAt {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] [inst : Lean.AddMessageContext m] [inst : Lean.MonadOptions m] (ref : Lean.Syntax) (msgData : Lean.MessageData) :

    Log a new warning message using the given message data. The position is provided by ref.

    Equations
    def Lean.logInfoAt {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] [inst : Lean.AddMessageContext m] [inst : Lean.MonadOptions m] (ref : Lean.Syntax) (msgData : Lean.MessageData) :

    Log a new information message using the given message data. The position is provided by ref.

    Equations

    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
    def Lean.logError {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] [inst : Lean.AddMessageContext m] [inst : Lean.MonadOptions m] (msgData : Lean.MessageData) :

    Log a new error message using the given message data. The position is provided by getRef.

    Equations
    def Lean.logWarning {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] [inst : Lean.AddMessageContext m] [inst : Lean.MonadOptions m] (msgData : Lean.MessageData) :

    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.
    def Lean.logInfo {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] [inst : Lean.AddMessageContext m] [inst : Lean.MonadOptions m] (msgData : Lean.MessageData) :

    Log a new information message using the given message data. The position is provided by getRef.

    Equations
    def Lean.logUnknownDecl {m : TypeType} [inst : Monad m] [inst : Lean.MonadLog m] [inst : Lean.AddMessageContext m] [inst : Lean.MonadOptions m] (declName : Lean.Name) :

    Log the error message "unknown declaration"

    Equations