Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Logs msgs = ?outputConfig :: OutputConfig msgs
- data OutputConfig msgs = OutputConfig {
- _outputHandle :: Handle
- _quiet :: Bool
- _logMsg :: LogAction IO msgs
- _logExc :: LogAction IO SomeException
- _logSimResult :: Bool -> LogAction IO CruxSimulationResult
- _logGoal :: LogAction IO ProvedGoals
- outputHandle :: Getter (OutputConfig msgs) Handle
- quiet :: Getter (OutputConfig msgs) Bool
- data CruxLogMessage
- = AttemptingProvingVCs
- | Checking [FilePath]
- | DisablingBranchCoverageRequiresPathSatisfiability
- | DisablingProfilingIncompatibleWithPathSplitting
- | EndedGoal Integer
- | FoundCounterExample
- | Help LogDoc
- | PathsUnexplored Int
- | ProofObligations [LogProofObligation]
- | SimulationComplete
- | SimulationTimedOut
- | SkippingUnsatCoresBecauseMCSatEnabled
- | StartedGoal Integer
- | TotalPathsExplored Word64
- | UnsupportedTimeoutFor String
- | Version Text Version
- newtype LogDoc = LogDoc (SimpleDocStream ())
- data LogProofObligation = forall t st fs. LogProofObligation (ProofObligation (ExprBuilder t st fs))
- data SayWhat
- data SayLevel
- type SupportsCruxLogMessage msgs = ?injectCruxLogMessage :: CruxLogMessage -> msgs
- cruxLogMessageToSayWhat :: CruxLogMessage -> SayWhat
- cruxLogTag :: Text
- logException :: Logs msgs => SomeException -> IO ()
- logGoal :: Logs msgs => ProvedGoals -> IO ()
- logSimResult :: Logs msgs => Bool -> CruxSimulationResult -> IO ()
- say :: Logs msgs => (?injectMessage :: msg -> msgs) => msg -> IO ()
- sayCrux :: Logs msgs => SupportsCruxLogMessage msgs => CruxLogMessage -> IO ()
- withCruxLogMessage :: (SupportsCruxLogMessage CruxLogMessage => a) -> a
- output :: Logs msgs => String -> IO ()
- outputLn :: Logs msgs => String -> IO ()
- logToStd :: (Handle, Bool) -> (Handle, Bool) -> SayWhat -> IO ()
Output Configuration
type Logs msgs = ?outputConfig :: OutputConfig msgs Source #
The Logs constraint should be applied for any function that will use the main logging functions: says, logException, logSimResult, or logGoal.
data OutputConfig msgs Source #
Global options for Crux's main. These are not CruxOptions because they are expected to be set directly by main, rather than by a user's command-line options. They exist primarily to improve the testability of the code.
The Crux mkOutputConfig is recommended as a helper function for creating this object, although it can be initialized directly if needed.
OutputConfig | |
|
outputHandle :: Getter (OutputConfig msgs) Handle Source #
Some client code will want to output to the main output stream directly instead of using the logging/output functions above. It can either get the _outputHandle directly or it can use the output/outputLn functions below.
quiet :: Getter (OutputConfig msgs) Bool Source #
Lens to allow client code to determine if running in quiet mode.
Standard output API functions
data CruxLogMessage Source #
All messages that Crux wants to output should be listed here.
Messages ought to be serializable to JSON so that they have a somewhat
portable machine-readable representation. Some tools may rely on the
serialization format, so be sure to check with consumers before changing the
ToJSON
instance.
Other crux-based tools are encouraged to create their own:
- log message datatype 'ToolLogMessage', similar to
CruxLogMessage
below, - constraint synonym 'SupportsToolLogMessage' similar to
SupportsCruxLogMessage
below, - constraint dispatcher 'withToolLogMessage' similar to
withCruxLogMessage
below, - logger method 'sayTool' similar to
sayCrux
below, - default log message converter 'ToolLogMessageToSayWhat' similar to
cruxLogMessageToSayWhat
.
The default log message converter can be used to decide how messages are displayed to the standard output for a human consumer. Automated tools may prefer to filter and encode log messages in some machine-readable format and exchange it over a separate channel.
Instances
LogDoc (SimpleDocStream ()) |
data LogProofObligation Source #
A version of ProofObligation
that supports a ToJSON
instance.
forall t st fs. LogProofObligation (ProofObligation (ExprBuilder t st fs)) |
Instances
ToJSON LogProofObligation Source # | |
Defined in Crux.Log toJSON :: LogProofObligation -> Value # toEncoding :: LogProofObligation -> Encoding # toJSONList :: [LogProofObligation] -> Value # toEncodingList :: [LogProofObligation] -> Encoding # omitField :: LogProofObligation -> Bool # |
Specify some general text that should be presented (to the user).
Specify the verbosity/severity level of a message. These are in ordinal order for possible filtering, and higher levels may be sent to a different location (e.g. stderr v.s. stdout).
type SupportsCruxLogMessage msgs = ?injectCruxLogMessage :: CruxLogMessage -> msgs Source #
cruxLogTag :: Text Source #
logException :: Logs msgs => SomeException -> IO () Source #
Function used to log/output exception information
logGoal :: Logs msgs => ProvedGoals -> IO () Source #
Function used to output any individual goal proof failures from a simulation
logSimResult :: Logs msgs => Bool -> CruxSimulationResult -> IO () Source #
Function used to output the summary result for a completed simulation. If the flag is true, show the details of each failed goal before showing the summary.
say :: Logs msgs => (?injectMessage :: msg -> msgs) => msg -> IO () Source #
Main function used to log/output a general text message of some kind
sayCrux :: Logs msgs => SupportsCruxLogMessage msgs => CruxLogMessage -> IO () Source #
withCruxLogMessage :: (SupportsCruxLogMessage CruxLogMessage => a) -> a Source #
Low-level output API functions
output :: Logs msgs => String -> IO () Source #
This function emits output to the normal output handle (specified
at initialization time). This function is not recommended for
general use (the says
, logException
, logSimResult
, logGoal
,
etc. are preferred), but can be used by code needing more control
over the output formatting.
This function does _not_ emit a newline at the end of the output.
outputLn :: Logs msgs => String -> IO () Source #
This function emits output to the normal output handle (specified
at initialization time). This function is not recommended for
general use (the says
, logException
, logSimResult
, logGoal
,
etc. are preferred), but can be used by code needing more control
over the output formatting.
This function emits a newline at the end of the output.
Converting and emitting output
logToStd :: (Handle, Bool) -> (Handle, Bool) -> SayWhat -> IO () Source #
This is the default logging output function for a SayWhat message. It will emit the information with possible coloring (if enabled via the first argument) to the proper handle (normal output goes to the first handle, error output goes to the second handle, and the same handle may be used for both).
Front-ends that don't have specific output needs can simply use this function. Alternative output functions can be used where useful (e.g. JSON output).