-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/logging part 1 #448
Conversation
5757fc7
to
6fa1c3f
Compare
A few things that I did not decide on yet, but we might want to wait until there are more use-cases, although I could be convinced otherwise:
|
c1bc6bc
to
0b9510f
Compare
I would recommend using the
I would recommend
👍, import ALL THE THINGS qualified. |
src/main/haskell/kore/README.md
Outdated
@@ -18,6 +18,9 @@ To regenerate the golden data for regression tests: | |||
`stack test --no-keep-going --ta --accept` | |||
|
|||
To generate documentation: `stack build --haddock`. | |||
Note that because of `co-log`'s `typerep-map` dependency (which fails haddock), | |||
we are currently building with `--no-haddock-deps`. This should be reverted | |||
once `typerep-map`'s haddock is fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you open an issue on our tracker for this, and include a link to the upstream issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have, and they closed it and linked to this bug in stack
: commercialhaskell/stack#3989 ; I'll add this to the docs here.
@@ -183,7 +183,7 @@ execBenchmark root kFile definitionFile mainModuleName test = | |||
-> IO (CommonStepPattern Object) | |||
execution (verifiedModule, purePattern) = | |||
SMT.runSMT SMT.defaultConfig | |||
$ evalSimplifier | |||
$ evalSimplifier mempty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we define a value, say emptyLogger = mempty
, just to keep this clear?
Copyright : (c) Runtime Verification, 2018 | ||
License : NCSA | ||
Maintainer : vladimir.ciobanu@runtimeverification.com | ||
Stability : experimental |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this and all the other new modules, I would be inclined to leave off Stability
and Portability
. Stability
doesn't mean anything, except it makes a tiny note in the upper right-hand corner of the generated documentation that nobody looks at. All of our Portability
fields are wrong, anyway: they should say GHC-only
, which is what everyone's say, or should say, so it's just noise.
@@ -123,7 +126,9 @@ transitionRule tools substitutionSimplifier simplifier = | |||
$ stepWithRewriteRule tools substitutionSimplifier config a | |||
case result of | |||
Left _ -> pure [] | |||
Right results -> return $ mapMaybe (patternFromResult proof) results | |||
Right results -> | |||
Log.withLogScope "transitionRule" $ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we easily get a source location here? There are already multiple things called transitionRule
.
src/main/haskell/kore/src/SMT.hs
Outdated
@@ -7,7 +7,7 @@ Maintainer : thomas.tuegel@runtimeverification.com | |||
-} | |||
|
|||
module SMT | |||
( SMT, getSMT | |||
( SMT (..) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I specifically want to avoid exporting the constructor here:
( SMT (..) | |
( SMT, getSMT |
|
||
-- | This type should not be used directly, but rather should be created and | ||
-- dispatched through the `log` functions. | ||
data LogMessage = LogMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field names here do not conform to the style guide.
While you are at it, can you replace --only-dependencies with --only-snapshot? |
@ttuegel I addressed all comments. I actually need a way to go from the Also, I did not add the formatters library yet. I think formatting the log message is not necessarily the main problem here (it might become soon, I agree). I was actually concerned by |
I think so.
|
Ok, now I get it. I think I might add |
= do | ||
|
||
= Log.withLogScope "stepWithRule" $ do | ||
Log.logDebug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handles both function evaluation and rewrite rule application. There is a good chance that this will be extremely verbose for everything except trivial examples (especially since it's using show and not unparse). Also, if you want to reduce verbosity, both for rewriting and for function application, we apply a (sometimes large) number of axioms on the same pattern, so it might be better to log the pattern in this function's caller and to log only the axiom here.
@@ -0,0 +1,134 @@ | |||
{-| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should include documentation about the expected usage patterns.
{-| | ||
Module : Kore.Logger | ||
Description : Logging functions. | ||
Copyright : (c) Runtime Verification, 2018 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2019
Co-authored-by: devops <devops@runtimeverification.com> Co-authored-by: Georgy Lukyanov <mail@geo2a.info>
Co-authored-by: devops <devops@runtimeverification.com> Co-authored-by: Georgy Lukyanov <mail@geo2a.info>
Co-authored-by: devops <devops@runtimeverification.com> Co-authored-by: Georgy Lukyanov <mail@geo2a.info>
Reviewer checklist
stack test --coverage
stack haddock
stylish-haskell