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 a tagged method, and some additional functionality around the request fields and tags. #4

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

anoldguy
Copy link

@anoldguy anoldguy commented Aug 27, 2021

Block Usage:

Rackstash.tagged(:foo) { Rails.logger.info "Hello" }

Set-and-forget Usage:

Rackstash.tagged(:foo)
Rails.logger.info "Hello"

Also, bring similar functionality to the request fields:

  config.rackstash.request_tags = [
    lambda { |request| request.subdomains.first || "no-account" },
    lambda { |request|
      case
      when request.subdomains.first == "monitoring"
        "monitoring"
      when request.path.starts_with?("/foo")
        "foo"
      else
        "web"
      end
    }
  ]

anoldguy and others added 6 commits August 27, 2021 14:53
Block Usage:
Rackstash.with_tags(:foo) { Rails.logger.info "Hello" }

Set-and-forget Usage:
Rackstash.with_tags(:foo)
Rails.logger.info "Hello"
`Rackstash.request_tags=` accepts an Array of callable objects or strings.
Callable objects will be called with the current request.

Usage:

  config.rackstash.request_tags = [
    lambda { |request| request.subdomains.first || "no-account" },
    lambda { |request|
      case
      when request.subdomains.first == "37smonitoring"
        "monitoring"
      when request.path.starts_with?("/queenbee")
        "queenbee"
      else
        "web"
      end
    }
  ]
Introduce request_tags to capture tags from the current request
Call request_fields with the current request
@anoldguy anoldguy changed the title Add a with_tags method. Add a tagged method, and some additional functionality around the request fields and tags. Sep 29, 2021
* delegate-logger-tagged-method:
  Expose the #tagged method on BufferedLogger so it can be used through the logger instance
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.

2 participants