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

Move Rack::Logger from rack to rack-contrib. #194

Closed
wants to merge 1 commit into from

Conversation

ioquatix
Copy link
Member

No description provided.

@ioquatix ioquatix changed the title Add Rack::Logger. Move Rack::Logger from rack to rack-contrib. Jun 11, 2024
@Earlopain
Copy link

How would this work?

The middleware doesn't have any dependencies other than rack and the ruby standard library.

It's std now but not for long

@Earlopain
Copy link

Earlopain commented Jun 11, 2024

I think, if you're moving this here anyways, does it make sense to require the user to pass in an object that adheres to the rack logger interface themselves?

@ioquatix
Copy link
Member Author

ioquatix commented Jun 11, 2024

The current plan is for us to wait and see if anyone complains about the deprecation. If no one complains, we'll probably remove it with no replacement. As you've said, the current implementation leaves a lot to be desired.

@mpalmer
Copy link
Contributor

mpalmer commented Jun 11, 2024

I'm not sure I understand the rationale for moving this to rack-contrib. My understanding of SPEC is that rack.logger must be set to some logger-like object. This means that either:

  1. Rack (or servers that implement rack) will provide a default (doesn't-depend-on-logger) implementation that conforms to SPEC; or
  2. Every single application in existence will have to either provide their own rack.logger implementation or else include Rack::Logger as their first middleware, making rack-contrib de facto a dependency of basically every app.

Since I understand that (1) is the plan, I kinda feel like this middleware would get essentially zero usage.

@Earlopain
Copy link

Earlopain commented Jun 11, 2024

rack.logger is optional, per my understanding. From Rack::Lint: https://github.com/rack/rack/blob/38b178e9ce3b30453cd5340a92093128bfb4fa36/lib/rack/lint.rb#L232

This is preceded by the following:

   ## Additional environment specifications have approved to
   ## standardized middleware APIs. None of these are required to
   ## be implemented by the server.

@mpalmer
Copy link
Contributor

mpalmer commented Jun 11, 2024

Ah, thanks for pointing that out. I'd somehow skipped over that when refreshing my cache of SPEC. That explains why moving this middleware over here makes sense.

@@ -0,0 +1,23 @@
# frozen_string_literal: true

require 'logger'
Copy link
Contributor

Choose a reason for hiding this comment

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

As I think @Earlopain pointed out earlier, the general criteria for inclusion in rack-contrib is "no new external deps", and with Logger getting evicted with Ruby 3.5, that gets a bit messy. Are you up for writing a super-slim pseudo-logger that just dumps to rack.errors?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's one idea, I started writing it but then just thought, why am I doing this?

@ioquatix
Copy link
Member Author

For now, let's just close this PR.

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