Skip to content
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

Add CIDER log middleware #774

Merged
merged 1 commit into from
Jun 27, 2023
Merged

Conversation

r0man
Copy link
Contributor

@r0man r0man commented Jun 26, 2023

This PR adds the CIDER log middleware, now with logjam extracted into its own repository.

The initial PR was this one:
#773

And this for the CIDER side:
clojure-emacs/cider#3352

Before submitting a PR make sure the following things have been done:

  • The commits are consistent with our contribution guidelines
  • You've added tests to cover your change(s)
  • All tests are passing
  • The new code is not generating reflection warnings
  • You've updated the README (if adding/changing middleware)

Thanks!

@r0man
Copy link
Contributor Author

r0man commented Jun 26, 2023

@vemv @bbatsov Do we want to inline the logjam dependency or not?

I gave it a try, but it looks like running the tests with the rewritten logjam library fail, because they reference the logjam library and not the re-written one. I also tried adding the non-rewritten logjam library to the test profile, but that also fails.

If we want to inline I can take a look at somehow getting mr anderson to work with it, or get rid of the references in the tests (I'm using framework/log there to log test messages without having to deal with the specific implementation).

Copy link
Member

@vemv vemv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - impresive work!

Some superficial suggestions.

@@ -1,5 +1,6 @@
{:hooks {:analyze-call {cider.nrepl.middleware.out/with-out-binding
hooks.core/with-out-binding}}
:lint-as {cider.nrepl.middleware.log-test/with-each-framework clojure.core/let}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@r0man r0man Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to export this symbol, so it is picked up by clojure lsp in other projects?

I think we don't need this here. It's a macro defined and used only in the cider-nrepl tests. It it not used by other libraries. But maybe you mean something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to export this symbol, so it is picked up by clojure lsp in other projects?

Sure, if logjam includes that file, any consumers (including cider-nrepl) will pick it up. It's DRYer.

test/clj/cider/nrepl/middleware/log_test.clj Show resolved Hide resolved
test/clj/cider/nrepl/middleware/log_test.clj Show resolved Hide resolved
test/clj/cider/nrepl/middleware/log_test.clj Show resolved Hide resolved
test/clj/cider/nrepl/middleware/log_test.clj Show resolved Hide resolved
test/clj/cider/nrepl/middleware/log_test.clj Show resolved Hide resolved
test/clj/cider/nrepl/middleware/log_test.clj Show resolved Hide resolved
test/clj/cider/nrepl/middleware/log_test.clj Show resolved Hide resolved
@vemv
Copy link
Member

vemv commented Jun 26, 2023

@vemv @bbatsov Do we want to inline the logjam dependency or not?

Depends on who you ask. 😄

I'd prefer so. But from memory, it can be tricky for it to work in tests. We'd have to look at what refactor-nrepl or some other example does.

But that can be left for later.

@bbatsov
Copy link
Member

bbatsov commented Jun 26, 2023

I'm fine with not inlining the dep - I don't expect any runtime conflicts with it.

Btw, how are the tests passing on Clojure 1.8? I thought logjam required 1.9.

@vemv
Copy link
Member

vemv commented Jun 26, 2023

I'm fine with not inlining the dep - I don't expect any runtime conflicts with it.

Yeah especially given that it brings no transitive deps in.

Maybe just add:

[mx.cider/logjam "0.1.1"] ;; not inlined because it's internal CIDER tooling with no transitive dependencies (please verify this remains the case whenever you update this dep)

@r0man
Copy link
Contributor Author

r0man commented Jun 27, 2023

I'm fine with not inlining the dep - I don't expect any runtime conflicts with it.

Btw, how are the tests passing on Clojure 1.8? I thought logjam required 1.9.

I was also wondering when I initially opened the PR. Now that we have logjam in a separate repo, and we don't ship the specs nor reference them, it's not a hard requirement for depending on it. It's only needed for tests.

@r0man
Copy link
Contributor Author

r0man commented Jun 27, 2023

@vemv Thanks for the review. I hope I addressed your comments.

@bbatsov
Copy link
Member

bbatsov commented Jun 27, 2023

I was also wondering when I initially opened the PR. Now that we have logjam in a separate repo, and we don't ship the specs nor reference them, it's not a hard requirement for depending on it. It's only needed for tests.

Ah, even better! This means that the new functionality can land in the next CIDER release!

@bbatsov bbatsov merged commit 36bb844 into clojure-emacs:master Jun 27, 2023
@vemv
Copy link
Member

vemv commented Jun 28, 2023

I hope I addressed your comments.

You sure did - kudos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants