Class: Rage::Configuration::LogTags

Inherits:
LogContext show all
Defined in:
lib/rage/configuration.rb

Instance Method Summary collapse

Instance Method Details

#<<(string) ⇒ Object #<<(callable) ⇒ Object

Add a new custom log tag. Each tag is evaluated independently and the results are merged into the final log entry.

Overloads:

  • #<<(string) ⇒ Object

    Add a static log tag.

    Examples:

    Rage.configure do
      config.log_tags << Rage.env
    end

    Parameters:

    • string (String)

      the log tag

  • #<<(callable) ⇒ Object
    Note:

    Exceptions from dynamic tag callables will cause the entire request to fail. Make sure to handle exceptions inside the callable if necessary.

    Add a dynamic log tag. Dynamic tags are executed on every log call.

    Examples:

    Rage.configure do
      config.log_tags << proc { Current.tenant.slug }
    end

    Parameters:

    • callable (#call)

      a callable object that returns a string representing the log tag, an array of log tags, or nil



# File 'lib/rage/configuration.rb', line 275

#delete(block_or_string) ⇒ Object

Remove a custom log tag object.

Examples:

Rage.configure do
  config.log_tags.delete(MyObservabilitySDK::LOG_TAGS)
end

Parameters:

  • block_or_string (String, #call)

    the tag object to remove



# File 'lib/rage/configuration.rb', line 293