From 7c09b4ffc3cfb520464bdf019ce78747a98dd869 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Wed, 2 Dec 2026 12:40:13 +1300 Subject: [PATCH 1/3] Update the gems, including websocket-driver 0.9.0 for GHSA-pf93-24xc-xgxc, and regenerate their RBIs --- .cspell.json | 3 +- CHANGELOG.md | 8 + Gemfile.lock | 46 +- sorbet/rbi/gems/addressable@2.10.0.rbi | 3518 +++++ sorbet/rbi/gems/addressable@2.9.2.rbi | 2081 --- ...ol@3.0.2.rbi => connection_pool@3.0.3.rbi} | 98 +- .../gems/{down@5.6.2.rbi => down@5.6.3.rbi} | 0 ...dger@6.10.1.rbi => honeybadger@6.10.2.rbi} | 0 .../gems/{json@3.1.0.rbi => json@3.2.0.rbi} | 104 +- ...{lograge@0.15.1.rbi => lograge@0.16.0.rbi} | 262 +- .../gems/{rack@3.2.8.rbi => rack@3.2.9.rbi} | 198 +- sorbet/rbi/gems/semantic_logger@5.2.0.rbi | 6684 --------- sorbet/rbi/gems/semantic_logger@5.3.0.rbi | 11424 ++++++++++++++++ ...y-ruby@7.2.0.rbi => sentry-ruby@7.3.0.rbi} | 987 +- .../{shrine@3.10.2.rbi => shrine@3.11.0.rbi} | 0 sorbet/rbi/gems/websocket-driver@0.8.2.rbi | 996 -- sorbet/rbi/gems/websocket-driver@0.9.0.rbi | 888 ++ .../rbi/gems/websocket-extensions@0.1.5.rbi | 121 - .../rbi/gems/websocket-extensions@0.2.0.rbi | 177 + 19 files changed, 17120 insertions(+), 10475 deletions(-) create mode 100644 sorbet/rbi/gems/addressable@2.10.0.rbi delete mode 100644 sorbet/rbi/gems/addressable@2.9.2.rbi rename sorbet/rbi/gems/{connection_pool@3.0.2.rbi => connection_pool@3.0.3.rbi} (83%) rename sorbet/rbi/gems/{down@5.6.2.rbi => down@5.6.3.rbi} (100%) rename sorbet/rbi/gems/{honeybadger@6.10.1.rbi => honeybadger@6.10.2.rbi} (100%) rename sorbet/rbi/gems/{json@3.1.0.rbi => json@3.2.0.rbi} (96%) rename sorbet/rbi/gems/{lograge@0.15.1.rbi => lograge@0.16.0.rbi} (64%) rename sorbet/rbi/gems/{rack@3.2.8.rbi => rack@3.2.9.rbi} (96%) delete mode 100644 sorbet/rbi/gems/semantic_logger@5.2.0.rbi create mode 100644 sorbet/rbi/gems/semantic_logger@5.3.0.rbi rename sorbet/rbi/gems/{sentry-ruby@7.2.0.rbi => sentry-ruby@7.3.0.rbi} (88%) rename sorbet/rbi/gems/{shrine@3.10.2.rbi => shrine@3.11.0.rbi} (100%) delete mode 100644 sorbet/rbi/gems/websocket-driver@0.8.2.rbi create mode 100644 sorbet/rbi/gems/websocket-driver@0.9.0.rbi delete mode 100644 sorbet/rbi/gems/websocket-extensions@0.1.5.rbi create mode 100644 sorbet/rbi/gems/websocket-extensions@0.2.0.rbi diff --git a/.cspell.json b/.cspell.json index 6be4789b..8f16dd33 100644 --- a/.cspell.json +++ b/.cspell.json @@ -11,7 +11,8 @@ "overrides": [], "ignoreRegExpList": [ "/\\b[A-Za-z]+'[A-Za-z]+\\b/g", - "/\\\\e\\[[0-9;]*m/g" + "/\\\\e\\[[0-9;]*m/g", + "/\\bGHSA(-[0-9a-z]{4}){3}\\b/g" ], "useGitignore": true, "dictionaryDefinitions": [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 62613401..2e677ec1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- **Development**: Update the tests' gems, including SemanticLogger 5.3, Sentry 7.3, Lograge 0.16, Shrine 3.11 and Sorbet 0.6.13715. Update CSpell to 10.5 and Prettier to 3.10, and the docs site to Next.js 16.4.6, lucide-react 1.77, Recharts 3.11, Biome 2.6.9 and Playwright 1.65.1. + +### Fixed + +- **Development**: Update websocket-driver to 0.9.0, which fixes GHSA-pf93-24xc-xgxc, for the ActionCable that the tests load with Rails. In the docs site's development tools, update glob to 14.0.6 (GHSA-qxr8-q827-836c), minimatch to 11.0.9 and ws to 8.23.0. + ## [0.4.1] - 2026-11-20 ### Changed diff --git a/Gemfile.lock b/Gemfile.lock index c229b922..7f4b9082 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -92,7 +92,7 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - addressable (2.9.2) + addressable (2.10.0) public_suffix (>= 2.0.2, < 8.0) ahoy_matey (5.5.0) activesupport (>= 7.2) @@ -126,7 +126,7 @@ GEM commander (5.0.0) highline (~> 3.0.0) concurrent-ruby (1.3.8) - connection_pool (3.0.2) + connection_pool (3.0.3) content_disposition (1.0.0) crass (1.0.8) date (3.6.0) @@ -139,7 +139,7 @@ GEM dotenv-rails (3.2.0) dotenv (= 3.2.0) railties (>= 6.1) - down (5.6.2) + down (5.6.3) addressable (~> 2.8) base64 (~> 0.3) drb (2.2.3) @@ -155,20 +155,20 @@ GEM activesupport (>= 6.1) hana (1.3.7) highline (3.0.1) - honeybadger (6.10.1) + honeybadger (6.10.2) logger ostruct i18n (1.15.2) concurrent-ruby (~> 1.0) image_processing (2.2.0) io-console (0.9.5) - irb (1.18.0) + irb (1.19.0) pp (>= 0.6.0) prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) jaro_winkler (1.7.0) - json (3.1.0) + json (3.2.0) json_schemer (2.5.0) bigdecimal hana (~> 1.3) @@ -186,7 +186,7 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logger (1.7.0) - lograge (0.15.1) + lograge (0.16.0) actionpack (>= 4) activesupport (>= 4) logger @@ -258,7 +258,7 @@ GEM stringio public_suffix (7.0.5) racc (1.8.1) - rack (3.2.8) + rack (3.2.9) rack-session (2.1.2) base64 (>= 0.1.0) rack (>= 3.0.0) @@ -366,14 +366,14 @@ GEM rubydex (0.4.4-x86_64-linux) safely_block (1.0.0) securerandom (0.4.1) - semantic_logger (5.2.0) + semantic_logger (5.3.0) concurrent-ruby (~> 1.0) logger (~> 1.5) - sentry-ruby (7.2.0) + sentry-ruby (7.3.0) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) logger - shrine (3.10.2) + shrine (3.11.0) content_disposition (~> 1.0) down (~> 5.1) sidekiq (8.1.7) @@ -412,15 +412,15 @@ GEM yard (~> 0.9, >= 0.9.24) yard-activesupport-concern (~> 0.0) yard-solargraph (~> 0.1) - sorbet (0.6.13672) - sorbet-static (= 0.6.13672) - sorbet-runtime (0.6.13672) - sorbet-static (0.6.13672-aarch64-linux) - sorbet-static (0.6.13672-universal-darwin) - sorbet-static (0.6.13672-x86_64-linux) - sorbet-static-and-runtime (0.6.13672) - sorbet (= 0.6.13672) - sorbet-runtime (= 0.6.13672) + sorbet (0.6.13715) + sorbet-static (= 0.6.13715) + sorbet-runtime (0.6.13715) + sorbet-static (0.6.13715-aarch64-linux) + sorbet-static (0.6.13715-universal-darwin) + sorbet-static (0.6.13715-x86_64-linux) + sorbet-static-and-runtime (0.6.13715) + sorbet (= 0.6.13715) + sorbet-runtime (= 0.6.13715) sorbet-typescript (0.1.1) sorbet-runtime (>= 0.5) thor (>= 1.3) @@ -476,10 +476,10 @@ GEM unicode-emoji (4.3.0) uri (1.1.2) useragent (0.16.11) - websocket-driver (0.8.2) + websocket-driver (0.9.0) base64 - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) + websocket-extensions (>= 0.2.0) + websocket-extensions (0.2.0) yard (0.9.45) yard-activesupport-concern (0.0.1) yard (>= 0.8) diff --git a/sorbet/rbi/gems/addressable@2.10.0.rbi b/sorbet/rbi/gems/addressable@2.10.0.rbi new file mode 100644 index 00000000..b82b700d --- /dev/null +++ b/sorbet/rbi/gems/addressable@2.10.0.rbi @@ -0,0 +1,3518 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `addressable` gem. +# Please instead update this file by running `bin/tapioca gem addressable`. + + +# Addressable is a library for processing links and URIs. +# +# pkg:gem/addressable#lib/addressable/version.rb:22 +module Addressable + class << self + # Warns that Ruby 3.2 and earlier are no longer supported. Addressable + # still loads on them, but a future version of Addressable will require + # Ruby 3.3 or later. Like Ruby's own deprecation warnings, it's only + # shown when deprecation warnings are turned on: with -w, + # -W:deprecated or Warning[:deprecated] = true + # (only -w on Ruby 2.6 and earlier). + # + # @param [String] ruby_version + # The Ruby version to check, as the runtime reports it. + # @param [String] engine The runtime, such as "jruby". + # @param [String] engine_version The runtime's own version. + # + # @api private + # + # pkg:gem/addressable#lib/addressable/version.rb:45 + def warn_if_unsupported_ruby(ruby_version = T.unsafe(nil), engine = T.unsafe(nil), engine_version = T.unsafe(nil)); end + end +end + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:23 +module Addressable::IDNA + class << self + # pkg:gem/addressable#lib/addressable/idna/pure.rb:307 + def _deprecated_unicode_normalize_kc(value); end + + # Converts from a Unicode internationalized domain name to an ASCII + # domain name as described in IDNA2003 (RFC 3490, since obsoleted by + # RFC 5890 and RFC 5891). + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:210 + def to_ascii(input); end + + # Converts from an ASCII domain name to a Unicode internationalized + # domain name as described in IDNA2003 (RFC 3490, since obsoleted by + # RFC 5890 and RFC 5891). + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:260 + def to_unicode(input); end + + # @deprecated Use {String#unicode_normalize(:nfkc)} instead + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:302 + def unicode_normalize_kc(*args, **, &block); end + + private + + # A label with a right-to-left character must not have a left-to-right + # one, and must start and end with a right-to-left one (Section 6 of + # RFC 3454). Otherwise it can display in a different order than it's + # written. + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:314 + def bidi_rule_broken?(label); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:335 + def lookup_unicode_lowercase(codepoint); end + + # Bias adaptation method + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4894 + def punycode_adapt(delta, numpoints, firsttime); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4862 + def punycode_basic?(codepoint); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4740 + def punycode_decode(punycode); end + + # Returns the numeric value of a basic codepoint + # (for use in representing integers) in the range 0 to + # base - 1, or PUNYCODE_BASE if codepoint does not represent a value. + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4880 + def punycode_decode_digit(codepoint); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4867 + def punycode_delimiter?(codepoint); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4623 + def punycode_encode(unicode); end + + # pkg:gem/addressable#lib/addressable/idna/pure.rb:4872 + def punycode_encode_digit(d); end + + # Unicode aware downcase method. + # + # @api private + # @param [String] input + # The input string. + # @return [String] The downcased result. + # + # pkg:gem/addressable#lib/addressable/idna/pure.rb:327 + def unicode_downcase(input); end + end +end + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4588 +Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) + +# This module is loosely based on idn_actionmailer by Mick Staugaard, +# the unicode library by Yoshida Masato, and the punycode implementation +# by Kazuhiro Nishiyama. Most of the code was copied verbatim, but +# some reformatting was done, and some translation from C was done. +# +# Without their code to work from as a base, we'd all still be relying +# on the presence of libidn. Which nobody ever seems to have installed. +# +# Original sources: +# http://github.com/staugaard/idn_actionmailer +# http://www.yoshidam.net/Ruby.html#unicode +# http://rubyforge.org/frs/?group_id=2550 +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:37 +Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String) + +# The errors .to_ascii raises for a domain name it can't convert. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4619 +Addressable::IDNA::CONVERSION_ERRORS = T.let(T.unsafe(nil), Array) + +# Characters that change how a label displays without being visible +# themselves: controls, format characters such as bidi overrides and +# isolates, and default ignorable code points. libidn rejects most of +# them, but not those added to Unicode after the version it checks +# against, such as U+2066 to U+2069. Format characters that are also +# default ignorable are left out of the second set, since Ruby warns about +# a duplicated range in a character class. +# Characters that change how a label displays without being visible +# themselves: controls, format characters such as bidi overrides and +# isolates, and default ignorable code points, including those added to +# Unicode after the version nameprep is based on. Format characters that +# are also default ignorable are left out of the second set, since Ruby +# warns about a duplicated range in a character class. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:98 +Addressable::IDNA::DISPLAY_CHANGING = T.let(T.unsafe(nil), Regexp) + +# A label is empty after nameprep or breaks the bidi rule, as libidn +# reports with IDN::Idna::IdnaError. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:203 +class Addressable::IDNA::InvalidLabel < ::StandardError; end + +# The label separators of IDNA2003 (Section 3.1 of RFC 3490, since +# obsoleted by RFC 5890 and RFC 5891). A label that decodes to one of +# them would display as two labels. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:103 +Addressable::IDNA::LABEL_SEPARATORS = T.let(T.unsafe(nil), Regexp) + +# Characters with the bidirectional category L (Table D.2 of RFC 3454, +# leaving out the surrogates, which can't be in a UTF-8 string). +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:118 +Addressable::IDNA::L_CAT = T.let(T.unsafe(nil), Regexp) + +# Characters that nameprep maps to nothing (table B.1 of RFC 3454), such +# as SOFT HYPHEN and ZERO WIDTH JOINER. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:198 +Addressable::IDNA::MAPPED_TO_NOTHING = T.let(T.unsafe(nil), Regexp) + +# Characters that nameprep, the IDNA2003 profile of stringprep, doesn't +# allow in a label (Section 5 of RFC 3491, since obsoleted by RFC 5891), +# or that it maps to nothing, so they can't be in a label that toASCII +# produces. Some code points are in more than one table; they're +# listed only under the first, since Ruby warns about a duplicated range +# in a character class. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:66 +Addressable::IDNA::NAMEPREP_PROHIBITED = T.let(T.unsafe(nil), Regexp) + +# A host name has only ASCII letters, digits and hyphens, and doesn't +# start or end with a hyphen. RFC 3987 says to check an IRI's host names +# with these rules (STD3, section 4.1 of RFC 3490), so a label that +# decodes to anything else isn't displayed. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:194 +Addressable::IDNA::NOT_STD3 = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4590 +Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4594 +Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4597 +Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4595 +Addressable::IDNA::PUNYCODE_INITIAL_BIAS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4596 +Addressable::IDNA::PUNYCODE_INITIAL_N = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4599 +Addressable::IDNA::PUNYCODE_MAXINT = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4601 +Addressable::IDNA::PUNYCODE_PRINT_ASCII = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4593 +Addressable::IDNA::PUNYCODE_SKEW = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4592 +Addressable::IDNA::PUNYCODE_TMAX = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4591 +Addressable::IDNA::PUNYCODE_TMIN = T.let(T.unsafe(nil), Integer) + +# Input is invalid. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4612 +class Addressable::IDNA::PunycodeBadInput < ::StandardError; end + +# Output would exceed the space provided. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4614 +class Addressable::IDNA::PunycodeBigOutput < ::StandardError; end + +# Input needs wider integers to process. +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4616 +class Addressable::IDNA::PunycodeOverflow < ::StandardError; end + +# Characters with the bidirectional category R or AL (Table D.1 of +# RFC 3454, since obsoleted by PRECIS, RFC 8264). +# +# pkg:gem/addressable#lib/addressable/idna/pure.rb:107 +Addressable::IDNA::RAND_AL_CAT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:351 +Addressable::IDNA::UNICODE_DATA = T.let(T.unsafe(nil), Hash) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:345 +Addressable::IDNA::UNICODE_DATA_CANONICAL = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:343 +Addressable::IDNA::UNICODE_DATA_COMBINING_CLASS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:346 +Addressable::IDNA::UNICODE_DATA_COMPATIBILITY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:344 +Addressable::IDNA::UNICODE_DATA_EXCLUSION = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:348 +Addressable::IDNA::UNICODE_DATA_LOWERCASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:349 +Addressable::IDNA::UNICODE_DATA_TITLECASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:347 +Addressable::IDNA::UNICODE_DATA_UPPERCASE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:4587 +Addressable::IDNA::UNICODE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:39 +Addressable::IDNA::UTF8_REGEX = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/idna/pure.rb:50 +Addressable::IDNA::UTF8_REGEX_MULTIBYTE = T.let(T.unsafe(nil), Regexp) + +# This is an implementation of a URI template based on +# RFC 6570 (http://tools.ietf.org/html/rfc6570). +# +# pkg:gem/addressable#lib/addressable/template.rb:29 +class Addressable::Template + # Creates a new Addressable::Template object. + # + # @param [#to_str] pattern The URI Template pattern. + # + # @return [Addressable::Template] The initialized Template object. + # + # pkg:gem/addressable#lib/addressable/template.rb:343 + def initialize(pattern); end + + # Returns true if the Template objects are equal. This method + # does NOT normalize either Template before doing the comparison. + # + # @param [Object] template The Template to compare. + # + # @return [TrueClass, FalseClass] + # true if the Templates are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/template.rb:383 + def ==(template); end + + # Addressable::Template makes no distinction between `==` and `eql?`. + # + # @see #== + # + # pkg:gem/addressable#lib/addressable/template.rb:392 + def eql?(template); end + + # Expands a URI template into a full URI. + # + # @param [Hash, #each_pair, #[]] mapping + # The values for the template's variables. This can be a Hash, an + # array of name and value pairs, an object with each_pair + # such as a Struct, or any object that responds to [], such as + # a lambda. A lambda or other [] object is called with each + # variable's name as a String, at most once per name. Leave the mapping + # out to look up variables with a block instead. + # + # Lookups follow the Hash#fetch convention: raise + # KeyError for a variable that's missing, and return nil + # for a variable that's undefined. Both expand to nothing. An object that + # responds to key? reports missing variables with key? + # instead. + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError + # exception will be raised if the value is invalid. The transform + # method should return the transformed variable value as a String. + # If a transform method is used, the value will not be percent + # encoded automatically. Unicode normalization will be performed both + # before and after sending the value to the transform method. + # + # @yield [name] Looks up a variable, when no mapping is given. + # @yieldparam [String] name The variable's name. + # @yieldreturn [Object] The variable's value, or nil if it's + # undefined. Raise KeyError if the variable is missing. + # + # @raise [TypeError] If the mapping isn't one of the types above. + # @raise [ArgumentError] If both a mapping and a block are given, or + # neither. + # @raise [Addressable::Template::InvalidTemplateError] + # If the template doesn't match the RFC 6570 grammar, e.g. an unclosed + # expression or a stray }. + # + # @return [Addressable::URI] The expanded URI template. + # + # @example + # class ExampleProcessor + # def self.validate(name, value) + # return !!(value =~ /^[\w ]+$/) if name == "query" + # return true + # end + # + # def self.transform(name, value) + # return value.gsub(/ /, "+") if name == "query" + # return value + # end + # end + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "an example search query"}, + # ExampleProcessor + # ).to_str + # #=> "http://example.com/search/an+example+search+query/" + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "an example search query"} + # ).to_str + # #=> "http://example.com/search/an%20example%20search%20query/" + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "bogus!"}, + # ExampleProcessor + # ).to_str + # #=> Addressable::Template::InvalidTemplateValueError + # + # repository = {"owner" => "sporkmonger", "repo" => "addressable"} + # Addressable::Template.new( + # "https://github.com/{owner}/{repo}" + # ).expand { |name| repository.fetch(name) }.to_str + # #=> "https://github.com/sporkmonger/addressable" + # + # pkg:gem/addressable#lib/addressable/template.rb:976 + def expand(mapping = T.unsafe(nil), processor = T.unsafe(nil), normalize_values = T.unsafe(nil), &block); end + + # The members of each exploded value of a default, +, #, / or . + # expression in a match. A member can be empty, so a joiner at the end of + # a value can be an empty member or the one before a later variable, and + # an empty value can be one empty member or none. Joined with the + # expression's joiner, the values must give the text the expression + # matched, so where the first choice doesn't, the others are tried. + # + # @param [String, nil] operator The expression's operator. + # @param [Array] varspecs The expression's variables. + # @param [Array] values The variables' captures. + # @param [Integer] index The index of its first capture. + # @param [MatchData] matched The match. + # @param [String] text The URI. + # + # @return [Hash] The members, for each exploded variable's position. + # + # pkg:gem/addressable#lib/addressable/template.rb:718 + def exploded_members(operator, varspecs, values, index, matched, text); end + + # Extracts a mapping from the URI using a URI Template pattern. + # + # @param [Addressable::URI, #to_str] uri + # The URI to extract from. + # + # @param [#restore, #match] processor + # A template processor object may optionally be supplied. + # + # The object should respond to either the restore or + # match messages or both. The restore method should + # take two parameters: `[String] name` and `[String] value`. + # The restore method should reverse any transformations that + # have been performed on the value to ensure a valid URI. + # The match method should take a single + # parameter: `[String] name`. The match method should return + # a String containing a regular expression capture group for + # matching on that particular variable. The default value is `".*?"`. + # In a ;, ? or & expression, the pattern + # matches the value after the variable's name and =, and + # restore is called with the template's variable names. + # + # Without a processor, each value is pct-decoded once. Reserved + # ({+var}) and fragment ({#var}) expansion keep a + # value's pct-encoded triplets (RFC 6570 section 3.2.3), so for those + # operators, expanding an extracted value can give a different URI: + # {+path} extracts a/b from a%2Fb, which + # expands to a/b, and a value pct-encoded twice comes back + # encoded once. With any processor, even one that only responds to + # match, values aren't decoded: each is given as it appears in + # the URI, after restore if the processor has it. + # + # An exploded ;, ? or & value whose pairs all + # have the variable's name as their key is a list; other pairs are an + # associative array. The key is compared with the name as written, so + # {?a*} reads ?%61=x as the pair %61, decoded + # to a, not as a list. + # + # Label expansion ({.var}) leaves a . in a value as it + # is, so a value can only contain . where it's clear where it + # ends: a label expression with one variable that isn't exploded, set off + # on both sides by the start or end of the URI or by characters that + # label expansion encodes, such as /, ? or ;. + # /f{.ext} extracts tar.gz from /f.tar.gz. + # Elsewhere, each . starts a label: /{name}{.ext} reads + # /archive.tar.gz as archive.tar and gz. + # + # Matching takes time linear in the URI's length, with two exceptions on + # MRI before 3.3, JRuby and TruffleRuby, where it can take time + # polynomial in the URI's length: matching with a processor that gives a + # variable its own pattern, which keeps every choice open so that the + # pattern decides the values, and matching some templates that combine an + # exploded variable, or several variables in one expression, with other + # expressions, such as {+c*,d}{&b}.{b}. + # + # @raise [Addressable::Template::InvalidTemplateError] + # If the template doesn't match the RFC 6570 grammar, e.g. an unclosed + # expression or a stray }. + # + # @return [Hash, NilClass] + # The Hash mapping that was extracted from the URI, or + # nil if the URI didn't match the template. + # + # @example + # class ExampleProcessor + # def self.restore(name, value) + # return value.gsub(/\+/, " ") if name == "query" + # return value + # end + # + # def self.match(name) + # return ".*?" if name == "first" + # return ".*" + # end + # end + # + # uri = Addressable::URI.parse( + # "http://example.com/search/an+example+search+query/" + # ) + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).extract(uri, ExampleProcessor) + # #=> {"query" => "an example search query"} + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # Addressable::Template.new( + # "http://example.com/{first}/{second}/" + # ).extract(uri, ExampleProcessor) + # #=> {"first" => "a", "second" => "b/c"} + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # Addressable::Template.new( + # "http://example.com/{first}/{-list|/|second}/" + # ).extract(uri) + # #=> {"first" => "a", "second" => ["b", "c"]} + # + # pkg:gem/addressable#lib/addressable/template.rb:495 + def extract(uri, processor = T.unsafe(nil)); end + + # Freeze URI, initializing instance variables. + # + # @return [Addressable::URI] The frozen URI object. + # + # pkg:gem/addressable#lib/addressable/template.rb:354 + def freeze; end + + # @return [Integer] A hash consistent with template equality. + # + # pkg:gem/addressable#lib/addressable/template.rb:396 + def hash; end + + # Returns a String representation of the Template object's state. + # + # @return [String] The Template object's state, as a String. + # + # pkg:gem/addressable#lib/addressable/template.rb:369 + def inspect; end + + # pkg:gem/addressable#lib/addressable/template.rb:1001 + def keys; end + + # Extracts match data from the URI using a URI Template pattern. + # + # @param [Addressable::URI, #to_str] uri + # The URI to extract from. + # + # @param [#restore, #match] processor + # A template processor object may optionally be supplied. + # + # The object should respond to either the restore or + # match messages or both. The restore method should + # take two parameters: `[String] name` and `[String] value`. + # The restore method should reverse any transformations that + # have been performed on the value to ensure a valid URI. + # The match method should take a single + # parameter: `[String] name`. The match method should return + # a String containing a regular expression capture group for + # matching on that particular variable. The default value is `".*?"`. + # In a ;, ? or & expression, the pattern + # matches the value after the variable's name and =, and + # restore is called with the template's variable names. + # + # Without a processor, each value is pct-decoded once. Reserved + # ({+var}) and fragment ({#var}) expansion keep a + # value's pct-encoded triplets (RFC 6570 section 3.2.3), so for those + # operators, expanding an extracted value can give a different URI: + # {+path} extracts a/b from a%2Fb, which + # expands to a/b, and a value pct-encoded twice comes back + # encoded once. With any processor, even one that only responds to + # match, values aren't decoded: each is given as it appears in + # the URI, after restore if the processor has it. + # + # An exploded ;, ? or & value whose pairs all + # have the variable's name as their key is a list; other pairs are an + # associative array. The key is compared with the name as written, so + # {?a*} reads ?%61=x as the pair %61, decoded + # to a, not as a list. + # + # Label expansion ({.var}) leaves a . in a value as it + # is, so a value can only contain . where it's clear where it + # ends: a label expression with one variable that isn't exploded, set off + # on both sides by the start or end of the URI or by characters that + # label expansion encodes, such as /, ? or ;. + # /f{.ext} extracts tar.gz from /f.tar.gz. + # Elsewhere, each . starts a label: /{name}{.ext} reads + # /archive.tar.gz as archive.tar and gz. + # + # Matching takes time linear in the URI's length, with two exceptions on + # MRI before 3.3, JRuby and TruffleRuby, where it can take time + # polynomial in the URI's length: matching with a processor that gives a + # variable its own pattern, which keeps every choice open so that the + # pattern decides the values, and matching some templates that combine an + # exploded variable, or several variables in one expression, with other + # expressions, such as {+c*,d}{&b}.{b}. + # + # @raise [Addressable::Template::InvalidTemplateError] + # If the template doesn't match the RFC 6570 grammar, e.g. an unclosed + # expression or a stray }. + # + # @return [Hash, NilClass] + # The Hash mapping that was extracted from the URI, or + # nil if the URI didn't match the template. + # + # @example + # class ExampleProcessor + # def self.restore(name, value) + # return value.gsub(/\+/, " ") if name == "query" + # return value + # end + # + # def self.match(name) + # return ".*?" if name == "first" + # return ".*" + # end + # end + # + # uri = Addressable::URI.parse( + # "http://example.com/search/an+example+search+query/" + # ) + # match = Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).match(uri, ExampleProcessor) + # match.variables + # #=> ["query"] + # match.captures + # #=> ["an example search query"] + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # match = Addressable::Template.new( + # "http://example.com/{first}/{+second}/" + # ).match(uri, ExampleProcessor) + # match.variables + # #=> ["first", "second"] + # match.captures + # #=> ["a", "b/c"] + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # match = Addressable::Template.new( + # "http://example.com/{first}{/second*}/" + # ).match(uri) + # match.variables + # #=> ["first", "second"] + # match.captures + # #=> ["a", ["b", "c"]] + # + # pkg:gem/addressable#lib/addressable/template.rb:604 + def match(uri, processor = T.unsafe(nil)); end + + # Returns the named captures of the coerced `Regexp`. + # + # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}. + # + # @raise [Addressable::Template::InvalidTemplateError] + # If the template doesn't match the RFC 6570 grammar, e.g. an unclosed + # expression or a stray }. + # + # @api private + # + # pkg:gem/addressable#lib/addressable/template.rb:1062 + def named_captures; end + + # pkg:gem/addressable#lib/addressable/template.rb:1002 + def names; end + + # Expands a URI template into another URI template. + # + # @param [Hash, #each_pair, #[]] mapping + # The values for the template's variables. This can be a Hash, an + # array of name and value pairs, an object with each_pair + # such as a Struct, or any object that responds to [], such as + # a lambda. A lambda or other [] object is called with each + # variable's name as a String, at most once per name. Leave the mapping + # out to look up variables with a block instead. + # + # Lookups follow the Hash#fetch convention: raise + # KeyError for a variable that's missing, and return nil + # for a variable that's undefined. A missing variable's expression stays + # in the returned template, and an undefined variable is expanded to + # nothing, as with a Hash that lacks the key or maps it to nil. + # An object that responds to key? reports missing variables with + # key? instead. + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError + # exception will be raised if the value is invalid. The transform + # method should return the transformed variable value as a String. + # If a transform method is used, the value will not be percent + # encoded automatically. Unicode normalization will be performed both + # before and after sending the value to the transform method. + # + # RFC 6570 doesn't define partial expansion, and it can't always give + # the same result as expanding every variable at once: + # + # * In an expression with several variables whose values are joined + # with "," ({x,y}, {+x,y} and {#x,y}), there's + # no way to write a "," that appears only if a missing variable is + # later defined. The partial result assumes that missing variables + # stay undefined: {x,y} with only x gives + # 1{y}, so expanding y later gives 12, not + # 1,2. + # * In a form-style query ({?x,y}), the given variables come + # first, so that the query still starts with "?" if a missing variable + # is never given: {?x,y} with only y gives + # ?y=2{&x}. The query has the same pairs, in another order. + # + # The result is a template, not a URI, so #pattern can differ + # from #expand even when every variable is given: literals stay + # as written, rather than pct-encoded, and a "#" after the one that + # starts the fragment isn't encoded until the template is expanded. A + # missing variable's expression stays in the template, where + # #expand leaves it out. + # + # @yield [name] Looks up a variable, when no mapping is given. + # @yieldparam [String] name The variable's name. + # @yieldreturn [Object] The variable's value, or nil if it's + # undefined. Raise KeyError if the variable is missing. + # + # @raise [TypeError] If the mapping isn't one of the types above. + # @raise [ArgumentError] If both a mapping and a block are given, or + # neither. + # @raise [Addressable::Template::InvalidTemplateError] + # If the template doesn't match the RFC 6570 grammar, e.g. an unclosed + # expression or a stray }. + # + # @return [Addressable::Template] The partially expanded URI template. + # + # @example + # Addressable::Template.new( + # "http://example.com/{one}/{two}/" + # ).partial_expand({"one" => "1"}).pattern + # #=> "http://example.com/1/{two}/" + # + # Addressable::Template.new( + # "http://example.com/{?one,two}" + # ).partial_expand({"one" => "1"}).pattern + # #=> "http://example.com/?one=1{&two}" + # + # Addressable::Template.new( + # "http://example.com/{?one,two,three}" + # ).partial_expand({"one" => "1", "three" => 3}).pattern + # #=> "http://example.com/?one=1{&two}&three=3" + # + # values = {"one" => "1"} + # Addressable::Template.new( + # "http://example.com/{one}/{two}/" + # ).partial_expand { |name| values.fetch(name) }.pattern + # #=> "http://example.com/1/{two}/" + # + # pkg:gem/addressable#lib/addressable/template.rb:877 + def partial_expand(mapping = T.unsafe(nil), processor = T.unsafe(nil), normalize_values = T.unsafe(nil), &block); end + + # @return [String] The Template object's pattern. + # + # pkg:gem/addressable#lib/addressable/template.rb:363 + def pattern; end + + # Returns the source of the coerced `Regexp`. + # + # @return [String] The source of the `Regexp` given by {#to_regexp}. + # + # @raise [Addressable::Template::InvalidTemplateError] + # If the template doesn't match the RFC 6570 grammar, e.g. an unclosed + # expression or a stray }. + # + # @api private + # + # pkg:gem/addressable#lib/addressable/template.rb:1048 + def source; end + + # Coerces a template into a `Regexp` object. This regular expression will + # behave very similarly to the actual template, and should match the same + # URI values, but it cannot fully handle, for example, values that would + # extract to an `Array`. + # + # Each variable has a named group. A group name can't start with a digit, + # so a variable whose name does has its group named with a leading ".": + # `{42}` has the group `.42`. Ruby 2.3 and earlier only allow a letter or + # "_" as the first character of a group name, so there a variable whose + # name starts with anything else has its group named with "__" before + # and after it: `{42}` has `__42__`, and `{%41}` has `__%41__`. + # + # @return [Regexp] A regular expression which should match the template. + # + # @raise [Addressable::Template::InvalidTemplateError] + # If the template doesn't match the RFC 6570 grammar, e.g. an unclosed + # expression or a stray }. + # + # pkg:gem/addressable#lib/addressable/template.rb:1032 + def to_regexp; end + + # Returns a mapping of variables to their default values specified + # in the template. Variables without defaults are not returned. + # + # @return [Hash] Mapping of template variables to their defaults + # + # pkg:gem/addressable#lib/addressable/template.rb:1009 + def variable_defaults; end + + # Returns an Array of variables used within the template pattern. + # The variables are listed in the Array in the order they appear within + # the pattern. Multiple occurrences of a variable within a pattern are + # not represented in this Array. An expression that doesn't match the + # RFC 6570 grammar, such as {!var} or {var:0}, has no + # variables to list. + # + # @return [Array] The variables present in the template's pattern. + # + # pkg:gem/addressable#lib/addressable/template.rb:998 + def variables; end + + private + + # The characters such that text made of one can be put in front of an + # expression's value, so that the expression matches it and everything + # after it the same way. + # + # @param [String] expression The expression. + # @param [Array] characters The characters to check. + # + # @return [Array] Those of the characters that can. + # + # pkg:gem/addressable#lib/addressable/template.rb:2187 + def absorbed(expression, characters); end + + # Whether an expression, followed directly by another one, could only + # match characters that the other one could also match, in any amount. + # + # @param [Array] following + # The expression that follows, its operator and its variable list. + # @param [String, nil] operator The operator of the first expression. + # @param [Array] varspecs The varspecs of the first expression. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:2064 + def absorbed_by?(following, operator, varspecs); end + + # The characters that the template's literal text or any of its + # expressions can contain, worked out once while it's built. + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # + # @return [Array] + # + # pkg:gem/addressable#lib/addressable/template.rb:2708 + def allowed_characters(expressions, literals); end + + # Puts together the regular expression for a template from the sources + # for its literal text and its expressions. + # + # Matching goes left to right in blocks. A block ends after literal text + # where whatever the block could match, and that text, could also be put + # in front of the next value: the first choice that lets that text match + # is then the one that 2.9.x would end up with, since any later choice + # only moves text from the block to the next value. Matching commits to + # it, so that a URI that doesn't match isn't tried with every way of + # dividing it among the variables, which takes polynomial time on + # engines that don't memoize (MRI < 3.3, JRuby and TruffleRuby). + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] literal_sources The regexp source of each literal. + # @param [Array] expression_sources The regexp source of each + # expression. + # @param [Array] empties + # Whether each expression only matches nothing, because the one after + # it takes whatever it could. + # @param [TrueClass, FalseClass] commit + # Whether to commit to choices. With processor patterns, which can + # match anything, every choice is kept open. + # @param [Array] ends + # The indexes of the expressions that end blocks, if already found. + # + # @return [String] The regular expression's source. + # + # pkg:gem/addressable#lib/addressable/template.rb:2510 + def assemble_regexp(expressions, literals, literal_sources, expression_sources, empties = T.unsafe(nil), commit = T.unsafe(nil), ends = T.unsafe(nil)); end + + # The expressions after whose literal text a block ends, so that + # matching commits to the block's choices. A block ends after literal + # text where every expression in it tries its ends in order and the next + # value can take anything the block could, so the first choice that lets + # the literal text match is the one every later choice would also lead + # to. + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] empties + # Whether each expression only matches nothing. + # + # @return [Array] The expressions' indexes. + # + # pkg:gem/addressable#lib/addressable/template.rb:2455 + def block_ends(expressions, literals, empties); end + + # Works out #bounded_value from the expression's value sets. + # + # @param [Hash] sets What #value_sets gives for the expression. + # @param [TrueClass, FalseClass] scan See #bounded_value. + # @param [String, nil] next_expression + # The expression that follows directly, or nil if none does. + # @param [String] literal_source The regexp source of the literal text. + # + # @return [String] The source. + # + # pkg:gem/addressable#lib/addressable/template.rb:2938 + def bounded_source(sets, scan, next_expression, literal_source); end + + # The regexp source for the last value of an expression that literal + # text follows, which tries the same values, in the same order, as the + # plain one, but skips those that can't let the rest of the URI match: + # + # * Nothing after the literal text can contain some characters, so the + # value takes each of them that it can, up to the last one, and the + # URI is rejected if it has one that the value can't take. When the + # literal text is one such character, the value takes everything up to + # the last place where it's written as it is. + # * After those, the next expression can take any characters that the + # value could, and the literal text, up to a character that it can't. + # Until then, the literal text's first place is the only one tried, + # since if the rest doesn't match from there, it doesn't from a later + # place either. + # + # Without this, a URI that doesn't match would be tried with the value + # ending at every place where the literal text is, matching the rest + # again each time, which takes polynomial time on engines that don't + # memoize (MRI < 3.3, JRuby and TruffleRuby). + # + # @param [Integer] index The expression's index. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] literal_sources The regexp source of each literal. + # @param [Array] empties + # Whether each expression only matches nothing. + # @param [String] group + # The regexp source for a character of the value, if not the + # operator's. + # @param [TrueClass, FalseClass] scan + # Whether the value can start in only a few places, so that looking + # ahead to the end of the URI from there costs linear time in all. + # + # @return [String, nil] The source, or nil if the plain one is used. + # + # pkg:gem/addressable#lib/addressable/template.rb:2911 + def bounded_value(index, expressions, literals, literal_sources, empties, group = T.unsafe(nil), scan = T.unsafe(nil)); end + + # A value worked out once while a template is built, for the build's + # own expressions and literals; outside a build, it's worked out each + # time. + # + # @param [Symbol] kind What the value is. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals The pattern's literal text. + # + # @return [Object] The value. + # + # pkg:gem/addressable#lib/addressable/template.rb:2724 + def build_cached(kind, expressions, literals); end + + # A value worked out once per key while a template is built; outside a + # build, it's worked out each time. Long templates repeat the same + # expression in the same surroundings, so the key is what the value + # depends on, not the expression's index. + # + # @param [Array] key What the value depends on. + # + # @return [Object] The value. + # + # pkg:gem/addressable#lib/addressable/template.rb:2737 + def build_memo(key); end + + # A variable's name with its pct-encoded triplets in upper case, so that + # names written with either case compare equal. + # + # @param [String] name The variable name. + # + # @return [String] The name. + # + # pkg:gem/addressable#lib/addressable/template.rb:1773 + def canonical_name(name); end + + # The name of the regular expression group for a variable. A group name + # can't start with a digit, which a variable name can (RFC 6570 section + # 2.3), so such a name gets a leading ".". No variable name starts with + # ".", so this can't collide with another variable's group. Ruby 2.3 and + # earlier only allow a letter or "_" as the first character, so there a + # name that starts with a digit or a pct-encoded triplet is wrapped in + # "__" instead. + # + # @param [String] name The variable name. + # + # @return [String] The group name. + # + # pkg:gem/addressable#lib/addressable/template.rb:1860 + def capture_name(name); end + + # The regexp source for a set of ASCII characters. + # + # @param [Array] characters The characters. + # @param [TrueClass, FalseClass] negated Whether to match any other one. + # + # @return [String] + # + # pkg:gem/addressable#lib/addressable/template.rb:2573 + def character_set(characters, negated = T.unsafe(nil)); end + + # For each index, the characters that the expressions from there to the + # end can contain, and those of the literal text from there up to the + # last one. They're worked out once while a template is built, since + # each expression needs them. + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # + # @return [Hash] The suffixes, as :expressions and :literals. + # + # pkg:gem/addressable#lib/addressable/template.rb:2679 + def character_suffixes(expressions, literals); end + + # The characters that nothing after an expression can contain, and the + # final literal text, if it's written only one way, which the URI ends + # with. Its characters are counted only where something else after the + # expression can contain them, since the URI's last characters are left + # for it. + # + # @param [Integer] index The expression's index. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Integer] first The index of the first literal text to count. + # + # @return [Array] The characters, and the final literal text or nil. + # + # pkg:gem/addressable#lib/addressable/template.rb:2620 + def characters_after(index, expressions, literals, first = T.unsafe(nil)); end + + # The characters of TEXT_CHARACTERS that any of some expressions' + # expansions can contain. + # + # @param [Array] expressions The expressions. + # + # @return [Array] + # + # pkg:gem/addressable#lib/addressable/template.rb:2121 + def characters_in(expressions); end + + # Raises InvalidTemplateError for the first part of the pattern that + # isn't a literal or an expression (RFC 6570 section 3). + # + # pkg:gem/addressable#lib/addressable/template.rb:1073 + def check_expressions; end + + # The characters of TEXT_CHARACTERS that an expression's expansion can + # contain. + # + # @param [String] expression The expression. + # + # @return [Array] + # + # pkg:gem/addressable#lib/addressable/template.rb:2108 + def contained_characters(expression); end + + # Drops the undefined (nil) members of a list or associative array value. + # RFC 6570 treats a list or associative array with no defined members as + # undefined, as it does nil. + # + # @param [Object] value The mapped value + # + # @return [Object, nil] The value without its undefined members, or nil + # if the value is undefined + # + # pkg:gem/addressable#lib/addressable/template.rb:1357 + def defined_value(value); end + + # Builds a regular expression for a non-ASCII character, as it is or + # pct-encoded in either case. + # + # @param [String] character The character. + # + # @return [String] The regular expression source. + # + # pkg:gem/addressable#lib/addressable/template.rb:1276 + def either_form(character); end + + # A URI fragment can't contain "#" (RFC 3986 section 3.5), so expansion + # encodes every "#" after the first one, which starts the fragment. + # + # @param [String] uri The expanded URI. + # + # @return [String] The URI with any later "#" encoded as "%23". + # + # pkg:gem/addressable#lib/addressable/template.rb:1263 + def encode_later_number_signs(uri); end + + # A lookahead that checks the end of the URI once, where the template + # ends with literal text and then an expression that starts with a + # leader its values can't contain, and that can contain the literal + # text's characters: the literal text must be followed by + # a match of the expression that ends the URI, after the first place + # where the literal text before it is. Otherwise, a URI whose end doesn't + # match would be tried with every choice before it. Since each match of + # the expression ends before the next leader, the check takes linear + # time. + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] literal_sources The regexp source of each literal. + # @param [Array] expression_sources The regexp source of each + # expression. + # + # @return [String, nil] The lookahead's source, or nil if there's none. + # + # pkg:gem/addressable#lib/addressable/template.rb:2330 + def ending_check(expressions, literals, literal_sources, expression_sources); end + + # Whether an expression tries the places where it can end in order, + # nearest first, as a lone variable of the default, +, #, / or . + # operator does. In a block of such expressions, the first choice that + # lets literal text match ends the block as early as any choice can. + # + # @param [String] expression The expression. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:2225 + def ends_in_order?(expression); end + + # Describes what follows each expression in a template pattern. + # + # @param [String] escaped_pattern The escaped URI template pattern. + # + # @return [Array] For each expression, the expression directly + # after it (or nil), as an array of the expression, its + # operator and its variable list, and whether the text after it could + # start with a comma. + # + # pkg:gem/addressable#lib/addressable/template.rb:1910 + def expression_followers(escaped_pattern); end + + # The characters of the final literal text, as #characters_after gives + # it. + # + # @param [String, nil] final The final literal text. + # + # @return [Array] + # + # pkg:gem/addressable#lib/addressable/template.rb:2664 + def final_characters(final); end + + # The characters of TEXT_CHARACTERS that match a regexp source for one + # character. + # + # @param [String] group The source. + # + # @return [Array] + # + # pkg:gem/addressable#lib/addressable/template.rb:2134 + def group_characters(group); end + + # Takes a set of values, and joins them together based on the + # operator. + # + # @param [String, Nil] operator One of the operators from the set + # (?,&,+,#,;,/,.), or nil if there wasn't one. + # @param [Array] return_value + # The set of return values (as [variable_name, value] tuples) that will + # be joined together. + # + # @return [String] The transformed mapped value + # + # pkg:gem/addressable#lib/addressable/template.rb:1510 + def join_values(operator, return_value); end + + # Whether a label expression's value can contain ".". Label expansion + # leaves a "." in a value as it is (RFC 6570 section 3.2.5), so where the + # value ends is only known where the expression is delimited by the start + # or end of the URI or by characters that can't be part of its expansion + # (section 1.4): a lone, unexploded variable, with a reserved character + # in the literal text since the previous expression, and a reserved + # character next, after any expressions that start with one when they + # aren't empty. A "#" counts only if a fragment can't have started + # before it, since expansion encodes a later one as "%23". + # + # @param [Integer] index The expression's index. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] either_leader + # Whether a fragment may have started before each expression. + # @param [Array] either_literal + # Whether a fragment may have started before each literal. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:1965 + def label_takes_dots?(index, expressions, literals, either_leader, either_literal); end + + # Whether the regular expression engine matches a regexp in linear time. + # + # @param [Regexp] regexp The regexp. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:3365 + def linear_time?(regexp); end + + # The characters that literal text can be matched with: its own, and + # those of a non-ASCII character pct-encoded, in either case. (A "#" + # that can be "%23" is handled where its value ends.) + # + # @param [String] literal The literal text. + # + # @return [Array] + # + # pkg:gem/addressable#lib/addressable/template.rb:2585 + def literal_characters(literal); end + + # Builds a regular expression for literal text. A non-ASCII character, + # written as it is or as pct-encoded UTF-8, matches either way, since + # expansion pct-encodes it (RFC 6570 section 3.1). So does a "#" that + # expansion may have encoded because a fragment had already started. + # + # @param [String] literal The literal text. + # @param [TrueClass, FalseClass] fragment + # Whether a fragment may have started before the literal. + # + # @return [String] The regular expression source. + # + # pkg:gem/addressable#lib/addressable/template.rb:1292 + def literal_regexp(literal, fragment = T.unsafe(nil)); end + + # Replaces the literal text between the expressions of a pattern. + # + # @param [String] pattern The URI template pattern. + # + # @yield [literal] Each run of literal text. + # + # @return [String] The pattern with each literal replaced. + # + # pkg:gem/addressable#lib/addressable/template.rb:1243 + def map_literals(pattern); end + + # Whether an expression's expansion can contain a character. + # + # @param [String] expression The expression. + # @param [String] character The character. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:2094 + def may_contain?(expression, character); end + + # Whether the text after an expression could start with a character. + # + # @param [Integer] index The expression's index. + # @param [String] character The character. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:1993 + def may_follow_with?(index, character, expressions, literals); end + + # Whether an expression could match a string that starts with a comma. + # + # @param [String, nil] operator The expression's operator. + # @param [String] varlist The expression's variable list. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:2049 + def may_start_with_comma?(operator, varlist); end + + # Whether what follows an expression always starts with a character that + # a + or # member can contain, other than a comma: literal text that + # does, after expressions that are empty or start with a leader, or with + # characters other than a comma. The URI can't end there. + # + # @param [Integer] index The expression's index. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:2023 + def members_follow?(index, expressions, literals); end + + # The pair that a ;, ? or & variable that isn't exploded can match: one + # of the names of the expression's variables that aren't exploded, then + # "=" and the value. A ; variable's empty value is written as the name + # alone. With processor patterns, each name's value is matched with its + # own variable's pattern. + # + # @param [String] operator The expression's operator. + # @param [Array] varspecs The expression's varspecs. + # @param [Array] results The processor patterns, by varspec. + # + # @return [String, nil] The regular expression source, or nil if every + # variable is exploded. + # + # pkg:gem/addressable#lib/addressable/template.rb:1719 + def named_pair_source(operator, varspecs, results); end + + # The values of a ;, ? or & expression's variables. A pair with the name + # of one of the expression's variables that aren't exploded is that + # variable's, wherever it is, and an exploded variable gets the others. + # Each name is only given as many times as the expression has it. + # + # @param [String] operator The expression's operator. + # @param [Array] varspecs The expression's varspecs. + # @param [Array] captures The text each variable matched. + # @param [Array] results The processor patterns, by varspec. + # + # @return [Array, nil] The value for each varspec, or nil if a name is + # given too many times or a value doesn't match its pattern. + # + # pkg:gem/addressable#lib/addressable/template.rb:1790 + def named_values(operator, varspecs, captures, results); end + + # A variable's name as ;, ? and & expansion writes it, as a regular + # expression source. Its pct-encoded triplets match in either case. + # + # @param [String] name The variable name. + # + # @return [String] The regular expression source. + # + # pkg:gem/addressable#lib/addressable/template.rb:1760 + def named_variable_source(name); end + + # Generates a hash with string keys, or a lookup for a mapping that isn't + # enumerable + # + # @param [Hash, #each_pair, #inject, #[]] mapping A mapping to normalize + # + # @return [Hash, MappingLookup] + # A hash with stringified keys, or a lookup + # + # pkg:gem/addressable#lib/addressable/template.rb:1680 + def normalize_keys(mapping); end + + # Takes a set of values, and joins them together based on the + # operator. + # + # @param [Hash, Array, String] value + # Normalizes unicode keys and values to NFC, leaving a run of more than + # 30 combining marks as it is + # + # @return [Hash, Array, String] The normalized values + # + # pkg:gem/addressable#lib/addressable/template.rb:1553 + def normalize_value(value); end + + # Lookaheads for a template with a block of expressions that doesn't + # commit at the literal text after it. Without them, a URI that doesn't + # match would be tried with every way of dividing the text before that + # literal text among the block's values, each time matching the rest of + # the template again. Both only check what every match has: + # + # * The literal text after the first expression, in order. Each is + # found at its first place after the one before, which is no later + # than where any match has it. + # * After the literal text that follows the first block that doesn't + # commit, the rest of the template, up to the end of the URI, from + # some place where that literal text is. Each place is tried once. + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] literal_sources The regexp source of each literal. + # @param [Array] expression_sources The regexp source of each + # expression. + # @param [Array] ends The indexes of the expressions that end + # blocks. + # + # @return [String] The lookaheads' source, empty if there are none. + # + # pkg:gem/addressable#lib/addressable/template.rb:2382 + def open_block_checks(expressions, literals, literal_sources, expression_sources, ends); end + + # pkg:gem/addressable#lib/addressable/template.rb:1098 + def ordered_variable_defaults; end + + # Generates the Regexp that parses a template pattern. + # + # Where it's known whether the regular expression engine matches a + # regexp in linear time (MRI 3.2 and later, TruffleRuby), the one that keeps + # every choice open is used when it does, since the engine then can't + # backtrack catastrophically, and its rewrites to commit to choices + # could keep the engine from matching in linear time. Both give the same + # values. + # + # @param [String] pattern The URI template pattern. + # @param [#match] processor The template processor to use. + # @param [Array] patterns + # The processor's pattern for each variable, if already known. + # @param [TrueClass, FalseClass] commit + # Whether to commit to choices, if not decided by the patterns. + # + # @return [Array, Regexp] + # An array of expansion variables nad a regular expression which may be + # used to parse a template pattern + # + # pkg:gem/addressable#lib/addressable/template.rb:3002 + def parse_new_template_pattern(pattern, processor = T.unsafe(nil), patterns = T.unsafe(nil), commit = T.unsafe(nil)); end + + # Generates the Regexp that parses a template pattern. Memoizes the + # value if template processor not set (processors may not be deterministic) + # + # @param [String] pattern The URI template pattern. + # @param [#match] processor The template processor to use. + # + # @return [Array, Regexp] + # An array of expansion variables nad a regular expression which may be + # used to parse a template pattern + # + # pkg:gem/addressable#lib/addressable/template.rb:1892 + def parse_template_pattern(pattern, processor = T.unsafe(nil)); end + + # Takes the first characters of a value for a prefix modifier. Reserved + # and fragment expansion count a pct-encoded triplet as one character, + # so that it isn't split (RFC 6570 section 2.4.1). + # + # @param [String] value The value + # @param [Integer] length The maximum number of characters + # @param [Boolean] allow_reserved Whether pct-encoded triplets are kept + # + # @return [String] The prefix + # + # pkg:gem/addressable#lib/addressable/template.rb:1324 + def prefix(value, length, allow_reserved); end + + # Picks the mapping to expand with: the one passed, or the block. + # + # @param [Object] mapping The mapping argument + # @param [Proc, nil] block The block + # + # @return [Hash, MappingLookup] The normalized mapping + # + # pkg:gem/addressable#lib/addressable/template.rb:1659 + def resolve_mapping(mapping, block); end + + # Whether each expression's last value can start in only a few places, + # so that looking ahead to the end of the URI from there costs linear + # time in all. The expression starts a block and no earlier variable in + # it is exploded, or literal text separates it from a lone variable that + # can, and takes up front each character that would make this value + # look ahead or take characters: this value then starts once where that + # one is empty, and otherwise only after the last such character. + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] ends The expressions that end blocks. + # + # @return [Array] + # + # pkg:gem/addressable#lib/addressable/template.rb:2851 + def scanned_values(expressions, literals, ends); end + + # Works out #value_sets once the expression is known to have them. + # + # @param [String] group The regexp source for a character of the value. + # @param [String] literal The literal text after the expression. + # @param [Array] after What #characters_after gives for the expression. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # + # @return [Hash, nil] The sets, or nil if the value doesn't skip any. + # + # pkg:gem/addressable#lib/addressable/template.rb:2811 + def sets_after(group, literal, after, expressions, literals); end + + # Splits the text an expression matched among its variables, when + # more than one split would expand to it. RFC 6570 doesn't say which + # split to choose, so each variable, from the first, takes as much as it + # can: an exploded variable every member left, and any other variable + # one member, except that the last variable of a + or # expression, + # whose values may contain commas, takes the rest. A variable with + # nothing left is undefined. So {/a*,b} reads /x/y as a = ["x", "y"] + # and {/a,b*} reads /x/y/z as a = "x" and b = ["y", "z"]. + # + # @return [Array, nil] Each variable's unparsed value, or nil for an + # operator whose values aren't split by position, an expression that + # repeats a name, or when the variables can't take every member. + # + # pkg:gem/addressable#lib/addressable/template.rb:1609 + def split_from_left(operator, varspecs, matched, index); end + + # A lookahead that checks the end of the URI once: where literal text is + # one character that nothing after it can contain, it's the last one in + # the URI, so what follows it there must match the rest of the template. + # Otherwise, a URI whose end doesn't match would be tried with every + # choice before it. The last such literal text is used, so that the + # rest is as short as possible. + # + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [Array] literal_sources The regexp source of each literal. + # @param [Array] expression_sources The regexp source of each + # expression. + # + # @return [String, nil] The lookahead's source, or nil if there's none. + # + # pkg:gem/addressable#lib/addressable/template.rb:2289 + def tail_check(expressions, literals, literal_sources, expression_sources); end + + # The regexp source that takes every character of a set up to the last + # one, possessively, leaving the URI's last characters for the final + # literal text. + # + # @param [Array] value The characters the value can contain. + # @param [Array] eaten The characters to take. + # @param [String, nil] final The final literal text. + # @param [Array] endings Other regexp sources to take. + # + # @return [String] The source, empty if there's nothing to take. + # + # pkg:gem/addressable#lib/addressable/template.rb:2754 + def take_through(value, eaten, final, endings = T.unsafe(nil)); end + + # Splits a template pattern into its expressions and the literal text + # around them, with the regular expression for each literal. Once a + # fragment may have started, expansion encodes a later "#" as "%23", so + # the literals and fragment expressions after that point match it either + # way. Reserved and fragment expansion may start a fragment. + # + # @param [String] pattern The URI template pattern. + # + # @return [Array] + # The pattern with its literals escaped, its expressions, its + # literals (the text before each expression, and after the last one), + # their regular expression sources, and whether a fragment may have + # started before each expression and before each literal. + # + # pkg:gem/addressable#lib/addressable/template.rb:2154 + def template_parts(pattern); end + + # Transforms a mapped value so that values can be substituted into the + # template. + # + # @param [Hash] mapping The mapping to replace captures + # @param [String] capture + # The expression to replace + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError exception + # will be raised if the value is invalid. The transform method + # should return the transformed variable value as a String. If a + # transform method is used, the value will not be percent encoded + # automatically. Unicode normalization will be performed both before and + # after sending the value to the transform method. + # + # @return [String] The expanded expression + # + # pkg:gem/addressable#lib/addressable/template.rb:1394 + def transform_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # Loops through each capture and expands any values available in mapping + # + # @param [Hash] mapping + # Set of keys to expand + # @param [String] capture + # The expression to expand + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError exception + # will be raised if the value is invalid. The transform method + # should return the transformed variable value as a String. If a + # transform method is used, the value will not be percent encoded + # automatically. Unicode normalization will be performed both before and + # after sending the value to the transform method. + # + # @return [String] The expanded expression + # + # pkg:gem/addressable#lib/addressable/template.rb:1137 + def transform_partial_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # Partially expands the runs of a simple, reserved or fragment expression, + # whose values are separated by commas. RFC 6570 has no expression that + # adds a comma only if a later variable is defined, so the result is the + # same as expanding at once only if each missing variable ends up + # undefined. After the first value, a fragment expression's runs use + # reserved expansion, which adds no second "#". + # + # @param [Hash] mapping The mapping to replace captures + # @param [String] operator The expression's operator. + # @param [Array] runs The given and missing runs of varspecs. + # @param [Proc] defined Whether a varspec's variable is given and defined. + # @param [#validate, #transform] processor + # An optional processor object may be supplied. + # @param [Boolean] normalize_values + # Optional flag to enable/disable unicode normalization. Default: true + # + # @return [String] The partially expanded expression + # + # pkg:gem/addressable#lib/addressable/template.rb:1209 + def transform_partial_comma_runs(mapping, operator, runs, defined, processor, normalize_values); end + + # Works out #characters_after. + # + # @param (see #characters_after) + # + # @return (see #characters_after) + # + # pkg:gem/addressable#lib/addressable/template.rb:2639 + def uncached_characters_after(index, expressions, literals, first); end + + # Works out #literal_characters. + # + # @param (see #literal_characters) + # + # @return (see #literal_characters) + # + # pkg:gem/addressable#lib/addressable/template.rb:2595 + def uncached_literal_characters(literal); end + + # A value as UTF-8. RFC 6570 section 3.2.1 transcodes a value in another + # character encoding to UTF-8. A binary or US-ASCII value, or one that + # isn't valid in its own encoding, is read as UTF-8 as it is. + # + # @param [String] value The value. + # + # @return [String] The value in UTF-8, which may not be valid UTF-8. + # + # pkg:gem/addressable#lib/addressable/template.rb:1582 + def utf8_value(value); end + + # Whether a regexp source is valid for the regular expression engine. + # + # @param [String] source The source. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:2266 + def valid_regexp?(source); end + + # Whether a URI's text is valid UTF-8, read as UTF-8 whatever its + # encoding, as Addressable::URI reads it. + # + # @param [Addressable::URI, #to_str] uri The URI. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/template.rb:1644 + def valid_utf8?(uri); end + + # The regexp source for a character class with a set of ASCII + # characters, pct-encoded triplets and non-ASCII characters. + # + # @param [Array] characters The ASCII characters. + # + # @return [String] + # + # pkg:gem/addressable#lib/addressable/template.rb:2560 + def value_class(characters); end + + # The sets of characters that decide how the last value of an expression + # that literal text follows can skip the places where it can't end: the + # characters it can contain, the final character, the literal text's + # characters and its one character that nothing after it can contain, + # the characters that reject the URI once the value has started, and + # those it takes up front. + # + # @param [Integer] index The expression's index. + # @param [Array] expressions The pattern's expressions. + # @param [Array] literals + # The literal text before each expression, and after the last one. + # @param [String] group + # The regexp source for a character of the value, if not the + # operator's. + # + # @return [Hash, nil] The sets, or nil if the value doesn't skip any. + # + # pkg:gem/addressable#lib/addressable/template.rb:2785 + def value_sets(index, expressions, literals, group = T.unsafe(nil)); end + + # The variable name for a regular expression group name. + # + # @param [String] group The group name. + # + # @return [String] The variable name. + # + # pkg:gem/addressable#lib/addressable/template.rb:1874 + def variable_name(group); end +end + +# The thread-local key of the cache for one template build. +# +# pkg:gem/addressable#lib/addressable/template.rb:2235 +Addressable::Template::BUILD_CACHE = T.let(T.unsafe(nil), Symbol) + +# For each operator, including those RFC 6570 reserves, and whether the +# expression can join several values, the characters of TEXT_CHARACTERS +# that its expansion can contain. +# +# pkg:gem/addressable#lib/addressable/template.rb:2239 +Addressable::Template::CONTAINED_CHARACTERS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/addressable#lib/addressable/template.rb:84 +Addressable::Template::EXPRESSION = T.let(T.unsafe(nil), Regexp) + +# The characters of TEXT_CHARACTERS that an operator's value can contain. +# +# pkg:gem/addressable#lib/addressable/template.rb:2253 +Addressable::Template::GROUP_CHARACTERS = T.let(T.unsafe(nil), Hash) + +# Whether a regular expression group name can start with ".". Ruby 2.3 +# and earlier only allow a letter or "_" as its first character. +# +# pkg:gem/addressable#lib/addressable/template.rb:60 +Addressable::Template::GROUP_NAME_CAN_START_WITH_DOT = T.let(T.unsafe(nil), TrueClass) + +# pkg:gem/addressable#lib/addressable/template.rb:57 +Addressable::Template::HEX_DIGITS = T.let(T.unsafe(nil), Array) + +# Raised if a template that doesn't match the RFC 6570 grammar is +# expanded. +# +# pkg:gem/addressable#lib/addressable/template.rb:189 +class Addressable::Template::InvalidTemplateError < ::StandardError; end + +# Raised if an invalid template operator is used in a pattern. +# +# pkg:gem/addressable#lib/addressable/template.rb:194 +class Addressable::Template::InvalidTemplateOperatorError < ::Addressable::Template::InvalidTemplateError; end + +# Raised if an invalid template value is supplied. +# +# pkg:gem/addressable#lib/addressable/template.rb:183 +class Addressable::Template::InvalidTemplateValueError < ::StandardError; end + +# pkg:gem/addressable#lib/addressable/template.rb:169 +Addressable::Template::JOINERS = T.let(T.unsafe(nil), Hash) + +# Characters that label expansion encodes, so a value can't contain them +# as they are: the reserved set (RFC 3986 section 2.2). +# +# pkg:gem/addressable#lib/addressable/template.rb:99 +Addressable::Template::LABEL_DELIMITER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:161 +Addressable::Template::LEADERS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/addressable#lib/addressable/template.rb:3354 +Addressable::Template::LINEAR_TIME_CHECKED = T.let(T.unsafe(nil), TrueClass) + +# Expansion encodes non-ASCII literals (RFC 6570 section 3.1). An ASCII +# character the literals grammar leaves out stays as it is, as most other +# implementations do. +# +# pkg:gem/addressable#lib/addressable/template.rb:96 +Addressable::Template::LITERAL_ENCODE = T.let(T.unsafe(nil), Regexp) + +# A literal's token: a run of non-ASCII pct-encoded octets, one triplet, or +# one character. +# +# pkg:gem/addressable#lib/addressable/template.rb:71 +Addressable::Template::LITERAL_TOKEN = T.let(T.unsafe(nil), Regexp) + +# MRI 3.2 memoizes a match, so that it takes linear time, unless the +# regexp has a lookaround, an atomic group, a possessive quantifier or a +# backreference, but can't say so. Later versions and TruffleRuby can. +# +# pkg:gem/addressable#lib/addressable/template.rb:3351 +Addressable::Template::MEMOIZES_WITHOUT_LOOKAROUNDS = T.let(T.unsafe(nil), FalseClass) + +# Looks up variables in a mapping that isn't enumerable, such as a lambda, +# once each. As with Hash#fetch, a KeyError means the variable is missing, +# and nil means it's defined as nil. +# +# pkg:gem/addressable#lib/addressable/template.rb:110 +class Addressable::Template::MappingLookup + # pkg:gem/addressable#lib/addressable/template.rb:113 + def initialize(source); end + + # pkg:gem/addressable#lib/addressable/template.rb:118 + def [](name); end + + # pkg:gem/addressable#lib/addressable/template.rb:123 + def key?(name); end + + private + + # pkg:gem/addressable#lib/addressable/template.rb:129 + def lookup(name); end + + # KeyError#key is Ruby 2.6+. For an error with no key, MRI raises and + # TruffleRuby gives nil. + # + # pkg:gem/addressable#lib/addressable/template.rb:147 + def missing?(error, name); end +end + +# pkg:gem/addressable#lib/addressable/template.rb:111 +Addressable::Template::MappingLookup::MISSING = T.let(T.unsafe(nil), Object) + +# This class represents the data that is extracted when a Template +# is matched against a URI. +# +# pkg:gem/addressable#lib/addressable/template.rb:205 +class Addressable::Template::MatchData + # Creates a new MatchData object. + # MatchData objects should never be instantiated directly. + # + # @param [Addressable::URI] uri + # The URI that the template was matched against. + # + # pkg:gem/addressable#lib/addressable/template.rb:212 + def initialize(uri, template, mapping); end + + # Accesses captured values by name or by index. + # + # @param [String, Symbol, Fixnum] key + # Capture index or name. Note that when accessing by with index + # of 0, the full URI will be returned. The intention is to mimic + # the ::MatchData#[] behavior. + # + # @param [#to_int, nil] len + # If provided, an array of values will be returned with the given + # parameter used as length. + # + # @return [Array, String, nil] + # The captured value corresponding to the index or name. If the + # value was not provided or the key is unknown, nil will be + # returned. + # + # If the second parameter is provided, an array of that length will + # be returned instead. + # + # pkg:gem/addressable#lib/addressable/template.rb:279 + def [](key, len = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/template.rb:258 + def captures; end + + # Returns a String representation of the MatchData's state. + # + # @return [String] The MatchData's state, as a String. + # + # pkg:gem/addressable#lib/addressable/template.rb:322 + def inspect; end + + # pkg:gem/addressable#lib/addressable/template.rb:244 + def keys; end + + # @return [Hash] + # The mapping that resulted from the match. + # Note that this mapping does not include keys or values for + # variables that appear in the Template, but are not present + # in the URI. + # + # pkg:gem/addressable#lib/addressable/template.rb:234 + def mapping; end + + # pkg:gem/addressable#lib/addressable/template.rb:245 + def names; end + + # pkg:gem/addressable#lib/addressable/template.rb:334 + def post_match; end + + # Dummy method for code expecting a ::MatchData instance + # + # @return [String] An empty string. + # + # pkg:gem/addressable#lib/addressable/template.rb:331 + def pre_match; end + + # pkg:gem/addressable#lib/addressable/template.rb:303 + def string; end + + # @return [Addressable::Template] + # The Template used for the match. + # + # pkg:gem/addressable#lib/addressable/template.rb:226 + def template; end + + # @return [Array] + # Array with the matched URI as first element followed by the captured + # values. + # + # pkg:gem/addressable#lib/addressable/template.rb:293 + def to_a; end + + # @return [String] + # The matched URI as String. + # + # pkg:gem/addressable#lib/addressable/template.rb:300 + def to_s; end + + # @return [Addressable::URI] + # The URI that the Template was matched against. + # + # pkg:gem/addressable#lib/addressable/template.rb:221 + def uri; end + + # @return [Array] + # The list of values that were captured by the Template. + # Note that this list will include nils for any variables which + # were in the Template, but did not appear in the URI. + # + # pkg:gem/addressable#lib/addressable/template.rb:252 + def values; end + + # Returns multiple captured values at once. + # + # @param [String, Symbol, Fixnum] *indexes + # Indices of the captures to be returned + # + # @return [Array] + # Values corresponding to given indices. + # + # @see Addressable::Template::MatchData#[] + # + # pkg:gem/addressable#lib/addressable/template.rb:314 + def values_at(*indexes); end + + # @return [Array] + # The list of variables that were present in the Template. + # Note that this list will include variables which do not appear + # in the mapping because they were not present in URI. + # + # pkg:gem/addressable#lib/addressable/template.rb:241 + def variables; end +end + +# The operators that write each variable's name before its value. +# +# pkg:gem/addressable#lib/addressable/template.rb:178 +Addressable::Template::NAMED_OPERATORS = T.let(T.unsafe(nil), Array) + +# pkg:gem/addressable#lib/addressable/template.rb:104 +Addressable::Template::NO_MAPPING = T.let(T.unsafe(nil), Object) + +# A "#" after the one that starts a fragment, as written or as expansion +# encodes it. +# +# pkg:gem/addressable#lib/addressable/template.rb:68 +Addressable::Template::NUMBER_SIGN_EITHER_FORM = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/template.rb:56 +Addressable::Template::PCT_ENCODED_OR_CHARACTER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:44 +Addressable::Template::RESERVED = T.let(T.unsafe(nil), String) + +# Reserved and fragment expansion encode every character outside the +# reserved and unreserved sets, except a "%" that starts a pct-encoded +# triplet (RFC 6570 section 3.2.3). +# +# pkg:gem/addressable#lib/addressable/template.rb:55 +Addressable::Template::RESERVED_ENCODE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:46 +Addressable::Template::RESERVED_NO_COMMA = T.let(T.unsafe(nil), String) + +# RFC 6570 reserves these operators for future extensions. +# +# pkg:gem/addressable#lib/addressable/template.rb:87 +Addressable::Template::RESERVED_OPERATORS = T.let(T.unsafe(nil), String) + +# Literal text, an expression up to the next "}" (or the end, if there's +# no "}"), or a "}" that doesn't close an expression. +# +# pkg:gem/addressable#lib/addressable/template.rb:92 +Addressable::Template::TEMPLATE_TOKEN = T.let(T.unsafe(nil), Regexp) + +# Characters that a template's text can contain, other than those that +# every expression can. +# +# pkg:gem/addressable#lib/addressable/template.rb:2233 +Addressable::Template::TEXT_CHARACTERS = T.let(T.unsafe(nil), Array) + +# Raised if an invalid template operator is used in a pattern. +# +# pkg:gem/addressable#lib/addressable/template.rb:199 +class Addressable::Template::TemplateOperatorAbortedError < ::StandardError; end + +# pkg:gem/addressable#lib/addressable/template.rb:3353 +Addressable::Template::UNMEMOIZED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:48 +Addressable::Template::UNRESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/template.rb:88 +Addressable::Template::VALID_EXPRESSION = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:80 +Addressable::Template::VARIABLE_LIST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:76 +Addressable::Template::VARNAME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/template.rb:78 +Addressable::Template::VARSPEC = T.let(T.unsafe(nil), Regexp) + +# This is an implementation of a URI parser based on +# RFC 3986, +# RFC 3987. +# +# pkg:gem/addressable#lib/addressable/uri.rb:32 +class Addressable::URI + include ::Addressable::URI::RestoreOnFailure + + # Creates a new uri object from component parts. + # + # @option [String, #to_str] scheme The scheme component. + # @option [String, #to_str] user The user component. + # @option [String, #to_str] password The password component. + # @option [String, #to_str] userinfo + # The userinfo component. If this is supplied, the user and password + # components must be omitted. + # @option [String, #to_str] host The host component. + # @option [String, #to_str] port The port component. + # @option [String, #to_str] authority + # The authority component. If this is supplied, the user, password, + # userinfo, host, and port components must be omitted. + # @option [String, #to_str] path The path component. + # @option [String, #to_str] query The query component. + # @option [String, #to_str] fragment The fragment component. + # + # @return [Addressable::URI] The constructed URI object. + # + # pkg:gem/addressable#lib/addressable/uri.rb:934 + def initialize(options = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2153 + def +(uri); end + + # Returns true if the URI objects are equal. This method + # normalizes both URIs before doing the comparison. + # + # @param [Object] uri The URI to compare. + # + # @return [TrueClass, FalseClass] + # true if the URIs are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2414 + def ==(uri); end + + # Returns true if the URI objects are equal. This method + # normalizes both URIs before doing the comparison, and allows comparison + # against Strings. + # + # @param [Object] uri The URI to compare. + # + # @return [TrueClass, FalseClass] + # true if the URIs are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2392 + def ===(uri); end + + # Determines if the URI is absolute. + # + # @return [TrueClass, FalseClass] + # true if the URI is absolute. false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2050 + def absolute?; end + + # The authority component for this URI. + # Combines the user, password, host, and port components. + # + # @return [String] The authority component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1360 + def authority; end + + # Sets the authority component for this URI. + # + # @param [String, #to_str] new_authority The new authority component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1400 + def authority=(value); end + + # The basename, if any, of the file in the path component. + # + # @return [String] The path's basename. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1736 + def basename; end + + # The default port for this URI's scheme. + # This method will always returns the default port for the URI's scheme + # regardless of the presence of an explicit port in the URI. + # + # @return [Integer] The default port. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1603 + def default_port; end + + # This method allows you to make several changes to a URI simultaneously, + # which separately would cause validation errors, but in conjunction, + # are valid. The URI will be revalidated as soon as the entire block has + # been executed. + # + # @param [Proc] block + # A set of operations to perform on a given URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2578 + def defer_validation; end + + # Creates a URI suitable for display to users. If semantic attacks are + # likely, the application should try to detect these and warn the user. + # See RFC 3986, + # section 7.6 for more information. + # + # @return [Addressable::URI] A URI suitable for display purposes. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2376 + def display_uri; end + + # Returns the public suffix domain for this host. + # + # @example + # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk" + # + # pkg:gem/addressable#lib/addressable/uri.rb:1351 + def domain; end + + # Clones the URI object. + # + # @return [Addressable::URI] The cloned URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2449 + def dup; end + + # Determines if the URI is an empty string. + # + # @return [TrueClass, FalseClass] + # Returns true if empty, false otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2511 + def empty?; end + + # pkg:gem/addressable#lib/addressable/uri.rb:2594 + def encode_with(coder); end + + # Returns true if the URI objects are equal. This method + # does NOT normalize either URI before doing the comparison. + # + # @param [Object] uri The URI to compare. + # + # @return [TrueClass, FalseClass] + # true if the URIs are equivalent, false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2428 + def eql?(uri); end + + # The extname, if any, of the file in the path component. + # Empty string if there is no extension. + # + # @return [String] The path's extname. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1746 + def extname; end + + # The fragment component for this URI. + # + # @return [String] The fragment component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1980 + def fragment; end + + # Sets the fragment component for this URI. + # + # @param [String, #to_str] new_fragment The new fragment component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2006 + def fragment=(value); end + + # Freeze URI, initializing instance variables. + # + # @return [Addressable::URI] The frozen URI object. + # + # pkg:gem/addressable#lib/addressable/uri.rb:976 + def freeze; end + + # A hash value consistent with eql?: URIs with the same + # string have the same hash. Like eql?, it doesn't + # normalize, so URIs that are only equal by ==, such as + # HTTP://EXAMPLE.COM and http://example.com/, + # can have different hashes. + # + # @return [Integer] A hash of the URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2441 + def hash; end + + # The host component for this URI. + # + # @return [String] The host component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1223 + def host; end + + # Sets the host component for this URI. + # + # @param [String, #to_str] new_host The new host component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1282 + def host=(value); end + + # This method is same as URI::Generic#host except + # brackets for IPv6 (and 'IPvFuture') addresses are removed. + # + # @see Addressable::URI#host + # + # @return [String] The hostname for this URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1304 + def hostname; end + + # This method is same as URI::Generic#host= except + # the argument can be a bare IPv6 address (or 'IPvFuture'). + # + # @see Addressable::URI#host= + # + # @param [String, #to_str] new_hostname The new hostname for this URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1316 + def hostname=(value); end + + # The inferred port component for this URI. + # This method will normalize to the default port for the URI's scheme if + # the port isn't explicitly specified in the URI. + # + # @return [Integer] The inferred port component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1589 + def inferred_port; end + + # pkg:gem/addressable#lib/addressable/uri.rb:2605 + def init_with(coder); end + + # Returns a String representation of the URI object's state. + # + # @return [String] The URI object's state, as a String. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2566 + def inspect; end + + # Determines if the scheme indicates an IP-based protocol. + # + # @return [TrueClass, FalseClass] + # true if the scheme indicates an IP-based protocol. + # false otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2026 + def ip_based?; end + + # Joins two URIs together. + # + # @param [String, Addressable::URI, #to_str] The URI to join with. + # + # @return [Addressable::URI] The joined URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2060 + def join(uri); end + + # Destructive form of join. + # + # @param [String, Addressable::URI, #to_str] The URI to join with. + # + # @return [Addressable::URI] The joined URI. + # + # @see Addressable::URI#join + # + # pkg:gem/addressable#lib/addressable/uri.rb:2163 + def join!(uri); end + + # Merges a URI with a Hash of components. + # This method has different behavior from join. Any + # components present in the hash parameter will override the + # original components. The path component is not treated specially. + # + # @param [Hash, Addressable::URI, #to_hash] The components to merge with. + # + # @return [Addressable::URI] The merged URI. + # + # @see Hash#merge + # + # pkg:gem/addressable#lib/addressable/uri.rb:2178 + def merge(hash); end + + # Destructive form of merge. + # + # @param [Hash, Addressable::URI, #to_hash] The components to merge with. + # + # @return [Addressable::URI] The merged URI. + # + # @see Addressable::URI#merge + # + # pkg:gem/addressable#lib/addressable/uri.rb:2243 + def merge!(uri); end + + # Returns a normalized URI object. + # + # NOTE: This method does not attempt to fully conform to specifications. + # It exists largely to correct other people's failures to read the + # specifications, and also to deal with caching issues since several + # different URIs may represent the same resource and should not be + # cached multiple times. + # + # @return [Addressable::URI] The normalized URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2339 + def normalize; end + + # Destructively normalizes this URI object. + # + # @return [Addressable::URI] The normalized URI. + # + # @see Addressable::URI#normalize + # + # pkg:gem/addressable#lib/addressable/uri.rb:2365 + def normalize!; end + + # The authority component for this URI, normalized. + # + # @return [String] The authority component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1378 + def normalized_authority; end + + # The fragment component for this URI, normalized. + # + # @return [String] The fragment component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1986 + def normalized_fragment; end + + # The host component for this URI, normalized. + # + # @return [String] The host component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1229 + def normalized_host; end + + # The password component for this URI, normalized. + # + # @return [String] The password component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1103 + def normalized_password; end + + # The path component for this URI, normalized. + # + # @return [String] The path component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1684 + def normalized_path; end + + # The port component for this URI, normalized. + # + # @return [Integer] The port component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1529 + def normalized_port; end + + # The query component for this URI, normalized. + # + # @return [String] The query component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1761 + def normalized_query(*flags); end + + # The scheme component for this URI, normalized. + # + # @return [String] The scheme component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:991 + def normalized_scheme; end + + # The normalized combination of components that represent a site. + # Combines the scheme, user, password, host, and port components. + # Primarily useful for HTTP and HTTPS. + # + # For example, "http://example.com/path?query" would have a + # site value of "http://example.com". + # + # @return [String] The normalized components that identify a site. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1634 + def normalized_site; end + + # The user component for this URI, normalized. + # + # @return [String] The user component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1047 + def normalized_user; end + + # The userinfo component for this URI, normalized. + # + # @return [String] The userinfo component, normalized. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1171 + def normalized_userinfo; end + + # Omits components from a URI. + # + # @param [Symbol] *components The components to be omitted. + # + # @return [Addressable::URI] The URI with components omitted. + # + # @example + # uri = Addressable::URI.parse("http://example.com/path?query") + # #=> # + # uri.omit(:scheme, :authority) + # #=> # + # + # pkg:gem/addressable#lib/addressable/uri.rb:2475 + def omit(*components); end + + # Destructive form of omit. + # + # @param [Symbol] *components The components to be omitted. + # + # @return [Addressable::URI] The URI with components omitted. + # + # @see Addressable::URI#omit + # + # pkg:gem/addressable#lib/addressable/uri.rb:2502 + def omit!(*components); end + + # The origin for this URI, serialized to ASCII, as per + # RFC 6454, section 6.2. + # + # @return [String] The serialized origin. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1440 + def origin; end + + # Sets the origin for this URI, serialized to ASCII, as per + # RFC 6454, section 6.2. This assignment will reset the `userinfo` + # component. + # + # @param [String, #to_str] new_origin The new origin component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1459 + def origin=(value); end + + # The password component for this URI. + # + # @return [String] The password component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1097 + def password; end + + # Sets the password component for this URI. + # + # @param [String, #to_str] new_password The new password component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1126 + def password=(value); end + + # The path component for this URI. + # + # @return [String] The path component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1677 + def path; end + + # Sets the path component for this URI. + # + # @param [String, #to_str] new_path The new path component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1715 + def path=(value); end + + # The port component for this URI. + # This is the port number actually given in the URI. This does not + # infer port numbers from default values. + # + # @return [Integer] The port component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1523 + def port; end + + # Sets the port component for this URI. + # + # @param [String, Integer, #to_s] new_port The new port component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1545 + def port=(value); end + + # The query component for this URI. + # + # @return [String] The query component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1755 + def query; end + + # Sets the query component for this URI. + # + # @param [String, #to_str] new_query The new query component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1783 + def query=(value); end + + # Converts the query component to a Hash value. + # + # @param [Class] return_type The return type desired. Value must be either + # `Hash` or `Array`. + # + # @return [Hash, Array, nil] The query string parsed as a Hash or Array + # or nil if the query string is blank. + # + # @example + # Addressable::URI.parse("?one=1&two=2&three=3").query_values + # #=> {"one" => "1", "two" => "2", "three" => "3"} + # Addressable::URI.parse("?one=two&one=three").query_values(Array) + # #=> [["one", "two"], ["one", "three"]] + # Addressable::URI.parse("?one=two&one=three").query_values(Hash) + # #=> {"one" => "three"} + # Addressable::URI.parse("?").query_values + # #=> {} + # Addressable::URI.parse("").query_values + # #=> nil + # + # pkg:gem/addressable#lib/addressable/uri.rb:1814 + def query_values(return_type = T.unsafe(nil)); end + + # Sets the query component for this URI from a Hash object. + # An empty Hash or Array will result in an empty query string. + # + # @param [Hash, #to_hash, Array] new_query_values The new query values. + # + # @example + # uri.query_values = {:a => "a", :b => ["c", "d", "e"]} + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']] + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]] + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['flag'], ['key', 'value']] + # uri.query + # # => "flag&key=value" + # + # pkg:gem/addressable#lib/addressable/uri.rb:1870 + def query_values=(value); end + + # Determines if the URI is relative. + # + # @return [TrueClass, FalseClass] + # true if the URI is relative. false + # otherwise. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2040 + def relative?; end + + # The HTTP request URI for this URI. This is the path and the + # query string, with control characters and spaces percent-encoded so + # that it can't end or split the request line. Every other character is + # left as written. + # + # @return [String] The request URI required for an HTTP request. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1939 + def request_uri; end + + # Sets the HTTP request URI for this URI. + # + # @param [String, #to_str] new_request_uri The new HTTP request URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1956 + def request_uri=(value); end + + # Returns the shortest normalized relative form of this URI that uses the + # supplied URI as a base for resolution. Returns an absolute URI if + # necessary. This is effectively the opposite of route_to. + # + # @param [String, Addressable::URI, #to_str] uri The URI to route from. + # + # @return [Addressable::URI] + # The normalized relative URI that is equivalent to the original URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2256 + def route_from(uri); end + + # Returns the shortest normalized relative form of the supplied URI that + # uses this URI as a base for resolution. Returns an absolute URI if + # necessary. This is effectively the opposite of route_from. + # + # @param [String, Addressable::URI, #to_str] uri The URI to route to. + # + # @return [Addressable::URI] + # The normalized relative URI that is equivalent to the supplied URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2325 + def route_to(uri); end + + # The scheme component for this URI. + # + # @return [String] The scheme component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:985 + def scheme; end + + # Sets the scheme component for this URI. + # + # @param [String, #to_str] new_scheme The new scheme component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1012 + def scheme=(value); end + + # The combination of components that represent a site. + # Combines the scheme, user, password, host, and port components. + # Primarily useful for HTTP and HTTPS. + # + # For example, "http://example.com/path?query" would have a + # site value of "http://example.com". + # + # @return [String] The components that identify a site. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1616 + def site; end + + # Sets the site value for this URI. + # + # @param [String, #to_str] new_site The new site value. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1655 + def site=(value); end + + # Returns the top-level domain for this host. + # + # @example + # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk" + # + # pkg:gem/addressable#lib/addressable/uri.rb:1333 + def tld; end + + # Sets the top-level domain for this URI. + # + # @param [String, #to_str] new_tld The new top-level domain. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1341 + def tld=(value); end + + # Returns a Hash of the URI components. + # + # @return [Hash] The URI as a Hash of components. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2549 + def to_hash; end + + # Converts the URI to a String. + # + # A frozen URI returns a new, mutable copy each time, so that callers + # can change the string without changing the URI. + # + # @return [String] The URI's String representation. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2522 + def to_s; end + + # URI's are glorified Strings. Allow implicit conversion. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2543 + def to_str; end + + # The user component for this URI. + # + # @return [String] The user component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1041 + def user; end + + # Sets the user component for this URI. + # + # @param [String, #to_str] new_user The new user component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1070 + def user=(value); end + + # The userinfo component for this URI. + # Combines the user and password components. + # + # @return [String] The userinfo component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1154 + def userinfo; end + + # Sets the userinfo component for this URI. + # + # @param [String, #to_str] new_userinfo The new userinfo component. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1194 + def userinfo=(value); end + + protected + + # Converts the string to be UTF-8 if it is not already UTF-8 + # + # @api private + # + # pkg:gem/addressable#lib/addressable/uri.rb:2863 + def force_utf8_encoding_if_needed(str); end + + # Whether a host is an IP-literal from RFC 3986, section 3.2.2: an IPv6 + # address or an IPvFuture literal, in brackets. + # + # @param [String] host The host to check. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/uri.rb:2748 + def ip_literal?(host); end + + # Whether a string is an IPv6address from RFC 3986, section 3.2.2: eight + # groups of up to four hex digits, where "::" stands for one or more + # groups of zeros and an IPv4 address can stand for the last two groups. + # + # @param [String] address The string to check. + # + # @return [TrueClass, FalseClass] + # + # pkg:gem/addressable#lib/addressable/uri.rb:2762 + def ipv6_address?(address); end + + # Returns a relative path that resolves to path against the base URI, + # or nil if no relative path does. + # + # @param [Addressable::URI] base The normalized base URI. + # @param [String] path The normalized path to route to. + # + # @return [String, nil] The relative path. + # + # @api private + # + # pkg:gem/addressable#lib/addressable/uri.rb:2811 + def relative_path_from(base, path); end + + # Resets composite values for the entire URI + # + # @api private + # + # pkg:gem/addressable#lib/addressable/uri.rb:2851 + def remove_composite_values; end + + # Replaces the internal state of self with the specified URI's state. + # Used in destructive operations to avoid massive code repetition. + # + # @param [Addressable::URI] uri The URI to replace self with. + # + # @return [Addressable::URI] self. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2786 + def replace_self(uri); end + + # Ensures that the URI is valid. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2674 + def validate; end + + private + + # Resets instance variables + # + # @api private + # + # A setter puts the components back if it raises, so that a failed + # assignment doesn't leave the URI half changed. Within defer_validation + # the outermost block does that instead, and a frozen URI can't change. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2919 + def components_restored_elsewhere?; end + + # Ruby 3.0+ passes freeze: when clone is called with it. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2880 + def initialize_clone(other, freeze: T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2871 + def initialize_copy(other); end + + # Computes every cached value, so that a frozen URI never needs to set + # one, and replaces the strings it holds with frozen copies. A string + # passed to a setter is copied rather than frozen, so that freezing the + # URI doesn't freeze the caller's string. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2890 + def prepare_to_freeze; end + + # pkg:gem/addressable#lib/addressable/uri.rb:2933 + def reset_ivs; end + + # The other instance variables are derived from these, so clear them. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2928 + def restore_components(saved); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2923 + def save_components; end + + class << self + # Converts a path to a file scheme URI. If the path supplied is + # relative, it will be returned as a relative URI. If the path supplied + # is actually a non-file URI, it will parse the URI as if it had been + # parsed with Addressable::URI.parse. Handles all of the + # various Microsoft-specific formats for specifying paths. + # + # @param [String, Addressable::URI, #to_str] path + # Typically a String path to a file or directory, but + # will return a sensible return value if an absolute URI is supplied + # instead. + # + # @return [Addressable::URI] + # The parsed file scheme URI or the original URI if some other URI + # scheme was provided. + # + # @example + # base = Addressable::URI.convert_path("/absolute/path/") + # uri = Addressable::URI.convert_path("relative/path") + # (base + uri).to_s + # #=> "file:///absolute/path/relative/path" + # + # Addressable::URI.convert_path( + # "c:\\windows\\My Documents 100%20\\foo.txt" + # ).to_s + # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt" + # + # Addressable::URI.convert_path("http://example.com/").to_s + # #=> "http://example.com/" + # + # pkg:gem/addressable#lib/addressable/uri.rb:371 + def convert_path(path); end + + # Percent encodes any special characters in the URI. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI to encode. + # + # @param [Class] return_type + # The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # + # @return [String, Addressable::URI] + # The encoded URI. + # The return type is determined by the return_type + # parameter. + # + # pkg:gem/addressable#lib/addressable/uri.rb:715 + def encode(uri, return_type = T.unsafe(nil)); end + + # Percent encodes a URI component. + # + # @param [String, #to_str] component The URI component to encode. + # + # @param [String, Regexp] character_class + # The characters which are not percent encoded. If a String + # is passed, the String must be formatted as a regular + # expression character class. (Do not include the surrounding square + # brackets.) For example, "b-zB-Z0-9" would cause + # everything but the letters 'b' through 'z' and the numbers '0' through + # '9' to be percent encoded. If a Regexp is passed, the + # value /[^b-zB-Z0-9]/ would have the same effect. A set of + # useful String values may be found in the + # Addressable::URI::CharacterClasses module. The default + # value is the reserved plus unreserved character classes specified in + # RFC 3986. + # + # @param [Regexp] upcase_encoded + # A string of characters that may already be percent encoded, and whose + # encodings should be upcased. This allows normalization of percent + # encodings for characters not included in the + # character_class. + # + # @return [String] The encoded component. + # + # @example + # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component( + # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED + # ) + # => "simple%2Fexample" + # + # pkg:gem/addressable#lib/addressable/uri.rb:482 + def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:750 + def escape(uri, return_type = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:525 + def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end + + # Encodes a set of key/value pairs according to the rules for the + # application/x-www-form-urlencoded MIME type. + # + # @param [#to_hash, #to_ary] form_values + # The form values to encode. + # + # @param [TrueClass, FalseClass] sort + # Sort the key/value pairs prior to encoding. + # Defaults to false. + # + # @return [String] + # The encoded value. + # + # pkg:gem/addressable#lib/addressable/uri.rb:844 + def form_encode(form_values, sort = T.unsafe(nil)); end + + # Decodes a String according to the rules for the + # application/x-www-form-urlencoded MIME type. + # + # @param [String, #to_str] encoded_value + # The form values to decode. + # + # @return [Array] + # The decoded values. + # This is not a Hash because of the possibility for + # duplicate keys. + # + # pkg:gem/addressable#lib/addressable/uri.rb:897 + def form_unencode(encoded_value); end + + # Converts an input to a URI. The input does not have to be a valid + # URI — the method will use heuristics to guess what URI was intended. + # This is not standards-compliant, merely user-friendly. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI string to parse. + # No parsing is performed if the object is already an + # Addressable::URI. + # @param [Hash] hints + # A Hash of hints to the heuristic parser. + # Defaults to {:scheme => "http"}. + # + # @return [Addressable::URI] The parsed URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:269 + def heuristic_parse(uri, hints = T.unsafe(nil)); end + + # Returns an array of known ip-based schemes. These schemes typically + # use a similar URI form: + # //:@:/ + # + # pkg:gem/addressable#lib/addressable/uri.rb:1506 + def ip_based_schemes; end + + # Joins several URIs together. + # + # @param [String, Addressable::URI, #to_str] *uris + # The URIs to join. + # + # @return [Addressable::URI] The joined URI. + # + # @example + # base = "http://example.com/" + # uri = Addressable::URI.parse("relative/path") + # Addressable::URI.join(base, uri) + # #=> # + # + # pkg:gem/addressable#lib/addressable/uri.rb:422 + def join(*uris); end + + # Normalizes the encoding of a URI component. + # + # @param [String, #to_str] component The URI component to encode. + # + # @param [String, Regexp] character_class + # The characters which are not percent encoded. If a String + # is passed, the String must be formatted as a regular + # expression character class. (Do not include the surrounding square + # brackets.) For example, "b-zB-Z0-9" would cause + # everything but the letters 'b' through 'z' and the numbers '0' + # through '9' to be percent encoded. If a Regexp is passed, + # the value /[^b-zB-Z0-9]/ would have the same effect. A + # set of useful String values may be found in the + # Addressable::URI::CharacterClasses module. The default + # value is the reserved plus unreserved character classes specified in + # RFC 3986. + # + # @param [String] leave_encoded + # When character_class is a String then + # leave_encoded is a string of characters that should remain + # percent encoded while normalizing the component; if they appear percent + # encoded in the original component, then they will be upcased ("%2f" + # normalized to "%2F") but otherwise left alone. + # + # @return [String] The normalized component. + # + # @example + # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z") + # => "simple%2Fex%61mple" + # Addressable::URI.normalize_component( + # "simpl%65/%65xampl%65", /[^b-zB-Z]/ + # ) + # => "simple%2Fex%61mple" + # Addressable::URI.normalize_component( + # "simpl%65/%65xampl%65", + # Addressable::URI::CharacterClasses::UNRESERVED + # ) + # => "simple%2Fexample" + # Addressable::URI.normalize_component( + # "one%20two%2fthree%26four", + # "0-9a-zA-Z &/", + # "/" + # ) + # => "one two%2Fthree&four" + # + # pkg:gem/addressable#lib/addressable/uri.rb:637 + def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # Resolves paths to their simplest form. + # + # @param [String] path The path to normalize. + # + # @return [String] The normalized path. + # + # pkg:gem/addressable#lib/addressable/uri.rb:2623 + def normalize_path(path); end + + # Normalizes the encoding of a URI. Characters within a hostname are + # not percent encoded to allow for internationalized domain names. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI to encode. + # + # @param [Class] return_type + # The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # + # @return [String, Addressable::URI] + # The encoded URI. + # The return type is determined by the return_type + # parameter. + # + # pkg:gem/addressable#lib/addressable/uri.rb:770 + def normalized_encode(uri, return_type = T.unsafe(nil)); end + + # Returns a URI object based on the parsed string. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI string to parse. + # No parsing is performed if the object is already an + # Addressable::URI. + # + # @return [Addressable::URI] The parsed URI. + # + # pkg:gem/addressable#lib/addressable/uri.rb:192 + def parse(uri); end + + # Returns a hash of common IP-based schemes and their default port + # numbers. Adding new schemes to this hash, as necessary, will allow + # for better URI normalization. + # + # pkg:gem/addressable#lib/addressable/uri.rb:1513 + def port_mapping; end + + # Unencodes any percent encoded characters within a URI component. + # This method may be used for unencoding either components or full URIs, + # however, it is recommended to use the unencode_component + # alias when unencoding components. + # + # @param [String, Addressable::URI, #to_str] uri + # The URI or component to unencode. + # + # @param [Class] return_type + # The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # + # @param [String] leave_encoded + # A string of characters to leave encoded. If a percent encoded character + # in this list is encountered then it will remain percent encoded. + # + # @return [String, Addressable::URI] + # The unencoded component or URI. + # The return type is determined by the return_type + # parameter. + # + # pkg:gem/addressable#lib/addressable/uri.rb:551 + def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:587 + def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:586 + def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # pkg:gem/addressable#lib/addressable/uri.rb:588 + def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + end +end + +# Container for the character classes specified in +# RFC 3986. +# +# Note: Concatenated and interpolated `String`s are not affected by the +# `frozen_string_literal` directive and must be frozen explicitly. +# +# Interpolated `String`s *were* frozen this way before Ruby 3.0: +# https://bugs.ruby-lang.org/issues/17104 +# +# pkg:gem/addressable#lib/addressable/uri.rb:47 +module Addressable::URI::CharacterClasses; end + +# pkg:gem/addressable#lib/addressable/uri.rb:48 +Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:58 +Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:49 +Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:61 +Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:50 +Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:57 +Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:59 +Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:55 +Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:60 +Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:52 +Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:54 +Addressable::URI::CharacterClasses::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:56 +Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:51 +Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:53 +Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:133 +module Addressable::URI::CharacterClassesRegexps; end + +# pkg:gem/addressable#lib/addressable/uri.rb:134 +Addressable::URI::CharacterClassesRegexps::AUTHORITY = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:135 +Addressable::URI::CharacterClassesRegexps::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:136 +Addressable::URI::CharacterClassesRegexps::HOST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:137 +Addressable::URI::CharacterClassesRegexps::PATH = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:138 +Addressable::URI::CharacterClassesRegexps::QUERY = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:139 +Addressable::URI::CharacterClassesRegexps::RESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:140 +Addressable::URI::CharacterClassesRegexps::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:141 +Addressable::URI::CharacterClassesRegexps::SCHEME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:142 +Addressable::URI::CharacterClassesRegexps::UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2736 +Addressable::URI::DEC_OCTET = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:148 +Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:2737 +Addressable::URI::IPV4_ADDRESS = T.let(T.unsafe(nil), Regexp) + +# Parts of an IP-literal, from RFC 3986, section 3.2.2. +# +# pkg:gem/addressable#lib/addressable/uri.rb:2735 +Addressable::URI::IPV6_PIECE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2738 +Addressable::URI::IPV_FUTURE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:146 +Addressable::URI::IP_LITERAL = T.let(T.unsafe(nil), Regexp) + +# Raised if something other than a uri is supplied. +# +# pkg:gem/addressable#lib/addressable/uri.rb:35 +class Addressable::URI::InvalidURIError < ::StandardError; end + +# The largest port, the largest integer the platform stores without a +# bignum. A port is an Integer, and on a Ruby built without GMP, +# converting a long run of digits takes time quadratic in its length, so +# a longer one is rejected before it's converted. Rubies before 2.5 +# don't have RbConfig::LIMITS, so it's worked out from the word size. +# +# pkg:gem/addressable#lib/addressable/uri.rb:173 +Addressable::URI::LARGEST_PORT = T.let(T.unsafe(nil), Integer) + +# The schemes of PORT_MAPPING run over TCP or UDP, whose ports are 16-bit. +# +# pkg:gem/addressable#lib/addressable/uri.rb:180 +Addressable::URI::LARGEST_TRANSPORT_PORT = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/uri.rb:2960 +module Addressable::URI::NONE; end + +# pkg:gem/addressable#lib/addressable/uri.rb:1679 +Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp) + +# Normalization decodes a pct-encoded character unless it's a delimiter +# where it appears, since decoding it there would change how the URI is +# read: "/" in a path, "&", ";" and "+" in a query, and "=" in a query +# name. A delimiter that isn't allowed in the component, such as "?" in +# a path segment, is encoded again anyway. "%25" also stays encoded, and +# a bare "%" is encoded first, so every "%" left after decoding starts a +# triplet and none is decoded twice; so these classes never encode "%". +# +# pkg:gem/addressable#lib/addressable/uri.rb:83 +module Addressable::URI::NormalizeByPosition + class << self + # Encodes the colons in the first segment of a relative path, which + # would otherwise be read as ending a scheme. + # + # pkg:gem/addressable#lib/addressable/uri.rb:126 + def encode_relative_colons(path, scheme); end + + # Normalizes a query's name=value pair, keeping "=" encoded in the + # name. The name and value are normalized apart, so NFC can't compose + # the "=" between them with a combining mark. + # + # pkg:gem/addressable#lib/addressable/uri.rb:112 + def query_pair(pair, character_class); end + end +end + +# pkg:gem/addressable#lib/addressable/uri.rb:100 +Addressable::URI::NormalizeByPosition::BARE_PERCENT = T.let(T.unsafe(nil), Regexp) + +# A relative path's first segment can't hold a colon (RFC 3986 +# section 4.2). +# +# pkg:gem/addressable#lib/addressable/uri.rb:99 +Addressable::URI::NormalizeByPosition::FIRST_SEGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:91 +Addressable::URI::NormalizeByPosition::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:96 +Addressable::URI::NormalizeByPosition::LEAVE_IN_FRAGMENT = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:93 +Addressable::URI::NormalizeByPosition::LEAVE_IN_PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:95 +Addressable::URI::NormalizeByPosition::LEAVE_IN_QUERY_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:94 +Addressable::URI::NormalizeByPosition::LEAVE_IN_QUERY_VALUE = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:92 +Addressable::URI::NormalizeByPosition::LEAVE_IN_SEGMENT = T.let(T.unsafe(nil), String) + +# NFC turns U+037E GREEK QUESTION MARK into ";", the only character +# it turns into a reserved one. A delimiter isn't equivalent to the +# text it came from, so U+037E is left out of NFC. +# +# pkg:gem/addressable#lib/addressable/uri.rb:105 +Addressable::URI::NormalizeByPosition::NFC_DELIMITER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:85 +Addressable::URI::NormalizeByPosition::PATH = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:84 +Addressable::URI::NormalizeByPosition::PCHAR = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:86 +Addressable::URI::NormalizeByPosition::QUERY = T.let(T.unsafe(nil), Regexp) + +# "&" and ";" can separate query pairs, so they're encoded in a pair. +# +# pkg:gem/addressable#lib/addressable/uri.rb:88 +Addressable::URI::NormalizeByPosition::QUERY_PAIR = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:106 +Addressable::URI::NormalizeByPosition::SPLIT_TRIPLETS_AND_DELIMITER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:101 +Addressable::URI::NormalizeByPosition::TRIPLET = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:64 +module Addressable::URI::NormalizeCharacterClasses; end + +# pkg:gem/addressable#lib/addressable/uri.rb:72 +Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:65 +Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:70 +Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:73 +Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp) + +# A registered name has no ":", "[" or "]": those only delimit an IP +# literal and the port. +# +# pkg:gem/addressable#lib/addressable/uri.rb:68 +Addressable::URI::NormalizeCharacterClasses::REG_NAME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:71 +Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:69 +Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/addressable#lib/addressable/uri.rb:2615 +Addressable::URI::PARENT = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:152 +Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash) + +# Characters that can end or split an HTTP request line: control +# characters and space. +# +# RFC 3986 leaves other characters out of a URI too, such as +# non-ASCII text, '"', '{', '|', '^', and the brackets in a query like +# "ids[]=1". Those are left as written. They can't end the request +# line, servers commonly accept them, and encoding them would change +# request targets that work today: a server that maps paths to keys +# without decoding them, such as S3, would get a different key, and a +# signature over the path and query as written (an HTTP message +# signature, for example) would no longer match the request line. +# For the same reason, the path and query aren't normalized here; +# callers who want that can use normalize.request_uri. +# +# pkg:gem/addressable#lib/addressable/uri.rb:1929 +Addressable::URI::REQUEST_TARGET_UNSAFE = T.let(T.unsafe(nil), Regexp) + +# Wraps each setter so that it changes nothing when it raises. +# +# pkg:gem/addressable#lib/addressable/uri.rb:2965 +module Addressable::URI::RestoreOnFailure + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def authority=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def fragment=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def host=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def hostname=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def origin=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def password=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def path=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def port=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def query=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def query_values=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def request_uri=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def scheme=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def site=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def tld=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def user=(value); end + + # pkg:gem/addressable#lib/addressable/uri.rb:2972 + def userinfo=(value); end +end + +# pkg:gem/addressable#lib/addressable/uri.rb:2614 +Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String) + +# Tables used to optimize encoding operations in `self.encode_component` +# and `self.normalize_component` +# +# pkg:gem/addressable#lib/addressable/uri.rb:439 +Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Array) + +# pkg:gem/addressable#lib/addressable/uri.rb:443 +Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Array) + +# pkg:gem/addressable#lib/addressable/uri.rb:145 +Addressable::URI::SLASH = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/uri.rb:150 +Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp) + +# Unicode normalization in time linear in the length of the input. +# +# String#unicode_normalize normalizes a character and the +# combining marks after it as one unit, in time quadratic in the number of +# marks, so a few thousand marks in a row take seconds. +# +# @api private +# +# pkg:gem/addressable#lib/addressable/unicode_normalization.rb:29 +module Addressable::UnicodeNormalization + class << self + # Normalizes a string, leaving runs of more than + # MAX_COMBINING_MARKS combining marks as they are. + # + # @param [String] string The string to normalize. + # @param [Symbol] form The normalization form. + # + # @return [String] The normalized string. + # + # pkg:gem/addressable#lib/addressable/unicode_normalization.rb:50 + def normalize(string, form); end + end +end + +# U+FF9E and U+FF9F aren't combining marks, but NFKC and NFKD map them +# to U+3099 and U+309A, which are. +# +# pkg:gem/addressable#lib/addressable/unicode_normalization.rb:38 +Addressable::UnicodeNormalization::LONG_COMBINING_RUN = T.let(T.unsafe(nil), Regexp) + +# The longest run of combining marks that is normalized. This is the +# limit of the Stream-Safe Text Format in UAX #15; text in any language +# stays well below it. +# +# pkg:gem/addressable#lib/addressable/unicode_normalization.rb:34 +Addressable::UnicodeNormalization::MAX_COMBINING_MARKS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/version.rb:23 +module Addressable::VERSION; end + +# pkg:gem/addressable#lib/addressable/version.rb:24 +Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/version.rb:25 +Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/addressable#lib/addressable/version.rb:28 +Addressable::VERSION::STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/addressable#lib/addressable/version.rb:26 +Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer) diff --git a/sorbet/rbi/gems/addressable@2.9.2.rbi b/sorbet/rbi/gems/addressable@2.9.2.rbi deleted file mode 100644 index 9695f43f..00000000 --- a/sorbet/rbi/gems/addressable@2.9.2.rbi +++ /dev/null @@ -1,2081 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `addressable` gem. -# Please instead update this file by running `bin/tapioca gem addressable`. - - -# Addressable is a library for processing links and URIs. -# -# pkg:gem/addressable#lib/addressable/version.rb:22 -module Addressable; end - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:21 -module Addressable::IDNA - class << self - # pkg:gem/addressable#lib/addressable/idna/pure.rb:170 - def _deprecated_unicode_normalize_kc(value); end - - # Converts from a Unicode internationalized domain name to an ASCII - # domain name as described in RFC 3490. - # - # pkg:gem/addressable#lib/addressable/idna/pure.rb:101 - def to_ascii(input); end - - # Converts from an ASCII domain name to a Unicode internationalized - # domain name as described in RFC 3490. - # - # pkg:gem/addressable#lib/addressable/idna/pure.rb:127 - def to_unicode(input); end - - # @deprecated Use {String#unicode_normalize(:nfkc)} instead - # - # pkg:gem/addressable#lib/addressable/idna/pure.rb:165 - def unicode_normalize_kc(*args, **, &block); end - - private - - # pkg:gem/addressable#lib/addressable/idna/pure.rb:188 - def lookup_unicode_lowercase(codepoint); end - - # Bias adaptation method - # - # pkg:gem/addressable#lib/addressable/idna/pure.rb:4742 - def punycode_adapt(delta, numpoints, firsttime); end - - # pkg:gem/addressable#lib/addressable/idna/pure.rb:4710 - def punycode_basic?(codepoint); end - - # pkg:gem/addressable#lib/addressable/idna/pure.rb:4588 - def punycode_decode(punycode); end - - # Returns the numeric value of a basic codepoint - # (for use in representing integers) in the range 0 to - # base - 1, or PUNYCODE_BASE if codepoint does not represent a value. - # - # pkg:gem/addressable#lib/addressable/idna/pure.rb:4728 - def punycode_decode_digit(codepoint); end - - # pkg:gem/addressable#lib/addressable/idna/pure.rb:4715 - def punycode_delimiter?(codepoint); end - - # pkg:gem/addressable#lib/addressable/idna/pure.rb:4471 - def punycode_encode(unicode); end - - # pkg:gem/addressable#lib/addressable/idna/pure.rb:4720 - def punycode_encode_digit(d); end - - # Unicode aware downcase method. - # - # @api private - # @param [String] input - # The input string. - # @return [String] The downcased result. - # - # pkg:gem/addressable#lib/addressable/idna/pure.rb:180 - def unicode_downcase(input); end - end -end - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4441 -Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) - -# This module is loosely based on idn_actionmailer by Mick Staugaard, -# the unicode library by Yoshida Masato, and the punycode implementation -# by Kazuhiro Nishiyama. Most of the code was copied verbatim, but -# some reformatting was done, and some translation from C was done. -# -# Without their code to work from as a base, we'd all still be relying -# on the presence of libidn. Which nobody ever seems to have installed. -# -# Original sources: -# http://github.com/staugaard/idn_actionmailer -# http://www.yoshidam.net/Ruby.html#unicode -# http://rubyforge.org/frs/?group_id=2550 -# -# pkg:gem/addressable#lib/addressable/idna/pure.rb:35 -Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String) - -# Characters that change how a label displays without being visible -# themselves: controls, format characters such as bidi overrides and -# isolates, and default ignorable code points. libidn rejects most of -# them, but not those added to Unicode after the version it checks -# against, such as U+2066 to U+2069. Format characters that are also -# default ignorable are left out of the second set, since Ruby warns about -# a duplicated range in a character class. -# Characters that change how a label displays without being visible -# themselves: controls, format characters such as bidi overrides and -# isolates, and default ignorable code points, including those added to -# Unicode after the version nameprep is based on. Format characters that -# are also default ignorable are left out of the second set, since Ruby -# warns about a duplicated range in a character class. -# -# pkg:gem/addressable#lib/addressable/idna/pure.rb:95 -Addressable::IDNA::DISPLAY_CHANGING = T.let(T.unsafe(nil), Regexp) - -# Characters that nameprep doesn't allow in a label (Section 5 of -# RFC 3491), or that it maps to nothing, so they can't be in a label that -# toASCII produces. Some code points are in more than one table; they're -# listed only under the first, since Ruby warns about a duplicated range -# in a character class. -# -# pkg:gem/addressable#lib/addressable/idna/pure.rb:63 -Addressable::IDNA::NAMEPREP_PROHIBITED = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4443 -Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4447 -Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4450 -Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4448 -Addressable::IDNA::PUNYCODE_INITIAL_BIAS = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4449 -Addressable::IDNA::PUNYCODE_INITIAL_N = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4452 -Addressable::IDNA::PUNYCODE_MAXINT = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4454 -Addressable::IDNA::PUNYCODE_PRINT_ASCII = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4446 -Addressable::IDNA::PUNYCODE_SKEW = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4445 -Addressable::IDNA::PUNYCODE_TMAX = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4444 -Addressable::IDNA::PUNYCODE_TMIN = T.let(T.unsafe(nil), Integer) - -# Input is invalid. -# -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4465 -class Addressable::IDNA::PunycodeBadInput < ::StandardError; end - -# Output would exceed the space provided. -# -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4467 -class Addressable::IDNA::PunycodeBigOutput < ::StandardError; end - -# Input needs wider integers to process. -# -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4469 -class Addressable::IDNA::PunycodeOverflow < ::StandardError; end - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:204 -Addressable::IDNA::UNICODE_DATA = T.let(T.unsafe(nil), Hash) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:198 -Addressable::IDNA::UNICODE_DATA_CANONICAL = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:196 -Addressable::IDNA::UNICODE_DATA_COMBINING_CLASS = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:199 -Addressable::IDNA::UNICODE_DATA_COMPATIBILITY = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:197 -Addressable::IDNA::UNICODE_DATA_EXCLUSION = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:201 -Addressable::IDNA::UNICODE_DATA_LOWERCASE = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:202 -Addressable::IDNA::UNICODE_DATA_TITLECASE = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:200 -Addressable::IDNA::UNICODE_DATA_UPPERCASE = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:4440 -Addressable::IDNA::UNICODE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:37 -Addressable::IDNA::UTF8_REGEX = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/idna/pure.rb:48 -Addressable::IDNA::UTF8_REGEX_MULTIBYTE = T.let(T.unsafe(nil), Regexp) - -# This is an implementation of a URI template based on -# RFC 6570 (http://tools.ietf.org/html/rfc6570). -# -# pkg:gem/addressable#lib/addressable/template.rb:27 -class Addressable::Template - # Creates a new Addressable::Template object. - # - # @param [#to_str] pattern The URI Template pattern. - # - # @return [Addressable::Template] The initialized Template object. - # - # pkg:gem/addressable#lib/addressable/template.rb:236 - def initialize(pattern); end - - # Returns true if the Template objects are equal. This method - # does NOT normalize either Template before doing the comparison. - # - # @param [Object] template The Template to compare. - # - # @return [TrueClass, FalseClass] - # true if the Templates are equivalent, false - # otherwise. - # - # pkg:gem/addressable#lib/addressable/template.rb:276 - def ==(template); end - - # Addressable::Template makes no distinction between `==` and `eql?`. - # - # @see #== - # - # pkg:gem/addressable#lib/addressable/template.rb:285 - def eql?(template); end - - # Expands a URI template into a full URI. - # - # @param [Hash] mapping The mapping that corresponds to the pattern. - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError - # exception will be raised if the value is invalid. The transform - # method should return the transformed variable value as a String. - # If a transform method is used, the value will not be percent - # encoded automatically. Unicode normalization will be performed both - # before and after sending the value to the transform method. - # - # @return [Addressable::URI] The expanded URI template. - # - # @example - # class ExampleProcessor - # def self.validate(name, value) - # return !!(value =~ /^[\w ]+$/) if name == "query" - # return true - # end - # - # def self.transform(name, value) - # return value.gsub(/ /, "+") if name == "query" - # return value - # end - # end - # - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).expand( - # {"query" => "an example search query"}, - # ExampleProcessor - # ).to_str - # #=> "http://example.com/search/an+example+search+query/" - # - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).expand( - # {"query" => "an example search query"} - # ).to_str - # #=> "http://example.com/search/an%20example%20search%20query/" - # - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).expand( - # {"query" => "bogus!"}, - # ExampleProcessor - # ).to_str - # #=> Addressable::Template::InvalidTemplateValueError - # - # pkg:gem/addressable#lib/addressable/template.rb:603 - def expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end - - # Extracts a mapping from the URI using a URI Template pattern. - # - # @param [Addressable::URI, #to_str] uri - # The URI to extract from. - # - # @param [#restore, #match] processor - # A template processor object may optionally be supplied. - # - # The object should respond to either the restore or - # match messages or both. The restore method should - # take two parameters: `[String] name` and `[String] value`. - # The restore method should reverse any transformations that - # have been performed on the value to ensure a valid URI. - # The match method should take a single - # parameter: `[String] name`. The match method should return - # a String containing a regular expression capture group for - # matching on that particular variable. The default value is `".*?"`. - # The match method has no effect on multivariate operator - # expansions. - # - # @return [Hash, NilClass] - # The Hash mapping that was extracted from the URI, or - # nil if the URI didn't match the template. - # - # @example - # class ExampleProcessor - # def self.restore(name, value) - # return value.gsub(/\+/, " ") if name == "query" - # return value - # end - # - # def self.match(name) - # return ".*?" if name == "first" - # return ".*" - # end - # end - # - # uri = Addressable::URI.parse( - # "http://example.com/search/an+example+search+query/" - # ) - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).extract(uri, ExampleProcessor) - # #=> {"query" => "an example search query"} - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # Addressable::Template.new( - # "http://example.com/{first}/{second}/" - # ).extract(uri, ExampleProcessor) - # #=> {"first" => "a", "second" => "b/c"} - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # Addressable::Template.new( - # "http://example.com/{first}/{-list|/|second}/" - # ).extract(uri) - # #=> {"first" => "a", "second" => ["b", "c"]} - # - # pkg:gem/addressable#lib/addressable/template.rb:344 - def extract(uri, processor = T.unsafe(nil)); end - - # Freeze URI, initializing instance variables. - # - # @return [Addressable::URI] The frozen URI object. - # - # pkg:gem/addressable#lib/addressable/template.rb:247 - def freeze; end - - # Returns a String representation of the Template object's state. - # - # @return [String] The Template object's state, as a String. - # - # pkg:gem/addressable#lib/addressable/template.rb:262 - def inspect; end - - # pkg:gem/addressable#lib/addressable/template.rb:622 - def keys; end - - # Extracts match data from the URI using a URI Template pattern. - # - # @param [Addressable::URI, #to_str] uri - # The URI to extract from. - # - # @param [#restore, #match] processor - # A template processor object may optionally be supplied. - # - # The object should respond to either the restore or - # match messages or both. The restore method should - # take two parameters: `[String] name` and `[String] value`. - # The restore method should reverse any transformations that - # have been performed on the value to ensure a valid URI. - # The match method should take a single - # parameter: `[String] name`. The match method should return - # a String containing a regular expression capture group for - # matching on that particular variable. The default value is `".*?"`. - # The match method has no effect on multivariate operator - # expansions. - # - # @return [Hash, NilClass] - # The Hash mapping that was extracted from the URI, or - # nil if the URI didn't match the template. - # - # @example - # class ExampleProcessor - # def self.restore(name, value) - # return value.gsub(/\+/, " ") if name == "query" - # return value - # end - # - # def self.match(name) - # return ".*?" if name == "first" - # return ".*" - # end - # end - # - # uri = Addressable::URI.parse( - # "http://example.com/search/an+example+search+query/" - # ) - # match = Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).match(uri, ExampleProcessor) - # match.variables - # #=> ["query"] - # match.captures - # #=> ["an example search query"] - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # match = Addressable::Template.new( - # "http://example.com/{first}/{+second}/" - # ).match(uri, ExampleProcessor) - # match.variables - # #=> ["first", "second"] - # match.captures - # #=> ["a", "b/c"] - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # match = Addressable::Template.new( - # "http://example.com/{first}{/second*}/" - # ).match(uri) - # match.variables - # #=> ["first", "second"] - # match.captures - # #=> ["a", ["b", "c"]] - # - # pkg:gem/addressable#lib/addressable/template.rb:415 - def match(uri, processor = T.unsafe(nil)); end - - # Returns the named captures of the coerced `Regexp`. - # - # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}. - # - # @api private - # - # pkg:gem/addressable#lib/addressable/template.rb:663 - def named_captures; end - - # pkg:gem/addressable#lib/addressable/template.rb:623 - def names; end - - # Expands a URI template into another URI template. - # - # @param [Hash] mapping The mapping that corresponds to the pattern. - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError - # exception will be raised if the value is invalid. The transform - # method should return the transformed variable value as a String. - # If a transform method is used, the value will not be percent - # encoded automatically. Unicode normalization will be performed both - # before and after sending the value to the transform method. - # - # @return [Addressable::Template] The partially expanded URI template. - # - # @example - # Addressable::Template.new( - # "http://example.com/{one}/{two}/" - # ).partial_expand({"one" => "1"}).pattern - # #=> "http://example.com/1/{two}/" - # - # Addressable::Template.new( - # "http://example.com/{?one,two}/" - # ).partial_expand({"one" => "1"}).pattern - # #=> "http://example.com/?one=1{&two}/" - # - # Addressable::Template.new( - # "http://example.com/{?one,two,three}/" - # ).partial_expand({"one" => "1", "three" => 3}).pattern - # #=> "http://example.com/?one=1{&two}&three=3" - # - # pkg:gem/addressable#lib/addressable/template.rb:536 - def partial_expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end - - # @return [String] The Template object's pattern. - # - # pkg:gem/addressable#lib/addressable/template.rb:256 - def pattern; end - - # Returns the source of the coerced `Regexp`. - # - # @return [String] The source of the `Regexp` given by {#to_regexp}. - # - # @api private - # - # pkg:gem/addressable#lib/addressable/template.rb:653 - def source; end - - # Coerces a template into a `Regexp` object. This regular expression will - # behave very similarly to the actual template, and should match the same - # URI values, but it cannot fully handle, for example, values that would - # extract to an `Array`. - # - # @return [Regexp] A regular expression which should match the template. - # - # pkg:gem/addressable#lib/addressable/template.rb:642 - def to_regexp; end - - # Returns a mapping of variables to their default values specified - # in the template. Variables without defaults are not returned. - # - # @return [Hash] Mapping of template variables to their defaults - # - # pkg:gem/addressable#lib/addressable/template.rb:630 - def variable_defaults; end - - # Returns an Array of variables used within the template pattern. - # The variables are listed in the Array in the order they appear within - # the pattern. Multiple occurrences of a variable within a pattern are - # not represented in this Array. - # - # @return [Array] The variables present in the template's pattern. - # - # pkg:gem/addressable#lib/addressable/template.rb:619 - def variables; end - - private - - # Whether an expression, followed directly by another one, could only - # match characters that the other one could also match, in any amount. - # - # @param [MatchData] following The expression that follows. - # @param [String, nil] operator The operator of the first expression. - # @param [Array] varspecs The varspecs of the first expression. - # - # @return [TrueClass, FalseClass] - # - # pkg:gem/addressable#lib/addressable/template.rb:1019 - def absorbed_by?(following, operator, varspecs); end - - # Describes what follows each expression in a template pattern. - # - # @param [String] escaped_pattern The escaped URI template pattern. - # - # @return [Array] For each expression, the MatchData of - # the expression directly after it (or nil), and whether the - # text after it could start with a comma. - # - # pkg:gem/addressable#lib/addressable/template.rb:979 - def expression_followers(escaped_pattern); end - - # Takes a set of values, and joins them together based on the - # operator. - # - # @param [String, Nil] operator One of the operators from the set - # (?,&,+,#,;,/,.), or nil if there wasn't one. - # @param [Array] return_value - # The set of return values (as [variable_name, value] tuples) that will - # be joined together. - # - # @return [String] The transformed mapped value - # - # pkg:gem/addressable#lib/addressable/template.rb:873 - def join_values(operator, return_value); end - - # Whether an expression could match a string that starts with a comma. - # - # @param [String, nil] operator The expression's operator. - # @param [String] varlist The expression's variable list. - # - # @return [TrueClass, FalseClass] - # - # pkg:gem/addressable#lib/addressable/template.rb:1005 - def may_start_with_comma?(operator, varlist); end - - # Generates a hash with string keys - # - # @param [Hash] mapping A mapping hash to normalize - # - # @return [Hash] - # A hash with stringified keys - # - # pkg:gem/addressable#lib/addressable/template.rb:936 - def normalize_keys(mapping); end - - # Takes a set of values, and joins them together based on the - # operator. - # - # @param [Hash, Array, String] value - # Normalizes unicode keys and values with String#unicode_normalize (NFC) - # - # @return [Hash, Array, String] The normalized values - # - # pkg:gem/addressable#lib/addressable/template.rb:910 - def normalize_value(value); end - - # pkg:gem/addressable#lib/addressable/template.rb:668 - def ordered_variable_defaults; end - - # Generates the Regexp that parses a template pattern. - # - # @param [String] pattern The URI template pattern. - # @param [#match] processor The template processor to use. - # - # @return [Array, Regexp] - # An array of expansion variables nad a regular expression which may be - # used to parse a template pattern - # - # pkg:gem/addressable#lib/addressable/template.rb:1051 - def parse_new_template_pattern(pattern, processor = T.unsafe(nil)); end - - # Generates the Regexp that parses a template pattern. Memoizes the - # value if template processor not set (processors may not be deterministic) - # - # @param [String] pattern The URI template pattern. - # @param [#match] processor The template processor to use. - # - # @return [Array, Regexp] - # An array of expansion variables nad a regular expression which may be - # used to parse a template pattern - # - # pkg:gem/addressable#lib/addressable/template.rb:962 - def parse_template_pattern(pattern, processor = T.unsafe(nil)); end - - # Transforms a mapped value so that values can be substituted into the - # template. - # - # @param [Hash] mapping The mapping to replace captures - # @param [String] capture - # The expression to replace - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError exception - # will be raised if the value is invalid. The transform method - # should return the transformed variable value as a String. If a - # transform method is used, the value will not be percent encoded - # automatically. Unicode normalization will be performed both before and - # after sending the value to the transform method. - # - # @return [String] The expanded expression - # - # pkg:gem/addressable#lib/addressable/template.rb:765 - def transform_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end - - # Loops through each capture and expands any values available in mapping - # - # @param [Hash] mapping - # Set of keys to expand - # @param [String] capture - # The expression to expand - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError exception - # will be raised if the value is invalid. The transform method - # should return the transformed variable value as a String. If a - # transform method is used, the value will not be percent encoded - # automatically. Unicode normalization will be performed both before and - # after sending the value to the transform method. - # - # @return [String] The expanded expression - # - # pkg:gem/addressable#lib/addressable/template.rb:706 - def transform_partial_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end -end - -# pkg:gem/addressable#lib/addressable/template.rb:60 -Addressable::Template::EXPRESSION = T.let(T.unsafe(nil), Regexp) - -# Raised if an invalid template operator is used in a pattern. -# -# pkg:gem/addressable#lib/addressable/template.rb:87 -class Addressable::Template::InvalidTemplateOperatorError < ::StandardError; end - -# Raised if an invalid template value is supplied. -# -# pkg:gem/addressable#lib/addressable/template.rb:82 -class Addressable::Template::InvalidTemplateValueError < ::StandardError; end - -# pkg:gem/addressable#lib/addressable/template.rb:72 -Addressable::Template::JOINERS = T.let(T.unsafe(nil), Hash) - -# pkg:gem/addressable#lib/addressable/template.rb:64 -Addressable::Template::LEADERS = T.let(T.unsafe(nil), Hash) - -# This class represents the data that is extracted when a Template -# is matched against a URI. -# -# pkg:gem/addressable#lib/addressable/template.rb:98 -class Addressable::Template::MatchData - # Creates a new MatchData object. - # MatchData objects should never be instantiated directly. - # - # @param [Addressable::URI] uri - # The URI that the template was matched against. - # - # pkg:gem/addressable#lib/addressable/template.rb:105 - def initialize(uri, template, mapping); end - - # Accesses captured values by name or by index. - # - # @param [String, Symbol, Fixnum] key - # Capture index or name. Note that when accessing by with index - # of 0, the full URI will be returned. The intention is to mimic - # the ::MatchData#[] behavior. - # - # @param [#to_int, nil] len - # If provided, an array of values will be returned with the given - # parameter used as length. - # - # @return [Array, String, nil] - # The captured value corresponding to the index or name. If the - # value was not provided or the key is unknown, nil will be - # returned. - # - # If the second parameter is provided, an array of that length will - # be returned instead. - # - # pkg:gem/addressable#lib/addressable/template.rb:172 - def [](key, len = T.unsafe(nil)); end - - # pkg:gem/addressable#lib/addressable/template.rb:151 - def captures; end - - # Returns a String representation of the MatchData's state. - # - # @return [String] The MatchData's state, as a String. - # - # pkg:gem/addressable#lib/addressable/template.rb:215 - def inspect; end - - # pkg:gem/addressable#lib/addressable/template.rb:137 - def keys; end - - # @return [Hash] - # The mapping that resulted from the match. - # Note that this mapping does not include keys or values for - # variables that appear in the Template, but are not present - # in the URI. - # - # pkg:gem/addressable#lib/addressable/template.rb:127 - def mapping; end - - # pkg:gem/addressable#lib/addressable/template.rb:138 - def names; end - - # pkg:gem/addressable#lib/addressable/template.rb:227 - def post_match; end - - # Dummy method for code expecting a ::MatchData instance - # - # @return [String] An empty string. - # - # pkg:gem/addressable#lib/addressable/template.rb:224 - def pre_match; end - - # pkg:gem/addressable#lib/addressable/template.rb:196 - def string; end - - # @return [Addressable::Template] - # The Template used for the match. - # - # pkg:gem/addressable#lib/addressable/template.rb:119 - def template; end - - # @return [Array] - # Array with the matched URI as first element followed by the captured - # values. - # - # pkg:gem/addressable#lib/addressable/template.rb:186 - def to_a; end - - # @return [String] - # The matched URI as String. - # - # pkg:gem/addressable#lib/addressable/template.rb:193 - def to_s; end - - # @return [Addressable::URI] - # The URI that the Template was matched against. - # - # pkg:gem/addressable#lib/addressable/template.rb:114 - def uri; end - - # @return [Array] - # The list of values that were captured by the Template. - # Note that this list will include nils for any variables which - # were in the Template, but did not appear in the URI. - # - # pkg:gem/addressable#lib/addressable/template.rb:145 - def values; end - - # Returns multiple captured values at once. - # - # @param [String, Symbol, Fixnum] *indexes - # Indices of the captures to be returned - # - # @return [Array] - # Values corresponding to given indices. - # - # @see Addressable::Template::MatchData#[] - # - # pkg:gem/addressable#lib/addressable/template.rb:207 - def values_at(*indexes); end - - # @return [Array] - # The list of variables that were present in the Template. - # Note that this list will include variables which do not appear - # in the mapping because they were not present in URI. - # - # pkg:gem/addressable#lib/addressable/template.rb:134 - def variables; end -end - -# pkg:gem/addressable#lib/addressable/template.rb:40 -Addressable::Template::RESERVED = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/template.rb:42 -Addressable::Template::RESERVED_NO_COMMA = T.let(T.unsafe(nil), String) - -# Raised if an invalid template operator is used in a pattern. -# -# pkg:gem/addressable#lib/addressable/template.rb:92 -class Addressable::Template::TemplateOperatorAbortedError < ::StandardError; end - -# pkg:gem/addressable#lib/addressable/template.rb:44 -Addressable::Template::UNRESERVED = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/template.rb:56 -Addressable::Template::VARIABLE_LIST = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/template.rb:52 -Addressable::Template::VARNAME = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/template.rb:54 -Addressable::Template::VARSPEC = T.let(T.unsafe(nil), Regexp) - -# This is an implementation of a URI parser based on -# RFC 3986, -# RFC 3987. -# -# pkg:gem/addressable#lib/addressable/uri.rb:31 -class Addressable::URI - # Creates a new uri object from component parts. - # - # @option [String, #to_str] scheme The scheme component. - # @option [String, #to_str] user The user component. - # @option [String, #to_str] password The password component. - # @option [String, #to_str] userinfo - # The userinfo component. If this is supplied, the user and password - # components must be omitted. - # @option [String, #to_str] host The host component. - # @option [String, #to_str] port The port component. - # @option [String, #to_str] authority - # The authority component. If this is supplied, the user, password, - # userinfo, host, and port components must be omitted. - # @option [String, #to_str] path The path component. - # @option [String, #to_str] query The query component. - # @option [String, #to_str] fragment The fragment component. - # - # @return [Addressable::URI] The constructed URI object. - # - # pkg:gem/addressable#lib/addressable/uri.rb:830 - def initialize(options = T.unsafe(nil)); end - - # pkg:gem/addressable#lib/addressable/uri.rb:1991 - def +(uri); end - - # Returns true if the URI objects are equal. This method - # normalizes both URIs before doing the comparison. - # - # @param [Object] uri The URI to compare. - # - # @return [TrueClass, FalseClass] - # true if the URIs are equivalent, false - # otherwise. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2253 - def ==(uri); end - - # Returns true if the URI objects are equal. This method - # normalizes both URIs before doing the comparison, and allows comparison - # against Strings. - # - # @param [Object] uri The URI to compare. - # - # @return [TrueClass, FalseClass] - # true if the URIs are equivalent, false - # otherwise. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2231 - def ===(uri); end - - # Determines if the URI is absolute. - # - # @return [TrueClass, FalseClass] - # true if the URI is absolute. false - # otherwise. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1888 - def absolute?; end - - # The authority component for this URI. - # Combines the user, password, host, and port components. - # - # @return [String] The authority component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1241 - def authority; end - - # Sets the authority component for this URI. - # - # @param [String, #to_str] new_authority The new authority component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1281 - def authority=(new_authority); end - - # The basename, if any, of the file in the path component. - # - # @return [String] The path's basename. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1599 - def basename; end - - # The default port for this URI's scheme. - # This method will always returns the default port for the URI's scheme - # regardless of the presence of an explicit port in the URI. - # - # @return [Integer] The default port. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1465 - def default_port; end - - # This method allows you to make several changes to a URI simultaneously, - # which separately would cause validation errors, but in conjunction, - # are valid. The URI will be revalidated as soon as the entire block has - # been executed. - # - # @param [Proc] block - # A set of operations to perform on a given URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2410 - def defer_validation; end - - # Creates a URI suitable for display to users. If semantic attacks are - # likely, the application should try to detect these and warn the user. - # See RFC 3986, - # section 7.6 for more information. - # - # @return [Addressable::URI] A URI suitable for display purposes. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2215 - def display_uri; end - - # Returns the public suffix domain for this host. - # - # @example - # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk" - # - # pkg:gem/addressable#lib/addressable/uri.rb:1232 - def domain; end - - # Clones the URI object. - # - # @return [Addressable::URI] The cloned URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2285 - def dup; end - - # Determines if the URI is an empty string. - # - # @return [TrueClass, FalseClass] - # Returns true if empty, false otherwise. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2347 - def empty?; end - - # pkg:gem/addressable#lib/addressable/uri.rb:2422 - def encode_with(coder); end - - # Returns true if the URI objects are equal. This method - # does NOT normalize either URI before doing the comparison. - # - # @param [Object] uri The URI to compare. - # - # @return [TrueClass, FalseClass] - # true if the URIs are equivalent, false - # otherwise. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2267 - def eql?(uri); end - - # The extname, if any, of the file in the path component. - # Empty string if there is no extension. - # - # @return [String] The path's extname. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1609 - def extname; end - - # The fragment component for this URI. - # - # @return [String] The fragment component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1819 - def fragment; end - - # Sets the fragment component for this URI. - # - # @param [String, #to_str] new_fragment The new fragment component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1844 - def fragment=(new_fragment); end - - # Freeze URI, initializing instance variables. - # - # @return [Addressable::URI] The frozen URI object. - # - # pkg:gem/addressable#lib/addressable/uri.rb:870 - def freeze; end - - # A hash value that will make a URI equivalent to its normalized - # form. - # - # @return [Integer] A hash of the URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2277 - def hash; end - - # The host component for this URI. - # - # @return [String] The host component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1127 - def host; end - - # Sets the host component for this URI. - # - # @param [String, #to_str] new_host The new host component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1163 - def host=(new_host); end - - # This method is same as URI::Generic#host except - # brackets for IPv6 (and 'IPvFuture') addresses are removed. - # - # @see Addressable::URI#host - # - # @return [String] The hostname for this URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1185 - def hostname; end - - # This method is same as URI::Generic#host= except - # the argument can be a bare IPv6 address (or 'IPvFuture'). - # - # @see Addressable::URI#host= - # - # @param [String, #to_str] new_hostname The new hostname for this URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1197 - def hostname=(new_hostname); end - - # The inferred port component for this URI. - # This method will normalize to the default port for the URI's scheme if - # the port isn't explicitly specified in the URI. - # - # @return [Integer] The inferred port component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1451 - def inferred_port; end - - # pkg:gem/addressable#lib/addressable/uri.rb:2433 - def init_with(coder); end - - # Returns a String representation of the URI object's state. - # - # @return [String] The URI object's state, as a String. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2398 - def inspect; end - - # Determines if the scheme indicates an IP-based protocol. - # - # @return [TrueClass, FalseClass] - # true if the scheme indicates an IP-based protocol. - # false otherwise. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1864 - def ip_based?; end - - # Joins two URIs together. - # - # @param [String, Addressable::URI, #to_str] The URI to join with. - # - # @return [Addressable::URI] The joined URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1898 - def join(uri); end - - # Destructive form of join. - # - # @param [String, Addressable::URI, #to_str] The URI to join with. - # - # @return [Addressable::URI] The joined URI. - # - # @see Addressable::URI#join - # - # pkg:gem/addressable#lib/addressable/uri.rb:2001 - def join!(uri); end - - # Merges a URI with a Hash of components. - # This method has different behavior from join. Any - # components present in the hash parameter will override the - # original components. The path component is not treated specially. - # - # @param [Hash, Addressable::URI, #to_hash] The components to merge with. - # - # @return [Addressable::URI] The merged URI. - # - # @see Hash#merge - # - # pkg:gem/addressable#lib/addressable/uri.rb:2016 - def merge(hash); end - - # Destructive form of merge. - # - # @param [Hash, Addressable::URI, #to_hash] The components to merge with. - # - # @return [Addressable::URI] The merged URI. - # - # @see Addressable::URI#merge - # - # pkg:gem/addressable#lib/addressable/uri.rb:2081 - def merge!(uri); end - - # Returns a normalized URI object. - # - # NOTE: This method does not attempt to fully conform to specifications. - # It exists largely to correct other people's failures to read the - # specifications, and also to deal with caching issues since several - # different URIs may represent the same resource and should not be - # cached multiple times. - # - # @return [Addressable::URI] The normalized URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2178 - def normalize; end - - # Destructively normalizes this URI object. - # - # @return [Addressable::URI] The normalized URI. - # - # @see Addressable::URI#normalize - # - # pkg:gem/addressable#lib/addressable/uri.rb:2204 - def normalize!; end - - # The authority component for this URI, normalized. - # - # @return [String] The authority component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1259 - def normalized_authority; end - - # The fragment component for this URI, normalized. - # - # @return [String] The fragment component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1825 - def normalized_fragment; end - - # The host component for this URI, normalized. - # - # @return [String] The host component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1133 - def normalized_host; end - - # The password component for this URI, normalized. - # - # @return [String] The password component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1008 - def normalized_password; end - - # The path component for this URI, normalized. - # - # @return [String] The path component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1546 - def normalized_path; end - - # The port component for this URI, normalized. - # - # @return [Integer] The port component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1403 - def normalized_port; end - - # The query component for this URI, normalized. - # - # @return [String] The query component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1624 - def normalized_query(*flags); end - - # The scheme component for this URI, normalized. - # - # @return [String] The scheme component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:896 - def normalized_scheme; end - - # The normalized combination of components that represent a site. - # Combines the scheme, user, password, host, and port components. - # Primarily useful for HTTP and HTTPS. - # - # For example, "http://example.com/path?query" would have a - # site value of "http://example.com". - # - # @return [String] The normalized components that identify a site. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1496 - def normalized_site; end - - # The user component for this URI, normalized. - # - # @return [String] The user component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:952 - def normalized_user; end - - # The userinfo component for this URI, normalized. - # - # @return [String] The userinfo component, normalized. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1075 - def normalized_userinfo; end - - # Omits components from a URI. - # - # @param [Symbol] *components The components to be omitted. - # - # @return [Addressable::URI] The URI with components omitted. - # - # @example - # uri = Addressable::URI.parse("http://example.com/path?query") - # #=> # - # uri.omit(:scheme, :authority) - # #=> # - # - # pkg:gem/addressable#lib/addressable/uri.rb:2311 - def omit(*components); end - - # Destructive form of omit. - # - # @param [Symbol] *components The components to be omitted. - # - # @return [Addressable::URI] The URI with components omitted. - # - # @see Addressable::URI#omit - # - # pkg:gem/addressable#lib/addressable/uri.rb:2338 - def omit!(*components); end - - # The origin for this URI, serialized to ASCII, as per - # RFC 6454, section 6.2. - # - # @return [String] The serialized origin. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1321 - def origin; end - - # Sets the origin for this URI, serialized to ASCII, as per - # RFC 6454, section 6.2. This assignment will reset the `userinfo` - # component. - # - # @param [String, #to_str] new_origin The new origin component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1340 - def origin=(new_origin); end - - # The password component for this URI. - # - # @return [String] The password component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1002 - def password; end - - # Sets the password component for this URI. - # - # @param [String, #to_str] new_password The new password component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1031 - def password=(new_password); end - - # The path component for this URI. - # - # @return [String] The path component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1539 - def path; end - - # Sets the path component for this URI. - # - # @param [String, #to_str] new_path The new path component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1578 - def path=(new_path); end - - # The port component for this URI. - # This is the port number actually given in the URI. This does not - # infer port numbers from default values. - # - # @return [Integer] The port component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1397 - def port; end - - # Sets the port component for this URI. - # - # @param [String, Integer, #to_s] new_port The new port component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1419 - def port=(new_port); end - - # The query component for this URI. - # - # @return [String] The query component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1618 - def query; end - - # Sets the query component for this URI. - # - # @param [String, #to_str] new_query The new query component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1650 - def query=(new_query); end - - # Converts the query component to a Hash value. - # - # @param [Class] return_type The return type desired. Value must be either - # `Hash` or `Array`. - # - # @return [Hash, Array, nil] The query string parsed as a Hash or Array - # or nil if the query string is blank. - # - # @example - # Addressable::URI.parse("?one=1&two=2&three=3").query_values - # #=> {"one" => "1", "two" => "2", "three" => "3"} - # Addressable::URI.parse("?one=two&one=three").query_values(Array) - # #=> [["one", "two"], ["one", "three"]] - # Addressable::URI.parse("?one=two&one=three").query_values(Hash) - # #=> {"one" => "three"} - # Addressable::URI.parse("?").query_values - # #=> {} - # Addressable::URI.parse("").query_values - # #=> nil - # - # pkg:gem/addressable#lib/addressable/uri.rb:1681 - def query_values(return_type = T.unsafe(nil)); end - - # Sets the query component for this URI from a Hash object. - # An empty Hash or Array will result in an empty query string. - # - # @param [Hash, #to_hash, Array] new_query_values The new query values. - # - # @example - # uri.query_values = {:a => "a", :b => ["c", "d", "e"]} - # uri.query - # # => "a=a&b=c&b=d&b=e" - # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']] - # uri.query - # # => "a=a&b=c&b=d&b=e" - # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]] - # uri.query - # # => "a=a&b=c&b=d&b=e" - # uri.query_values = [['flag'], ['key', 'value']] - # uri.query - # # => "flag&key=value" - # - # pkg:gem/addressable#lib/addressable/uri.rb:1732 - def query_values=(new_query_values); end - - # Determines if the URI is relative. - # - # @return [TrueClass, FalseClass] - # true if the URI is relative. false - # otherwise. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1878 - def relative?; end - - # The HTTP request URI for this URI. This is the path and the - # query string. - # - # @return [String] The request URI required for an HTTP request. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1783 - def request_uri; end - - # Sets the HTTP request URI for this URI. - # - # @param [String, #to_str] new_request_uri The new HTTP request URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1795 - def request_uri=(new_request_uri); end - - # Returns the shortest normalized relative form of this URI that uses the - # supplied URI as a base for resolution. Returns an absolute URI if - # necessary. This is effectively the opposite of route_to. - # - # @param [String, Addressable::URI, #to_str] uri The URI to route from. - # - # @return [Addressable::URI] - # The normalized relative URI that is equivalent to the original URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2094 - def route_from(uri); end - - # Returns the shortest normalized relative form of the supplied URI that - # uses this URI as a base for resolution. Returns an absolute URI if - # necessary. This is effectively the opposite of route_from. - # - # @param [String, Addressable::URI, #to_str] uri The URI to route to. - # - # @return [Addressable::URI] - # The normalized relative URI that is equivalent to the supplied URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2164 - def route_to(uri); end - - # The scheme component for this URI. - # - # @return [String] The scheme component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:890 - def scheme; end - - # Sets the scheme component for this URI. - # - # @param [String, #to_str] new_scheme The new scheme component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:917 - def scheme=(new_scheme); end - - # The combination of components that represent a site. - # Combines the scheme, user, password, host, and port components. - # Primarily useful for HTTP and HTTPS. - # - # For example, "http://example.com/path?query" would have a - # site value of "http://example.com". - # - # @return [String] The components that identify a site. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1478 - def site; end - - # Sets the site value for this URI. - # - # @param [String, #to_str] new_site The new site value. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1517 - def site=(new_site); end - - # Returns the top-level domain for this host. - # - # @example - # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk" - # - # pkg:gem/addressable#lib/addressable/uri.rb:1214 - def tld; end - - # Sets the top-level domain for this URI. - # - # @param [String, #to_str] new_tld The new top-level domain. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1222 - def tld=(new_tld); end - - # Returns a Hash of the URI components. - # - # @return [Hash] The URI as a Hash of components. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2381 - def to_hash; end - - # Converts the URI to a String. - # - # @return [String] The URI's String representation. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2355 - def to_s; end - - # URI's are glorified Strings. Allow implicit conversion. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2375 - def to_str; end - - # The user component for this URI. - # - # @return [String] The user component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:946 - def user; end - - # Sets the user component for this URI. - # - # @param [String, #to_str] new_user The new user component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:975 - def user=(new_user); end - - # The userinfo component for this URI. - # Combines the user and password components. - # - # @return [String] The userinfo component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1059 - def userinfo; end - - # Sets the userinfo component for this URI. - # - # @param [String, #to_str] new_userinfo The new userinfo component. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1098 - def userinfo=(new_userinfo); end - - protected - - # Converts the string to be UTF-8 if it is not already UTF-8 - # - # @api private - # - # pkg:gem/addressable#lib/addressable/uri.rb:2599 - def force_utf8_encoding_if_needed(str); end - - # Resets composite values for the entire URI - # - # @api private - # - # pkg:gem/addressable#lib/addressable/uri.rb:2587 - def remove_composite_values; end - - # Replaces the internal state of self with the specified URI's state. - # Used in destructive operations to avoid massive code repetition. - # - # @param [Addressable::URI] uri The URI to replace self with. - # - # @return [Addressable::URI] self. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2554 - def replace_self(uri); end - - # Splits path string with "/" (slash). - # It is considered that there is empty string after last slash when - # path ends with slash. - # - # @param [String] path The path to split. - # - # @return [Array] An array of parts of path. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2577 - def split_path(path); end - - # Ensures that the URI is valid. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2511 - def validate; end - - private - - # pkg:gem/addressable#lib/addressable/uri.rb:2607 - def initialize_copy(other); end - - # Resets instance variables - # - # @api private - # - # pkg:gem/addressable#lib/addressable/uri.rb:2619 - def reset_ivs; end - - class << self - # Converts a path to a file scheme URI. If the path supplied is - # relative, it will be returned as a relative URI. If the path supplied - # is actually a non-file URI, it will parse the URI as if it had been - # parsed with Addressable::URI.parse. Handles all of the - # various Microsoft-specific formats for specifying paths. - # - # @param [String, Addressable::URI, #to_str] path - # Typically a String path to a file or directory, but - # will return a sensible return value if an absolute URI is supplied - # instead. - # - # @return [Addressable::URI] - # The parsed file scheme URI or the original URI if some other URI - # scheme was provided. - # - # @example - # base = Addressable::URI.convert_path("/absolute/path/") - # uri = Addressable::URI.convert_path("relative/path") - # (base + uri).to_s - # #=> "file:///absolute/path/relative/path" - # - # Addressable::URI.convert_path( - # "c:\\windows\\My Documents 100%20\\foo.txt" - # ).to_s - # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt" - # - # Addressable::URI.convert_path("http://example.com/").to_s - # #=> "http://example.com/" - # - # pkg:gem/addressable#lib/addressable/uri.rb:292 - def convert_path(path); end - - # Percent encodes any special characters in the URI. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI to encode. - # - # @param [Class] return_type - # The type of object to return. - # This value may only be set to String or - # Addressable::URI. All other values are invalid. Defaults - # to String. - # - # @return [String, Addressable::URI] - # The encoded URI. - # The return type is determined by the return_type - # parameter. - # - # pkg:gem/addressable#lib/addressable/uri.rb:616 - def encode(uri, return_type = T.unsafe(nil)); end - - # Percent encodes a URI component. - # - # @param [String, #to_str] component The URI component to encode. - # - # @param [String, Regexp] character_class - # The characters which are not percent encoded. If a String - # is passed, the String must be formatted as a regular - # expression character class. (Do not include the surrounding square - # brackets.) For example, "b-zB-Z0-9" would cause - # everything but the letters 'b' through 'z' and the numbers '0' through - # '9' to be percent encoded. If a Regexp is passed, the - # value /[^b-zB-Z0-9]/ would have the same effect. A set of - # useful String values may be found in the - # Addressable::URI::CharacterClasses module. The default - # value is the reserved plus unreserved character classes specified in - # RFC 3986. - # - # @param [Regexp] upcase_encoded - # A string of characters that may already be percent encoded, and whose - # encodings should be upcased. This allows normalization of percent - # encodings for characters not included in the - # character_class. - # - # @return [String] The encoded component. - # - # @example - # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") - # => "simple%2Fex%61mple" - # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) - # => "simple%2Fex%61mple" - # Addressable::URI.encode_component( - # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED - # ) - # => "simple%2Fexample" - # - # pkg:gem/addressable#lib/addressable/uri.rb:403 - def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end - - # pkg:gem/addressable#lib/addressable/uri.rb:651 - def escape(uri, return_type = T.unsafe(nil)); end - - # pkg:gem/addressable#lib/addressable/uri.rb:446 - def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end - - # Encodes a set of key/value pairs according to the rules for the - # application/x-www-form-urlencoded MIME type. - # - # @param [#to_hash, #to_ary] form_values - # The form values to encode. - # - # @param [TrueClass, FalseClass] sort - # Sort the key/value pairs prior to encoding. - # Defaults to false. - # - # @return [String] - # The encoded value. - # - # pkg:gem/addressable#lib/addressable/uri.rb:740 - def form_encode(form_values, sort = T.unsafe(nil)); end - - # Decodes a String according to the rules for the - # application/x-www-form-urlencoded MIME type. - # - # @param [String, #to_str] encoded_value - # The form values to decode. - # - # @return [Array] - # The decoded values. - # This is not a Hash because of the possibility for - # duplicate keys. - # - # pkg:gem/addressable#lib/addressable/uri.rb:793 - def form_unencode(encoded_value); end - - # Converts an input to a URI. The input does not have to be a valid - # URI — the method will use heuristics to guess what URI was intended. - # This is not standards-compliant, merely user-friendly. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI string to parse. - # No parsing is performed if the object is already an - # Addressable::URI. - # @param [Hash] hints - # A Hash of hints to the heuristic parser. - # Defaults to {:scheme => "http"}. - # - # @return [Addressable::URI] The parsed URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:191 - def heuristic_parse(uri, hints = T.unsafe(nil)); end - - # Returns an array of known ip-based schemes. These schemes typically - # use a similar URI form: - # //:@:/ - # - # pkg:gem/addressable#lib/addressable/uri.rb:1380 - def ip_based_schemes; end - - # Joins several URIs together. - # - # @param [String, Addressable::URI, #to_str] *uris - # The URIs to join. - # - # @return [Addressable::URI] The joined URI. - # - # @example - # base = "http://example.com/" - # uri = Addressable::URI.parse("relative/path") - # Addressable::URI.join(base, uri) - # #=> # - # - # pkg:gem/addressable#lib/addressable/uri.rb:343 - def join(*uris); end - - # Normalizes the encoding of a URI component. - # - # @param [String, #to_str] component The URI component to encode. - # - # @param [String, Regexp] character_class - # The characters which are not percent encoded. If a String - # is passed, the String must be formatted as a regular - # expression character class. (Do not include the surrounding square - # brackets.) For example, "b-zB-Z0-9" would cause - # everything but the letters 'b' through 'z' and the numbers '0' - # through '9' to be percent encoded. If a Regexp is passed, - # the value /[^b-zB-Z0-9]/ would have the same effect. A - # set of useful String values may be found in the - # Addressable::URI::CharacterClasses module. The default - # value is the reserved plus unreserved character classes specified in - # RFC 3986. - # - # @param [String] leave_encoded - # When character_class is a String then - # leave_encoded is a string of characters that should remain - # percent encoded while normalizing the component; if they appear percent - # encoded in the original component, then they will be upcased ("%2f" - # normalized to "%2F") but otherwise left alone. - # - # @return [String] The normalized component. - # - # @example - # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z") - # => "simple%2Fex%61mple" - # Addressable::URI.normalize_component( - # "simpl%65/%65xampl%65", /[^b-zB-Z]/ - # ) - # => "simple%2Fex%61mple" - # Addressable::URI.normalize_component( - # "simpl%65/%65xampl%65", - # Addressable::URI::CharacterClasses::UNRESERVED - # ) - # => "simple%2Fexample" - # Addressable::URI.normalize_component( - # "one%20two%2fthree%26four", - # "0-9a-zA-Z &/", - # "/" - # ) - # => "one two%2Fthree&four" - # - # pkg:gem/addressable#lib/addressable/uri.rb:552 - def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end - - # Resolves paths to their simplest form. - # - # @param [String] path The path to normalize. - # - # @return [String] The normalized path. - # - # pkg:gem/addressable#lib/addressable/uri.rb:2460 - def normalize_path(path); end - - # Normalizes the encoding of a URI. Characters within a hostname are - # not percent encoded to allow for internationalized domain names. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI to encode. - # - # @param [Class] return_type - # The type of object to return. - # This value may only be set to String or - # Addressable::URI. All other values are invalid. Defaults - # to String. - # - # @return [String, Addressable::URI] - # The encoded URI. - # The return type is determined by the return_type - # parameter. - # - # pkg:gem/addressable#lib/addressable/uri.rb:671 - def normalized_encode(uri, return_type = T.unsafe(nil)); end - - # Returns a URI object based on the parsed string. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI string to parse. - # No parsing is performed if the object is already an - # Addressable::URI. - # - # @return [Addressable::URI] The parsed URI. - # - # pkg:gem/addressable#lib/addressable/uri.rb:114 - def parse(uri); end - - # Returns a hash of common IP-based schemes and their default port - # numbers. Adding new schemes to this hash, as necessary, will allow - # for better URI normalization. - # - # pkg:gem/addressable#lib/addressable/uri.rb:1387 - def port_mapping; end - - # Unencodes any percent encoded characters within a URI component. - # This method may be used for unencoding either components or full URIs, - # however, it is recommended to use the unencode_component - # alias when unencoding components. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI or component to unencode. - # - # @param [Class] return_type - # The type of object to return. - # This value may only be set to String or - # Addressable::URI. All other values are invalid. Defaults - # to String. - # - # @param [String] leave_encoded - # A string of characters to leave encoded. If a percent encoded character - # in this list is encountered then it will remain percent encoded. - # - # @return [String, Addressable::URI] - # The unencoded component or URI. - # The return type is determined by the return_type - # parameter. - # - # pkg:gem/addressable#lib/addressable/uri.rb:472 - def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end - - # pkg:gem/addressable#lib/addressable/uri.rb:502 - def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end - - # pkg:gem/addressable#lib/addressable/uri.rb:501 - def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end - - # pkg:gem/addressable#lib/addressable/uri.rb:503 - def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end - end -end - -# Container for the character classes specified in -# RFC 3986. -# -# Note: Concatenated and interpolated `String`s are not affected by the -# `frozen_string_literal` directive and must be frozen explicitly. -# -# Interpolated `String`s *were* frozen this way before Ruby 3.0: -# https://bugs.ruby-lang.org/issues/17104 -# -# pkg:gem/addressable#lib/addressable/uri.rb:46 -module Addressable::URI::CharacterClasses; end - -# pkg:gem/addressable#lib/addressable/uri.rb:47 -Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:57 -Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:48 -Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:60 -Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:49 -Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:56 -Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:58 -Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:54 -Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:59 -Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:51 -Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:53 -Addressable::URI::CharacterClasses::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:55 -Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:50 -Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:52 -Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:72 -module Addressable::URI::CharacterClassesRegexps; end - -# pkg:gem/addressable#lib/addressable/uri.rb:73 -Addressable::URI::CharacterClassesRegexps::AUTHORITY = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:74 -Addressable::URI::CharacterClassesRegexps::FRAGMENT = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:75 -Addressable::URI::CharacterClassesRegexps::HOST = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:76 -Addressable::URI::CharacterClassesRegexps::PATH = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:77 -Addressable::URI::CharacterClassesRegexps::QUERY = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:78 -Addressable::URI::CharacterClassesRegexps::RESERVED = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:79 -Addressable::URI::CharacterClassesRegexps::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:80 -Addressable::URI::CharacterClassesRegexps::SCHEME = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:81 -Addressable::URI::CharacterClassesRegexps::UNRESERVED = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:85 -Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String) - -# Raised if something other than a uri is supplied. -# -# pkg:gem/addressable#lib/addressable/uri.rb:34 -class Addressable::URI::InvalidURIError < ::StandardError; end - -# pkg:gem/addressable#lib/addressable/uri.rb:2646 -module Addressable::URI::NONE; end - -# pkg:gem/addressable#lib/addressable/uri.rb:1541 -Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:63 -module Addressable::URI::NormalizeCharacterClasses; end - -# pkg:gem/addressable#lib/addressable/uri.rb:68 -Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:64 -Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:66 -Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:69 -Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:67 -Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:65 -Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:2443 -Addressable::URI::PARENT = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:89 -Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash) - -# Deprecated. No longer used by normalize_path; will be removed in 2.10.0. -# -# pkg:gem/addressable#lib/addressable/uri.rb:2446 -Addressable::URI::RULE_2A = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:2447 -Addressable::URI::RULE_2B_2C = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:2448 -Addressable::URI::RULE_2D = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:2449 -Addressable::URI::RULE_PREFIXED_PARENT = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/uri.rb:2442 -Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String) - -# Tables used to optimize encoding operations in `self.encode_component` -# and `self.normalize_component` -# -# pkg:gem/addressable#lib/addressable/uri.rb:360 -Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Array) - -# pkg:gem/addressable#lib/addressable/uri.rb:364 -Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Array) - -# pkg:gem/addressable#lib/addressable/uri.rb:84 -Addressable::URI::SLASH = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/uri.rb:87 -Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/addressable#lib/addressable/version.rb:23 -module Addressable::VERSION; end - -# pkg:gem/addressable#lib/addressable/version.rb:24 -Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/version.rb:25 -Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer) - -# pkg:gem/addressable#lib/addressable/version.rb:28 -Addressable::VERSION::STRING = T.let(T.unsafe(nil), String) - -# pkg:gem/addressable#lib/addressable/version.rb:26 -Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer) diff --git a/sorbet/rbi/gems/connection_pool@3.0.2.rbi b/sorbet/rbi/gems/connection_pool@3.0.3.rbi similarity index 83% rename from sorbet/rbi/gems/connection_pool@3.0.2.rbi rename to sorbet/rbi/gems/connection_pool@3.0.3.rbi index 0e131785..1a9b45d1 100644 --- a/sorbet/rbi/gems/connection_pool@3.0.2.rbi +++ b/sorbet/rbi/gems/connection_pool@3.0.3.rbi @@ -36,19 +36,19 @@ # # pkg:gem/connection_pool#lib/connection_pool/version.rb:1 class ConnectionPool - # pkg:gem/connection_pool#lib/connection_pool.rb:48 - def initialize(timeout: T.unsafe(nil), size: T.unsafe(nil), auto_reload_after_fork: T.unsafe(nil), name: T.unsafe(nil), &); end + # pkg:gem/connection_pool#lib/connection_pool.rb:53 + def initialize(timeout: T.unsafe(nil), size: T.unsafe(nil), auto_reload_after_fork: T.unsafe(nil), name: T.unsafe(nil), &block); end # Number of pool entries available for checkout at this instant. # - # pkg:gem/connection_pool#lib/connection_pool.rb:173 + # pkg:gem/connection_pool#lib/connection_pool.rb:186 def available; end - # pkg:gem/connection_pool#lib/connection_pool.rb:123 + # pkg:gem/connection_pool#lib/connection_pool.rb:132 def checkin(force: T.unsafe(nil)); end - # pkg:gem/connection_pool#lib/connection_pool.rb:111 - def checkout(timeout: T.unsafe(nil), **); end + # pkg:gem/connection_pool#lib/connection_pool.rb:119 + def checkout(timeout: T.unsafe(nil), **kwargs); end # Marks the current thread's checked-out connection for discard. # @@ -80,52 +80,57 @@ class ConnectionPool # end # end # - # pkg:gem/connection_pool#lib/connection_pool.rb:107 + # pkg:gem/connection_pool#lib/connection_pool.rb:115 def discard_current_connection(&block); end # Number of pool entries created and idle in the pool. # - # pkg:gem/connection_pool#lib/connection_pool.rb:178 + # pkg:gem/connection_pool#lib/connection_pool.rb:191 def idle; end # Reaps idle connections that have been idle for over +idle_seconds+. # +idle_seconds+ defaults to 60. # - # pkg:gem/connection_pool#lib/connection_pool.rb:168 - def reap(idle_seconds: T.unsafe(nil), &); end + # pkg:gem/connection_pool#lib/connection_pool.rb:181 + def reap(idle_seconds: T.unsafe(nil), &block); end # Reloads the ConnectionPool by passing each connection to +block+ and then # removing it the pool. Subsequent checkouts will create new connections as # needed. # - # pkg:gem/connection_pool#lib/connection_pool.rb:162 - def reload(&); end + # pkg:gem/connection_pool#lib/connection_pool.rb:175 + def reload(&block); end # Shuts down the ConnectionPool by passing each connection to +block+ and # then removing it from the pool. Attempting to checkout a connection after # shutdown will raise +ConnectionPool::PoolShuttingDownError+. # - # pkg:gem/connection_pool#lib/connection_pool.rb:154 - def shutdown(&); end + # pkg:gem/connection_pool#lib/connection_pool.rb:167 + def shutdown(&block); end - # pkg:gem/connection_pool#lib/connection_pool.rb:46 + # pkg:gem/connection_pool#lib/connection_pool.rb:51 def size; end - # pkg:gem/connection_pool#lib/connection_pool.rb:75 - def then(**); end + # pkg:gem/connection_pool#lib/connection_pool.rb:83 + def then(**kwargs); end - # pkg:gem/connection_pool#lib/connection_pool.rb:60 - def with(**); end + # pkg:gem/connection_pool#lib/connection_pool.rb:68 + def with(**kwargs); end class << self # pkg:gem/connection_pool#lib/connection_pool/fork.rb:6 def after_fork; end - # pkg:gem/connection_pool#lib/connection_pool.rb:42 - def wrap(**, &); end + # pkg:gem/connection_pool#lib/connection_pool.rb:47 + def wrap(**kwargs, &block); end end end +# Built once: a Hash literal argument costs a Hash and its keyword copy per call. +# +# pkg:gem/connection_pool#lib/connection_pool.rb:43 +ConnectionPool::DEFER_INTERRUPTS = T.let(T.unsafe(nil), Hash) + # pkg:gem/connection_pool#lib/connection_pool.rb:5 class ConnectionPool::Error < ::RuntimeError; end @@ -135,6 +140,9 @@ module ConnectionPool::ForkTracker def _fork; end end +# pkg:gem/connection_pool#lib/connection_pool.rb:44 +ConnectionPool::IMMEDIATE_INTERRUPTS = T.let(T.unsafe(nil), Hash) + # JRuby, et al # # pkg:gem/connection_pool#lib/connection_pool/fork.rb:3 @@ -170,7 +178,7 @@ class ConnectionPool::TimedStack def initialize(size: T.unsafe(nil), &block); end # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:50 - def <<(obj, **); end + def <<(obj, **kwargs); end # Reduce the created count # @@ -206,13 +214,13 @@ class ConnectionPool::TimedStack # Other options may be used by subclasses that extend TimedStack. # # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:62 - def pop(timeout: T.unsafe(nil), exception: T.unsafe(nil), **); end + def pop(timeout: T.unsafe(nil), exception: T.unsafe(nil), **kwargs); end # Returns +obj+ to the stack. Additional kwargs are ignored in TimedStack but may be # used by subclasses that extend TimedStack. # # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:38 - def push(obj, **); end + def push(obj, **kwargs); end # Reaps connections that were checked in more than +idle_seconds+ ago. # @@ -233,24 +241,24 @@ class ConnectionPool::TimedStack # # This method must returns true if a connection is available on the stack. # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:167 - def connection_stored?(**); end + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:170 + def connection_stored?(**_kwargs); end - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:149 + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:152 def current_time; end # This is an extension point for TimedStack and is called with a mutex. # # This method must return a connection from the stack. # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:175 - def fetch_connection(**); end + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:178 + def fetch_connection(**_kwargs); end # This is an extension point for TimedStack and is called with a mutex. # # Returns true if the first connection in the stack has been idle for more than idle_seconds # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:209 + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:212 def idle_connections?(idle_seconds); end # This is an extension point for TimedStack and is called with a mutex. @@ -258,30 +266,30 @@ class ConnectionPool::TimedStack # This method returns the oldest idle connection if it has been idle for more than idle_seconds. # This requires that the stack is kept in order of checked in time (oldest first). # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:195 + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:198 def reserve_idle_connection(idle_seconds); end # This is an extension point for TimedStack and is called with a mutex. # # This method must shut down all connections on the stack. # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:183 - def shutdown_connections(**); end + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:186 + def shutdown_connections(**kwargs); end # This is an extension point for TimedStack and is called with a mutex. # # This method must return +obj+ to the stack. # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:220 - def store_connection(obj, **); end + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:223 + def store_connection(obj, **_kwargs); end # This is an extension point for TimedStack and is called with a mutex. # # This method must create a connection if and only if the total number of # connections allowed has not been met. # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:229 - def try_create(**); end + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:232 + def try_create(**_kwargs); end # This is an extension point for TimedStack and is called with a mutex. # @@ -289,8 +297,8 @@ class ConnectionPool::TimedStack # subclasses with expensive match/search algorithms to avoid double-handling # their stack. # - # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:159 - def try_fetch_connection(**); end + # pkg:gem/connection_pool#lib/connection_pool/timed_stack.rb:162 + def try_fetch_connection(**kwargs); end end # pkg:gem/connection_pool#lib/connection_pool.rb:9 @@ -302,25 +310,25 @@ ConnectionPool::VERSION = T.let(T.unsafe(nil), String) # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:2 class ConnectionPool::Wrapper < ::BasicObject # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:5 - def initialize(**options, &); end + def initialize(**options, &block); end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:37 - def method_missing(name, *, **, &); end + def method_missing(name, *args, **kwargs, &block); end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:25 def pool_available; end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:17 - def pool_shutdown(&); end + def pool_shutdown(&block); end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:21 def pool_size; end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:29 - def respond_to?(id, *, **); end + def respond_to?(id, *args, **kwargs); end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:13 - def with(**, &); end + def with(**kwargs, &block); end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:9 def wrapped_pool; end @@ -328,7 +336,7 @@ class ConnectionPool::Wrapper < ::BasicObject private # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:33 - def respond_to_missing?(id, *, **); end + def respond_to_missing?(id, *args, **kwargs); end end # pkg:gem/connection_pool#lib/connection_pool/wrapper.rb:3 diff --git a/sorbet/rbi/gems/down@5.6.2.rbi b/sorbet/rbi/gems/down@5.6.3.rbi similarity index 100% rename from sorbet/rbi/gems/down@5.6.2.rbi rename to sorbet/rbi/gems/down@5.6.3.rbi diff --git a/sorbet/rbi/gems/honeybadger@6.10.1.rbi b/sorbet/rbi/gems/honeybadger@6.10.2.rbi similarity index 100% rename from sorbet/rbi/gems/honeybadger@6.10.1.rbi rename to sorbet/rbi/gems/honeybadger@6.10.2.rbi diff --git a/sorbet/rbi/gems/json@3.1.0.rbi b/sorbet/rbi/gems/json@3.2.0.rbi similarity index 96% rename from sorbet/rbi/gems/json@3.1.0.rbi rename to sorbet/rbi/gems/json@3.2.0.rbi index 20de328e..0fd055b0 100644 --- a/sorbet/rbi/gems/json@3.1.0.rbi +++ b/sorbet/rbi/gems/json@3.2.0.rbi @@ -121,7 +121,7 @@ # # ==== Parsing Options # -# ====== Input Options +# ===== Input Options # # Option +max_nesting+ (\Integer) specifies the maximum nesting depth allowed; # defaults to +100+; @@ -217,7 +217,7 @@ # When enabled: # JSON.parse('"Hell\o"', allow_invalid_escape: true) # => "Hello" # -# ====== Output Options +# ===== Output Options # # Option +freeze+ (boolean) specifies whether the returned objects will be frozen; # defaults to +false+. @@ -326,7 +326,7 @@ # # ==== Generating Options # -# ====== Input Options +# ===== Input Options # # Option +allow_nan+ (boolean) specifies whether # +NaN+, +Infinity+, and +-Infinity+ may be generated; @@ -381,7 +381,7 @@ # which may leave the process in an unrecoverable state. # It is highly discouraged. # -# ====== Escaping Options +# ===== Escaping Options # # Options +script_safe+ (boolean) specifies wether '\u2028', '\u2029' # and '/' should be escaped as to make the JSON object safe to interpolate in script @@ -390,7 +390,7 @@ # Options +ascii_only+ (boolean) specifies wether all characters outside the ASCII range # should be escaped. # -# ====== Output Options +# ===== Output Options # # The default formatting options generate the most compact # \JSON data, all on one line and with no whitespace. @@ -486,7 +486,7 @@ module JSON # Output: # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"} # - # pkg:gem/json#lib/json/common.rb:747 + # pkg:gem/json#lib/json/common.rb:748 def dump(obj, anIO = T.unsafe(nil), _deprecated_limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end # :call-seq: @@ -525,7 +525,7 @@ module JSON # # Raises JSON::NestingError (nesting of 100 is too deep. Did you try to serialize objects with circular references?): # JSON.generate(a) # - # pkg:gem/json#lib/json/common.rb:373 + # pkg:gem/json#lib/json/common.rb:374 def generate(obj, opts = T.unsafe(nil)); end # :call-seq: @@ -654,7 +654,7 @@ module JSON # #"Admin", "password"=>"0wn3d"}>} # - # pkg:gem/json#lib/json/common.rb:701 + # pkg:gem/json#lib/json/common.rb:702 def load(source, proc = T.unsafe(nil), allow_blank: T.unsafe(nil), **options); end # :call-seq: @@ -665,7 +665,7 @@ module JSON # # See method #parse. # - # pkg:gem/json#lib/json/common.rb:322 + # pkg:gem/json#lib/json/common.rb:323 def load_file(filespec, **options); end # :call-seq: @@ -676,7 +676,7 @@ module JSON # # See method #parse! # - # pkg:gem/json#lib/json/common.rb:333 + # pkg:gem/json#lib/json/common.rb:334 def load_file!(filespec, **options); end # :call-seq: @@ -727,7 +727,7 @@ module JSON # # Raises JSON::ParserError (unexpected character: 'invalid' at line 1 column 1): # JSON.parse('invalid') # - # pkg:gem/json#lib/json/common.rb:291 + # pkg:gem/json#lib/json/common.rb:292 def parse(source, on_load: T.unsafe(nil), object_class: T.unsafe(nil), array_class: T.unsafe(nil), **options); end # :call-seq: @@ -742,7 +742,7 @@ module JSON # which disables checking for nesting depth. # - Option +allow_nan+, if not provided, defaults to +true+. # - # pkg:gem/json#lib/json/common.rb:311 + # pkg:gem/json#lib/json/common.rb:312 def parse!(source, **options); end # :call-seq: @@ -775,7 +775,7 @@ module JSON # } # } # - # pkg:gem/json#lib/json/common.rb:419 + # pkg:gem/json#lib/json/common.rb:420 def pretty_generate(obj, opts = T.unsafe(nil)); end # :call-seq: @@ -908,7 +908,7 @@ module JSON # #"Admin", "password"=>"0wn3d"}>} # - # pkg:gem/json#lib/json/common.rb:571 + # pkg:gem/json#lib/json/common.rb:572 def unsafe_load(source, proc = T.unsafe(nil), **options); end class << self @@ -952,7 +952,7 @@ module JSON # Output: # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"} # - # pkg:gem/json#lib/json/common.rb:747 + # pkg:gem/json#lib/json/common.rb:748 def dump(obj, anIO = T.unsafe(nil), _deprecated_limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end # :call-seq: @@ -991,7 +991,7 @@ module JSON # # Raises JSON::NestingError (nesting of 100 is too deep. Did you try to serialize objects with circular references?): # JSON.generate(a) # - # pkg:gem/json#lib/json/common.rb:373 + # pkg:gem/json#lib/json/common.rb:374 def generate(obj, opts = T.unsafe(nil)); end # Returns the JSON generator module that is used by JSON. @@ -1130,7 +1130,7 @@ module JSON # #"Admin", "password"=>"0wn3d"}>} # - # pkg:gem/json#lib/json/common.rb:701 + # pkg:gem/json#lib/json/common.rb:702 def load(source, proc = T.unsafe(nil), allow_blank: T.unsafe(nil), **options); end # :call-seq: @@ -1141,7 +1141,7 @@ module JSON # # See method #parse. # - # pkg:gem/json#lib/json/common.rb:322 + # pkg:gem/json#lib/json/common.rb:323 def load_file(filespec, **options); end # :call-seq: @@ -1152,7 +1152,7 @@ module JSON # # See method #parse! # - # pkg:gem/json#lib/json/common.rb:333 + # pkg:gem/json#lib/json/common.rb:334 def load_file!(filespec, **options); end # :call-seq: @@ -1203,7 +1203,7 @@ module JSON # # Raises JSON::ParserError (unexpected character: 'invalid' at line 1 column 1): # JSON.parse('invalid') # - # pkg:gem/json#lib/json/common.rb:291 + # pkg:gem/json#lib/json/common.rb:292 def parse(source, on_load: T.unsafe(nil), object_class: T.unsafe(nil), array_class: T.unsafe(nil), **options); end # :call-seq: @@ -1218,7 +1218,7 @@ module JSON # which disables checking for nesting depth. # - Option +allow_nan+, if not provided, defaults to +true+. # - # pkg:gem/json#lib/json/common.rb:311 + # pkg:gem/json#lib/json/common.rb:312 def parse!(source, **options); end # Returns the JSON parser class that is used by JSON. @@ -1261,7 +1261,7 @@ module JSON # } # } # - # pkg:gem/json#lib/json/common.rb:419 + # pkg:gem/json#lib/json/common.rb:420 def pretty_generate(obj, opts = T.unsafe(nil)); end # Sets or Returns the JSON generator state class that is used by JSON. @@ -1404,7 +1404,7 @@ module JSON # #"Admin", "password"=>"0wn3d"}>} # - # pkg:gem/json#lib/json/common.rb:571 + # pkg:gem/json#lib/json/common.rb:572 def unsafe_load(source, proc = T.unsafe(nil), **options); end private @@ -1426,7 +1426,7 @@ end # # MyApp::JSONC_CODER.load(document) # -# pkg:gem/json#lib/json/common.rb:787 +# pkg:gem/json#lib/json/common.rb:788 class JSON::Coder # :call-seq: # JSON::Coder.new(**options, &block) @@ -1455,7 +1455,7 @@ class JSON::Coder # The conversion callback can also be passed as +as_json:+. If both are given, the block takes precedence. # Passing +false+ or +nil+ for +strict:+ raises ArgumentError. # - # pkg:gem/json#lib/json/common.rb:836 + # pkg:gem/json#lib/json/common.rb:837 def initialize(object_class: T.unsafe(nil), array_class: T.unsafe(nil), on_load: T.unsafe(nil), strict: T.unsafe(nil), **options, &as_json); end # call-seq: @@ -1464,10 +1464,10 @@ class JSON::Coder # # Serialize the given object into a \JSON document. # - # pkg:gem/json#lib/json/common.rb:859 + # pkg:gem/json#lib/json/common.rb:860 def dump(object, io = T.unsafe(nil)); end - # pkg:gem/json#lib/json/common.rb:862 + # pkg:gem/json#lib/json/common.rb:863 def generate(object, io = T.unsafe(nil)); end # call-seq: @@ -1475,7 +1475,7 @@ class JSON::Coder # # Parse the given \JSON document and return an equivalent Ruby object. # - # pkg:gem/json#lib/json/common.rb:868 + # pkg:gem/json#lib/json/common.rb:869 def load(source); end # call-seq: @@ -1483,17 +1483,17 @@ class JSON::Coder # # Parse the given \JSON document and return an equivalent Ruby object. # - # pkg:gem/json#lib/json/common.rb:877 + # pkg:gem/json#lib/json/common.rb:878 def load_file(path); end - # pkg:gem/json#lib/json/common.rb:871 + # pkg:gem/json#lib/json/common.rb:872 def parse(source); end end -# pkg:gem/json#lib/json/common.rb:802 +# pkg:gem/json#lib/json/common.rb:803 JSON::Coder::EXCLUDED_GENERATOR_OPTIONS = T.let(T.unsafe(nil), Array) -# pkg:gem/json#lib/json/common.rb:788 +# pkg:gem/json#lib/json/common.rb:789 JSON::Coder::PARSER_OPTIONS = T.let(T.unsafe(nil), Array) # This module holds all the modules/classes that implement JSON's @@ -1727,53 +1727,53 @@ end # Note: no validation is performed on the provided string. It is the # responsibility of the caller to ensure the string contains valid JSON. # -# pkg:gem/json#lib/json/common.rb:227 +# pkg:gem/json#lib/json/common.rb:228 class JSON::Fragment < ::Struct - # pkg:gem/json#lib/json/common.rb:228 + # pkg:gem/json#lib/json/common.rb:229 def initialize(json); end - # pkg:gem/json#lib/json/common.rb:227 + # pkg:gem/json#lib/json/common.rb:228 def json; end - # pkg:gem/json#lib/json/common.rb:227 + # pkg:gem/json#lib/json/common.rb:228 def json=(_); end - # pkg:gem/json#lib/json/common.rb:236 + # pkg:gem/json#lib/json/common.rb:237 def to_json(state = T.unsafe(nil), *); end class << self - # pkg:gem/json#lib/json/common.rb:227 + # pkg:gem/json#lib/json/common.rb:228 def [](*_arg0); end - # pkg:gem/json#lib/json/common.rb:227 + # pkg:gem/json#lib/json/common.rb:228 def inspect; end - # pkg:gem/json#lib/json/common.rb:227 + # pkg:gem/json#lib/json/common.rb:228 def keyword_init?; end - # pkg:gem/json#lib/json/common.rb:227 + # pkg:gem/json#lib/json/common.rb:228 def members; end - # pkg:gem/json#lib/json/common.rb:227 + # pkg:gem/json#lib/json/common.rb:228 def new(*_arg0); end end end # This exception is raised if a generator or unparser error occurs. # -# pkg:gem/json#lib/json/common.rb:197 +# pkg:gem/json#lib/json/common.rb:198 class JSON::GeneratorError < ::JSON::JSONError - # pkg:gem/json#lib/json/common.rb:200 + # pkg:gem/json#lib/json/common.rb:201 def initialize(message, invalid_object = T.unsafe(nil)); end - # pkg:gem/json#lib/json/common.rb:205 + # pkg:gem/json#lib/json/common.rb:206 def detailed_message(*, **, &); end - # pkg:gem/json#lib/json/common.rb:198 + # pkg:gem/json#lib/json/common.rb:199 def invalid_object; end end -# pkg:gem/json#lib/json/common.rb:882 +# pkg:gem/json#lib/json/common.rb:883 module JSON::GeneratorMethods # call-seq: to_json(*) # @@ -1783,11 +1783,11 @@ module JSON::GeneratorMethods # it to a JSON string, and returns the result. # This is a fallback, if no special method #to_json was defined for some object. # - # pkg:gem/json#lib/json/common.rb:890 + # pkg:gem/json#lib/json/common.rb:891 def to_json(state = T.unsafe(nil), *); end end -# pkg:gem/json#lib/json/common.rb:381 +# pkg:gem/json#lib/json/common.rb:382 JSON::PRETTY_GENERATE_OPTIONS = T.let(T.unsafe(nil), Hash) # pkg:gem/json#lib/json/common.rb:76 @@ -1906,7 +1906,7 @@ end # pkg:gem/json#lib/json/common.rb:98 JSON::State = JSON::Ext::Generator::State -# pkg:gem/json#lib/json/common.rb:907 +# pkg:gem/json#lib/json/common.rb:908 module Kernel private @@ -1917,11 +1917,11 @@ module Kernel # The _opts_ argument is passed through to generate/parse respectively. See # generate and parse for their documentation. # - # pkg:gem/json#lib/json/common.rb:916 + # pkg:gem/json#lib/json/common.rb:917 def JSON(object, opts = T.unsafe(nil)); end end -# pkg:gem/json#lib/json/common.rb:921 +# pkg:gem/json#lib/json/common.rb:922 class Object < ::BasicObject include ::Kernel include ::PP::ObjectMixin diff --git a/sorbet/rbi/gems/lograge@0.15.1.rbi b/sorbet/rbi/gems/lograge@0.16.0.rbi similarity index 64% rename from sorbet/rbi/gems/lograge@0.15.1.rbi rename to sorbet/rbi/gems/lograge@0.16.0.rbi index a06ce190..c2e7cb77 100644 --- a/sorbet/rbi/gems/lograge@0.15.1.rbi +++ b/sorbet/rbi/gems/lograge@0.16.0.rbi @@ -7,69 +7,69 @@ # pkg:gem/lograge#lib/lograge/version.rb:3 module Lograge - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def application; end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def application=(val); end - # pkg:gem/lograge#lib/lograge.rb:50 + # pkg:gem/lograge#lib/lograge.rb:51 def before_format=(val); end - # pkg:gem/lograge#lib/lograge.rb:36 + # pkg:gem/lograge#lib/lograge.rb:37 def custom_options=(val); end - # pkg:gem/lograge#lib/lograge.rb:107 + # pkg:gem/lograge#lib/lograge.rb:108 def formatter; end - # pkg:gem/lograge#lib/lograge.rb:107 + # pkg:gem/lograge#lib/lograge.rb:108 def formatter=(val); end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def ignore_tests=(val); end - # pkg:gem/lograge#lib/lograge.rb:99 + # pkg:gem/lograge#lib/lograge.rb:100 def log_level; end - # pkg:gem/lograge#lib/lograge.rb:99 + # pkg:gem/lograge#lib/lograge.rb:100 def log_level=(val); end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def logger; end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def logger=(val); end private - # pkg:gem/lograge#lib/lograge.rb:166 + # pkg:gem/lograge#lib/lograge.rb:187 def attach_to_action_cable; end - # pkg:gem/lograge#lib/lograge.rb:162 + # pkg:gem/lograge#lib/lograge.rb:183 def attach_to_action_controller; end - # pkg:gem/lograge#lib/lograge.rb:53 + # pkg:gem/lograge#lib/lograge.rb:54 def before_format(data, payload); end - # pkg:gem/lograge#lib/lograge.rb:78 + # pkg:gem/lograge#lib/lograge.rb:79 def controller_field(params); end - # pkg:gem/lograge#lib/lograge.rb:39 + # pkg:gem/lograge#lib/lograge.rb:40 def custom_options(event); end - # pkg:gem/lograge#lib/lograge.rb:237 + # pkg:gem/lograge#lib/lograge.rb:258 def deprecator; end - # pkg:gem/lograge#lib/lograge.rb:202 + # pkg:gem/lograge#lib/lograge.rb:223 def disable_rack_cache_verbose_output; end - # pkg:gem/lograge#lib/lograge.rb:185 + # pkg:gem/lograge#lib/lograge.rb:206 def extend_base_class(klass); end - # pkg:gem/lograge#lib/lograge.rb:86 + # pkg:gem/lograge#lib/lograge.rb:87 def ignore(test); end - # pkg:gem/lograge#lib/lograge.rb:94 + # pkg:gem/lograge#lib/lograge.rb:95 def ignore?(event); end # Set conditions for events that should be ignored @@ -84,103 +84,113 @@ module Lograge # are given to 'ignore'. Both methods can be called multiple times, which # just adds more ignore conditions to a list that is checked before logging. # - # pkg:gem/lograge#lib/lograge.rb:71 + # pkg:gem/lograge#lib/lograge.rb:72 def ignore_actions(actions); end - # pkg:gem/lograge#lib/lograge.rb:90 + # pkg:gem/lograge#lib/lograge.rb:91 def ignore_nothing; end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def ignore_tests; end - # pkg:gem/lograge#lib/lograge.rb:206 + # pkg:gem/lograge#lib/lograge.rb:227 def keep_original_rails_log; end - # pkg:gem/lograge#lib/lograge.rb:233 + # pkg:gem/lograge#lib/lograge.rb:254 def lograge_config; end - # pkg:gem/lograge#lib/lograge.rb:243 + # pkg:gem/lograge#lib/lograge.rb:264 def notification_listeners_for(name); end - # pkg:gem/lograge#lib/lograge.rb:216 + # pkg:gem/lograge#lib/lograge.rb:237 def rack_cache_hashlike?(app); end - # pkg:gem/lograge#lib/lograge.rb:129 + # pkg:gem/lograge#lib/lograge.rb:132 + def rails_event_reporter_log_subscriber_classes; end + + # pkg:gem/lograge#lib/lograge.rb:150 def rails_log_subscriber?(listener, subscriber); end - # pkg:gem/lograge#lib/lograge.rb:109 + # Rails 8.2+ framework log subscribers inherit from + # ActiveSupport::EventReporter::LogSubscriber and are subscribed to + # ActiveSupport.event_reporter instead of ActiveSupport::Notifications. + # + # pkg:gem/lograge#lib/lograge.rb:126 + def remove_event_reporter_log_subscriptions; end + + # pkg:gem/lograge#lib/lograge.rb:110 def remove_existing_log_subscriptions; end - # pkg:gem/lograge#lib/lograge.rb:158 + # pkg:gem/lograge#lib/lograge.rb:179 def set_formatter; end - # pkg:gem/lograge#lib/lograge.rb:153 + # pkg:gem/lograge#lib/lograge.rb:174 def set_ignores; end - # pkg:gem/lograge#lib/lograge.rb:195 + # pkg:gem/lograge#lib/lograge.rb:216 def set_lograge_log_options; end - # pkg:gem/lograge#lib/lograge.rb:138 + # pkg:gem/lograge#lib/lograge.rb:159 def setup(app); end - # pkg:gem/lograge#lib/lograge.rb:173 + # pkg:gem/lograge#lib/lograge.rb:194 def setup_custom_payload; end # TODO: Remove with version 1.0 # - # pkg:gem/lograge#lib/lograge.rb:223 + # pkg:gem/lograge#lib/lograge.rb:244 def support_deprecated_config; end - # pkg:gem/lograge#lib/lograge.rb:120 + # pkg:gem/lograge#lib/lograge.rb:141 def unsubscribe(component, subscriber); end class << self - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def application; end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def application=(val); end - # pkg:gem/lograge#lib/lograge.rb:166 + # pkg:gem/lograge#lib/lograge.rb:187 def attach_to_action_cable; end - # pkg:gem/lograge#lib/lograge.rb:162 + # pkg:gem/lograge#lib/lograge.rb:183 def attach_to_action_controller; end - # pkg:gem/lograge#lib/lograge.rb:53 + # pkg:gem/lograge#lib/lograge.rb:54 def before_format(data, payload); end - # pkg:gem/lograge#lib/lograge.rb:50 + # pkg:gem/lograge#lib/lograge.rb:51 def before_format=(val); end - # pkg:gem/lograge#lib/lograge.rb:78 + # pkg:gem/lograge#lib/lograge.rb:79 def controller_field(params); end - # pkg:gem/lograge#lib/lograge.rb:39 + # pkg:gem/lograge#lib/lograge.rb:40 def custom_options(event); end - # pkg:gem/lograge#lib/lograge.rb:36 + # pkg:gem/lograge#lib/lograge.rb:37 def custom_options=(val); end - # pkg:gem/lograge#lib/lograge.rb:237 + # pkg:gem/lograge#lib/lograge.rb:258 def deprecator; end - # pkg:gem/lograge#lib/lograge.rb:202 + # pkg:gem/lograge#lib/lograge.rb:223 def disable_rack_cache_verbose_output; end - # pkg:gem/lograge#lib/lograge.rb:185 + # pkg:gem/lograge#lib/lograge.rb:206 def extend_base_class(klass); end - # pkg:gem/lograge#lib/lograge.rb:107 + # pkg:gem/lograge#lib/lograge.rb:108 def formatter; end - # pkg:gem/lograge#lib/lograge.rb:107 + # pkg:gem/lograge#lib/lograge.rb:108 def formatter=(val); end - # pkg:gem/lograge#lib/lograge.rb:86 + # pkg:gem/lograge#lib/lograge.rb:87 def ignore(test); end - # pkg:gem/lograge#lib/lograge.rb:94 + # pkg:gem/lograge#lib/lograge.rb:95 def ignore?(event); end # Set conditions for events that should be ignored @@ -195,72 +205,82 @@ module Lograge # are given to 'ignore'. Both methods can be called multiple times, which # just adds more ignore conditions to a list that is checked before logging. # - # pkg:gem/lograge#lib/lograge.rb:71 + # pkg:gem/lograge#lib/lograge.rb:72 def ignore_actions(actions); end - # pkg:gem/lograge#lib/lograge.rb:90 + # pkg:gem/lograge#lib/lograge.rb:91 def ignore_nothing; end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def ignore_tests; end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def ignore_tests=(val); end - # pkg:gem/lograge#lib/lograge.rb:206 + # pkg:gem/lograge#lib/lograge.rb:227 def keep_original_rails_log; end - # pkg:gem/lograge#lib/lograge.rb:99 + # pkg:gem/lograge#lib/lograge.rb:100 def log_level; end - # pkg:gem/lograge#lib/lograge.rb:99 + # pkg:gem/lograge#lib/lograge.rb:100 def log_level=(val); end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def logger; end - # pkg:gem/lograge#lib/lograge.rb:28 + # pkg:gem/lograge#lib/lograge.rb:29 def logger=(val); end - # pkg:gem/lograge#lib/lograge.rb:233 + # pkg:gem/lograge#lib/lograge.rb:254 def lograge_config; end - # pkg:gem/lograge#lib/lograge.rb:243 + # pkg:gem/lograge#lib/lograge.rb:264 def notification_listeners_for(name); end - # pkg:gem/lograge#lib/lograge.rb:129 + # pkg:gem/lograge#lib/lograge.rb:150 def rails_log_subscriber?(listener, subscriber); end - # pkg:gem/lograge#lib/lograge.rb:109 + # pkg:gem/lograge#lib/lograge.rb:110 def remove_existing_log_subscriptions; end - # pkg:gem/lograge#lib/lograge.rb:158 + # pkg:gem/lograge#lib/lograge.rb:179 def set_formatter; end - # pkg:gem/lograge#lib/lograge.rb:153 + # pkg:gem/lograge#lib/lograge.rb:174 def set_ignores; end - # pkg:gem/lograge#lib/lograge.rb:195 + # pkg:gem/lograge#lib/lograge.rb:216 def set_lograge_log_options; end - # pkg:gem/lograge#lib/lograge.rb:138 + # pkg:gem/lograge#lib/lograge.rb:159 def setup(app); end - # pkg:gem/lograge#lib/lograge.rb:173 + # pkg:gem/lograge#lib/lograge.rb:194 def setup_custom_payload; end # TODO: Remove with version 1.0 # - # pkg:gem/lograge#lib/lograge.rb:223 + # pkg:gem/lograge#lib/lograge.rb:244 def support_deprecated_config; end - # pkg:gem/lograge#lib/lograge.rb:120 + # pkg:gem/lograge#lib/lograge.rb:141 def unsubscribe(component, subscriber); end private - # pkg:gem/lograge#lib/lograge.rb:216 + # pkg:gem/lograge#lib/lograge.rb:237 def rack_cache_hashlike?(app); end + + # pkg:gem/lograge#lib/lograge.rb:132 + def rails_event_reporter_log_subscriber_classes; end + + # Rails 8.2+ framework log subscribers inherit from + # ActiveSupport::EventReporter::LogSubscriber and are subscribed to + # ActiveSupport.event_reporter instead of ActiveSupport::Notifications. + # + # pkg:gem/lograge#lib/lograge.rb:126 + def remove_event_reporter_log_subscriptions; end end end @@ -296,6 +316,88 @@ module Lograge::Formatters::Helpers::MethodAndPath def method_and_path_string(data); end end +# Serializes log data to JSON without dropping the whole log event when +# the data cannot be generated as-is. Newer versions of the json gem are +# stricter about their input: +# +# * json 3.1 rejects non-ASCII ASCII-8BIT (binary) strings, which are +# common in exception messages and HTTP response bodies. +# * json 3.0 rejects hashes with keys that serialize to the same name, +# such as +:status+ and "status". +# +# Strings that are invalid UTF-8 have always been rejected. +# +# The data is only normalized after the first attempt fails, so well +# formed events are serialized exactly as before and pay no extra cost. +# +# pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:21 +module Lograge::Formatters::Helpers::SafeJson + private + + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:31 + def dump(data); end + + # Returns a copy of +value+ that the json gem can always generate: + # + # * every hash key is a UTF-8 string. When two keys serialize to the same + # name, the first key keeps its position and the later value wins, + # which matches how the log subscriber merges custom options. + # * every string and symbol becomes a valid UTF-8 string. Bytes that + # cannot be converted are replaced with U+FFFD. + # * other objects are kept if they can be generated on their own, and + # are otherwise replaced by their normalized +to_s+ (for example an + # exception whose message holds binary bytes). + # + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:47 + def normalize(value); end + + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:58 + def normalize_hash(hash); end + + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:64 + def normalize_object(object); end + + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:71 + def to_utf8(string); end + + class << self + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:31 + def dump(data); end + + # Returns a copy of +value+ that the json gem can always generate: + # + # * every hash key is a UTF-8 string. When two keys serialize to the same + # name, the first key keeps its position and the later value wins, + # which matches how the log subscriber merges custom options. + # * every string and symbol becomes a valid UTF-8 string. Bytes that + # cannot be converted are replaced with U+FFFD. + # * other objects are kept if they can be generated on their own, and + # are otherwise replaced by their normalized +to_s+ (for example an + # exception whose message holds binary bytes). + # + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:47 + def normalize(value); end + + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:58 + def normalize_hash(hash); end + + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:64 + def normalize_object(object); end + + # pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:71 + def to_utf8(string); end + end +end + +# ArgumentError is included because, on TruffleRuby, json 3's pure-Ruby +# generator serializes objects such as Symbols and Times through +# ActiveSupport's encoder, which before Rails 8.1 passes the +# +quirks_mode+ option that json 3 no longer accepts. Normalizing turns +# those objects into plain strings, which avoids that code path. +# +# pkg:gem/lograge#lib/lograge/formatters/helpers/safe_json.rb:27 +Lograge::Formatters::Helpers::SafeJson::GENERATION_ERRORS = T.let(T.unsafe(nil), Array) + # pkg:gem/lograge#lib/lograge/formatters/json.rb:6 class Lograge::Formatters::Json # pkg:gem/lograge#lib/lograge/formatters/json.rb:7 @@ -482,7 +584,7 @@ class Lograge::LogSubscribers::Base < ::ActiveSupport::LogSubscriber private - # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:76 + # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:96 def before_format(data, payload); end # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:71 @@ -491,6 +593,9 @@ class Lograge::LogSubscribers::Base < ::ActiveSupport::LogSubscriber # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:55 def default_status; end + # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:86 + def existing_key(data, key); end + # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:63 def extract_allocations(event); end @@ -515,6 +620,13 @@ class Lograge::LogSubscribers::Base < ::ActiveSupport::LogSubscriber # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:41 def initial_data(*_arg); end + # Merges +options+ into +data+. A String key overrides an existing Symbol + # key of the same name (and vice versa) instead of being added alongside + # it, so the two never end up serialized as duplicate keys. + # + # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:79 + def merge_options(data, options); end + # pkg:gem/lograge#lib/lograge/log_subscribers/base.rb:19 def process_main_event(event); end end diff --git a/sorbet/rbi/gems/rack@3.2.8.rbi b/sorbet/rbi/gems/rack@3.2.9.rbi similarity index 96% rename from sorbet/rbi/gems/rack@3.2.8.rbi rename to sorbet/rbi/gems/rack@3.2.9.rbi index 7f69675e..bbe066a2 100644 --- a/sorbet/rbi/gems/rack@3.2.8.rbi +++ b/sorbet/rbi/gems/rack@3.2.9.rbi @@ -711,22 +711,22 @@ class Rack::Directory # Rack response to use for requests with invalid paths, or nil if path is valid. # - # pkg:gem/rack#lib/rack/directory.rb:110 + # pkg:gem/rack#lib/rack/directory.rb:111 def check_bad_request(path_info); end # Rack response to use for requests with paths outside the root, or nil if path is inside the root. # - # pkg:gem/rack#lib/rack/directory.rb:120 + # pkg:gem/rack#lib/rack/directory.rb:121 def check_forbidden(path_info); end # Rack response to use for unreadable and non-file, non-directory entries. # - # pkg:gem/rack#lib/rack/directory.rb:184 + # pkg:gem/rack#lib/rack/directory.rb:185 def entity_not_found(path_info); end # Provide human readable file sizes # - # pkg:gem/rack#lib/rack/directory.rb:200 + # pkg:gem/rack#lib/rack/directory.rb:201 def filesize_format(int); end # Internals of request handling. Similar to call but does @@ -737,13 +737,13 @@ class Rack::Directory # Rack response to use for directories under the root. # - # pkg:gem/rack#lib/rack/directory.rb:133 + # pkg:gem/rack#lib/rack/directory.rb:134 def list_directory(path_info, path, script_name); end # Rack response to use for files and directories under the root. # Unreadable and non-file, non-directory entries will get a 404 response. # - # pkg:gem/rack#lib/rack/directory.rb:174 + # pkg:gem/rack#lib/rack/directory.rb:175 def list_path(env, path, path_info, script_name); end # The root of the directory hierarchy. Only requests for files and @@ -754,7 +754,7 @@ class Rack::Directory # File::Stat for the given path, but return nil for missing/bad entries. # - # pkg:gem/rack#lib/rack/directory.rb:166 + # pkg:gem/rack#lib/rack/directory.rb:167 def stat(path); end end @@ -787,7 +787,7 @@ end # Stolen from Ramaze # -# pkg:gem/rack#lib/rack/directory.rb:192 +# pkg:gem/rack#lib/rack/directory.rb:193 Rack::Directory::FILESIZE_FORMAT = T.let(T.unsafe(nil), Array) # pkg:gem/rack#lib/rack/constants.rb:22 @@ -1841,7 +1841,7 @@ end # # Usually, Rack::Request#POST takes care of calling this. # -# pkg:gem/rack#lib/rack/multipart/parser.rb:9 +# pkg:gem/rack#lib/rack/multipart/parser.rb:10 module Rack::Multipart class << self # pkg:gem/rack#lib/rack/multipart.rb:72 @@ -1858,28 +1858,28 @@ end # Base class for multipart exceptions that do not subclass from # other exception classes for backwards compatibility. # -# pkg:gem/rack#lib/rack/multipart/parser.rb:26 +# pkg:gem/rack#lib/rack/multipart/parser.rb:27 class Rack::Multipart::BoundaryTooLongError < ::StandardError include ::Rack::BadRequest end -# pkg:gem/rack#lib/rack/multipart/parser.rb:33 +# pkg:gem/rack#lib/rack/multipart/parser.rb:34 Rack::Multipart::EOL = T.let(T.unsafe(nil), String) # Use specific error class when parsing multipart request # that ends early. # -# pkg:gem/rack#lib/rack/multipart/parser.rb:20 +# pkg:gem/rack#lib/rack/multipart/parser.rb:21 class Rack::Multipart::EmptyContentError < ::EOFError include ::Rack::BadRequest end # Prefer to use the BoundaryTooLongError class or Rack::BadRequest. # -# pkg:gem/rack#lib/rack/multipart/parser.rb:31 +# pkg:gem/rack#lib/rack/multipart/parser.rb:32 Rack::Multipart::Error = Rack::Multipart::BoundaryTooLongError -# pkg:gem/rack#lib/rack/multipart/parser.rb:34 +# pkg:gem/rack#lib/rack/multipart/parser.rb:35 Rack::Multipart::FWS = T.let(T.unsafe(nil), Regexp) # pkg:gem/rack#lib/rack/multipart/generator.rb:7 @@ -1907,24 +1907,24 @@ end # whitespace with optional folding # -# pkg:gem/rack#lib/rack/multipart/parser.rb:35 +# pkg:gem/rack#lib/rack/multipart/parser.rb:36 Rack::Multipart::HEADER_VALUE = T.let(T.unsafe(nil), String) # anything but a non-folding CRLF # -# pkg:gem/rack#lib/rack/multipart/parser.rb:36 +# pkg:gem/rack#lib/rack/multipart/parser.rb:37 Rack::Multipart::MULTIPART = T.let(T.unsafe(nil), Regexp) # pkg:gem/rack#lib/rack/multipart.rb:16 Rack::Multipart::MULTIPART_BOUNDARY = T.let(T.unsafe(nil), String) -# pkg:gem/rack#lib/rack/multipart/parser.rb:38 +# pkg:gem/rack#lib/rack/multipart/parser.rb:39 Rack::Multipart::MULTIPART_CONTENT_DISPOSITION = T.let(T.unsafe(nil), Regexp) -# pkg:gem/rack#lib/rack/multipart/parser.rb:39 +# pkg:gem/rack#lib/rack/multipart/parser.rb:40 Rack::Multipart::MULTIPART_CONTENT_ID = T.let(T.unsafe(nil), Regexp) -# pkg:gem/rack#lib/rack/multipart/parser.rb:37 +# pkg:gem/rack#lib/rack/multipart/parser.rb:38 Rack::Multipart::MULTIPART_CONTENT_TYPE = T.let(T.unsafe(nil), Regexp) # pkg:gem/rack#lib/rack/multipart.rb:18 @@ -1932,12 +1932,12 @@ class Rack::Multipart::MissingInputError < ::StandardError include ::Rack::BadRequest end -# pkg:gem/rack#lib/rack/multipart/parser.rb:10 +# pkg:gem/rack#lib/rack/multipart/parser.rb:11 class Rack::Multipart::MultipartPartLimitError < ::Errno::EMFILE include ::Rack::BadRequest end -# pkg:gem/rack#lib/rack/multipart/parser.rb:14 +# pkg:gem/rack#lib/rack/multipart/parser.rb:15 class Rack::Multipart::MultipartTotalPartLimitError < ::StandardError include ::Rack::BadRequest end @@ -1979,18 +1979,18 @@ end # * +:tempfile+ - A Tempfile object containing the uploaded data # * +:head+ - The raw header content for this part # -# pkg:gem/rack#lib/rack/multipart/parser.rb:53 +# pkg:gem/rack#lib/rack/multipart/parser.rb:54 class Rack::Multipart::Parser - # pkg:gem/rack#lib/rack/multipart/parser.rb:258 + # pkg:gem/rack#lib/rack/multipart/parser.rb:314 def initialize(boundary, tempfile, bufsize, query_parser); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:279 + # pkg:gem/rack#lib/rack/multipart/parser.rb:335 def parse(io); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:303 + # pkg:gem/rack#lib/rack/multipart/parser.rb:359 def result; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:256 + # pkg:gem/rack#lib/rack/multipart/parser.rb:312 def state; end private @@ -2000,23 +2000,23 @@ class Rack::Multipart::Parser # end of the boundary. If we don't find the start or end of the # boundary, clear the buffer and return nil. # - # pkg:gem/rack#lib/rack/multipart/parser.rb:539 + # pkg:gem/rack#lib/rack/multipart/parser.rb:596 def consume_boundary; end # Return the related Encoding object. However, because # enc is submitted by the user, it may be invalid, so # use a binary encoding in that case. # - # pkg:gem/rack#lib/rack/multipart/parser.rb:594 + # pkg:gem/rack#lib/rack/multipart/parser.rb:654 def find_encoding(enc); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:362 + # pkg:gem/rack#lib/rack/multipart/parser.rb:418 def handle_consume_token; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:609 + # pkg:gem/rack#lib/rack/multipart/parser.rb:680 def handle_dummy_encoding(name, body); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:619 + # pkg:gem/rack#lib/rack/multipart/parser.rb:690 def handle_empty_content!(content); end # This handles the initial parser state. We read until we find the starting @@ -2027,166 +2027,188 @@ class Rack::Multipart::Parser # boundary. The client would have to deliberately craft a response # with the opening boundary beyond the buffer size for that to happen. # - # pkg:gem/rack#lib/rack/multipart/parser.rb:335 + # pkg:gem/rack#lib/rack/multipart/parser.rb:391 def handle_fast_forward; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:506 + # pkg:gem/rack#lib/rack/multipart/parser.rb:563 def handle_mime_body; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:377 + # pkg:gem/rack#lib/rack/multipart/parser.rb:433 def handle_mime_head; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:548 + # pkg:gem/rack#lib/rack/multipart/parser.rb:605 def normalize_filename(filename); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:316 + # pkg:gem/rack#lib/rack/multipart/parser.rb:372 def read_data(io, outbuf); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:561 + # Whether to respect the given encoding (given as a string). If a + # requested encoding is not respected, binary encoding is used. + # The string may be nil or in any encoding, so compare it as bytes. + # + # pkg:gem/rack#lib/rack/multipart/parser.rb:667 + def respect_requested_encoding?(encoding_string); end + + # pkg:gem/rack#lib/rack/multipart/parser.rb:618 def tag_multipart_encoding(filename, content_type, name, body); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:528 + # pkg:gem/rack#lib/rack/multipart/parser.rb:585 def update_retained_size(size); end class << self - # pkg:gem/rack#lib/rack/multipart/parser.rb:141 + # pkg:gem/rack#lib/rack/multipart/parser.rb:197 def parse(io, content_length, content_type, tmpfile, bufsize, qp); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:122 + # Parse the boundary parameter from a multipart content type, following + # the media type grammar in RFC 9110 Section 8.3.1: + # + # media-type = type "/" subtype parameters + # parameters = *( OWS ";" OWS [ parameter ] ) + # parameter = parameter-name "=" parameter-value + # parameter-value = ( token / quoted-string ) + # + # Returns nil if the content type is not multipart or has no boundary + # parameter. Raises Error if the parameters are malformed, the boundary + # is empty, or there is more than one boundary parameter. + # + # pkg:gem/rack#lib/rack/multipart/parser.rb:134 def parse_boundary(content_type); end end end -# pkg:gem/rack#lib/rack/multipart/parser.rb:62 +# pkg:gem/rack#lib/rack/multipart/parser.rb:63 Rack::Multipart::Parser::BOUNDARY_START_LIMIT = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:80 +# pkg:gem/rack#lib/rack/multipart/parser.rb:81 Rack::Multipart::Parser::BUFFERED_UPLOAD_BYTESIZE_LIMIT = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:54 +# pkg:gem/rack#lib/rack/multipart/parser.rb:55 Rack::Multipart::Parser::BUFSIZE = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:90 +# pkg:gem/rack#lib/rack/multipart/parser.rb:91 class Rack::Multipart::Parser::BoundedIO - # pkg:gem/rack#lib/rack/multipart/parser.rb:91 + # pkg:gem/rack#lib/rack/multipart/parser.rb:92 def initialize(io, content_length); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:97 + # pkg:gem/rack#lib/rack/multipart/parser.rb:98 def read(size, outbuf = T.unsafe(nil)); end end -# pkg:gem/rack#lib/rack/multipart/parser.rb:558 +# pkg:gem/rack#lib/rack/multipart/parser.rb:615 Rack::Multipart::Parser::CHARSET = T.let(T.unsafe(nil), String) -# pkg:gem/rack#lib/rack/multipart/parser.rb:373 +# pkg:gem/rack#lib/rack/multipart/parser.rb:429 Rack::Multipart::Parser::CONTENT_DISPOSITION_MAX_BYTES = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:372 +# pkg:gem/rack#lib/rack/multipart/parser.rb:428 Rack::Multipart::Parser::CONTENT_DISPOSITION_MAX_PARAMS = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:87 +# pkg:gem/rack#lib/rack/multipart/parser.rb:88 Rack::Multipart::Parser::CONTENT_DISPOSITION_QUOTED_ESCAPES_LIMIT = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:165 +# pkg:gem/rack#lib/rack/multipart/parser.rb:221 class Rack::Multipart::Parser::Collector include ::Enumerable - # pkg:gem/rack#lib/rack/multipart/parser.rb:201 + # pkg:gem/rack#lib/rack/multipart/parser.rb:257 def initialize(tempfile); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:207 + # pkg:gem/rack#lib/rack/multipart/parser.rb:263 def each; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:227 + # pkg:gem/rack#lib/rack/multipart/parser.rb:283 def on_mime_body(mime_index, content); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:231 + # pkg:gem/rack#lib/rack/multipart/parser.rb:287 def on_mime_finish(mime_index); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:211 + # pkg:gem/rack#lib/rack/multipart/parser.rb:267 def on_mime_head(mime_index, head, filename, content_type, name); end private - # pkg:gem/rack#lib/rack/multipart/parser.rb:236 + # pkg:gem/rack#lib/rack/multipart/parser.rb:292 def check_part_limits; end end -# pkg:gem/rack#lib/rack/multipart/parser.rb:189 +# pkg:gem/rack#lib/rack/multipart/parser.rb:245 class Rack::Multipart::Parser::Collector::BufferPart < ::Rack::Multipart::Parser::Collector::MimePart - # pkg:gem/rack#lib/rack/multipart/parser.rb:191 + # pkg:gem/rack#lib/rack/multipart/parser.rb:247 def close; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:190 + # pkg:gem/rack#lib/rack/multipart/parser.rb:246 def file?; end end -# pkg:gem/rack#lib/rack/multipart/parser.rb:166 +# pkg:gem/rack#lib/rack/multipart/parser.rb:222 class Rack::Multipart::Parser::Collector::MimePart < ::Struct - # pkg:gem/rack#lib/rack/multipart/parser.rb:167 + # pkg:gem/rack#lib/rack/multipart/parser.rb:223 def get_data; end end -# pkg:gem/rack#lib/rack/multipart/parser.rb:194 +# pkg:gem/rack#lib/rack/multipart/parser.rb:250 class Rack::Multipart::Parser::Collector::TempfilePart < ::Rack::Multipart::Parser::Collector::MimePart - # pkg:gem/rack#lib/rack/multipart/parser.rb:196 + # pkg:gem/rack#lib/rack/multipart/parser.rb:252 def close; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:195 + # pkg:gem/rack#lib/rack/multipart/parser.rb:251 def file?; end end -# pkg:gem/rack#lib/rack/multipart/parser.rb:120 +# pkg:gem/rack#lib/rack/multipart/parser.rb:121 Rack::Multipart::Parser::EMPTY = T.let(T.unsafe(nil), Rack::Multipart::Parser::MultipartInfo) -# pkg:gem/rack#lib/rack/multipart/parser.rb:65 +# pkg:gem/rack#lib/rack/multipart/parser.rb:648 +Rack::Multipart::Parser::ENCODING_NAMES = T.let(T.unsafe(nil), Set) + +# pkg:gem/rack#lib/rack/multipart/parser.rb:66 Rack::Multipart::Parser::MIME_HEADER_BYTESIZE_LIMIT = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:119 +# pkg:gem/rack#lib/rack/multipart/parser.rb:120 class Rack::Multipart::Parser::MultipartInfo < ::Struct - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def params; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def params=(_); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def tmp_files; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def tmp_files=(_); end class << self - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def [](*_arg0); end - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def inspect; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def keyword_init?; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def members; end - # pkg:gem/rack#lib/rack/multipart/parser.rb:119 + # pkg:gem/rack#lib/rack/multipart/parser.rb:120 def new(*_arg0); end end end -# pkg:gem/rack#lib/rack/multipart/parser.rb:374 +# pkg:gem/rack#lib/rack/multipart/parser.rb:430 Rack::Multipart::Parser::OBS_UNFOLD = T.let(T.unsafe(nil), Regexp) -# pkg:gem/rack#lib/rack/multipart/parser.rb:84 +# pkg:gem/rack#lib/rack/multipart/parser.rb:85 Rack::Multipart::Parser::PARSER_BYTESIZE_LIMIT = T.let(T.unsafe(nil), Integer) -# pkg:gem/rack#lib/rack/multipart/parser.rb:600 +# pkg:gem/rack#lib/rack/multipart/parser.rb:671 Rack::Multipart::Parser::REENCODE_DUMMY_ENCODINGS = T.let(T.unsafe(nil), Hash) -# pkg:gem/rack#lib/rack/multipart/parser.rb:56 +# pkg:gem/rack#lib/rack/multipart/parser.rb:57 Rack::Multipart::Parser::TEMPFILE_FACTORY = T.let(T.unsafe(nil), Proc) -# pkg:gem/rack#lib/rack/multipart/parser.rb:55 +# pkg:gem/rack#lib/rack/multipart/parser.rb:56 Rack::Multipart::Parser::TEXT_PLAIN = T.let(T.unsafe(nil), String) # Despite the misleading name, UploadedFile is designed for use for @@ -2442,7 +2464,7 @@ class Rack::QueryParser # pkg:gem/rack#lib/rack/query_parser.rb:128 def _normalize_params(params, name, v, depth); end - # pkg:gem/rack#lib/rack/query_parser.rb:222 + # pkg:gem/rack#lib/rack/query_parser.rb:229 def each_query_pair(qs, separator, unescaper = T.unsafe(nil)); end # pkg:gem/rack#lib/rack/query_parser.rb:210 @@ -2451,7 +2473,7 @@ class Rack::QueryParser # pkg:gem/rack#lib/rack/query_parser.rb:206 def params_hash_type?(obj); end - # pkg:gem/rack#lib/rack/query_parser.rb:253 + # pkg:gem/rack#lib/rack/query_parser.rb:267 def unescape(string, encoding = T.unsafe(nil)); end class << self @@ -2467,7 +2489,7 @@ Rack::QueryParser::BYTESIZE_LIMIT = T.let(T.unsafe(nil), Integer) Rack::QueryParser::COMMON_SEP = T.let(T.unsafe(nil), Hash) # pkg:gem/rack#lib/rack/query_parser.rb:8 -Rack::QueryParser::DEFAULT_SEP = T.let(T.unsafe(nil), Regexp) +Rack::QueryParser::DEFAULT_SEP = T.let(T.unsafe(nil), String) # InvalidParameterError is the error that is raised when incoming structural # parameters (parsed by parse_nested_query) contain invalid format or byte @@ -2489,9 +2511,9 @@ class Rack::QueryParser::ParameterTypeError < ::TypeError include ::Rack::BadRequest end -# pkg:gem/rack#lib/rack/query_parser.rb:257 +# pkg:gem/rack#lib/rack/query_parser.rb:271 class Rack::QueryParser::Params < ::Hash - # pkg:gem/rack#lib/rack/query_parser.rb:258 + # pkg:gem/rack#lib/rack/query_parser.rb:272 def to_params_hash; end end @@ -4576,7 +4598,7 @@ class Rack::Utils::Context end # pkg:gem/rack#lib/rack/utils.rb:24 -Rack::Utils::DEFAULT_SEP = T.let(T.unsafe(nil), Regexp) +Rack::Utils::DEFAULT_SEP = T.let(T.unsafe(nil), String) # Every standard HTTP code mapped to the appropriate message. # Generated with: diff --git a/sorbet/rbi/gems/semantic_logger@5.2.0.rbi b/sorbet/rbi/gems/semantic_logger@5.2.0.rbi deleted file mode 100644 index 9b7de8f3..00000000 --- a/sorbet/rbi/gems/semantic_logger@5.2.0.rbi +++ /dev/null @@ -1,6684 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `semantic_logger` gem. -# Please instead update this file by running `bin/tapioca gem semantic_logger`. - - -module Process - extend ::ConnectionPool::ForkTracker - extend ::RedisClient::PIDCache::CoreExt - extend ::SemanticLogger::CoreExt::Process - extend ::ActiveSupport::ForkTracker::CoreExt -end - -# Send log messages to Bugsnag -# -# Example: -# SemanticLogger.add_appender(appender: :bugsnag) -# -# Forward all log messages to CloudWatch Logs. -# -# Example: -# -# SemanticLogger.add_appender( -# appender: :cloudwatch_logs, -# client_kwargs: {region: "eu-west-1"}, -# group: "/my/application", -# create_stream: true -# ) -# Forward all log messages to Elasticsearch. -# -# Example: -# -# SemanticLogger.add_appender( -# appender: :elasticsearch, -# url: 'http://localhost:9200' -# ) -# Forward all log messages to Elasticsearch one at a time via a HTTP post. -# -# Note: -# * Other than in very low volume environments it is recommended to rather use the Elasticsearch appender, -# since it supports bulk logging. -# -# Example: -# SemanticLogger.add_appender( -# appender: :elasticsearch_http, -# url: 'http://localhost:9200' -# ) -# File appender -# -# Writes log messages to a file or open iostream -# -# Forward log entries to a Graylog server. -# -# Example: -# SemanticLogger.add_appender( -# appender: :graylog, -# url: 'udp://localhost:12201' -# ) -# -# Notes: -# * trace is not supported by Graylog, so trace level logging will appear as debug in Graylog. -# -# In the Graylog Web UI search screen, it is recommended to include the following fields: -# `duration`, `level`, `message`, `metric`, `name`, `tags -# Send log messages to honeybadger -# -# Example: -# SemanticLogger.add_appender(appender: :honeybadger) -# -# Send log messages to honeybadger events/insights API -# -# Example: -# SemanticLogger.add_appender(appender: :honeybadger_insights) -# -# Log to any HTTP(S) server that accepts log messages in JSON form -# -# Features: -# * JSON Formatted messages. -# * Uses a persistent http connection, if the server supports it. -# * SSL encryption (https). -# -# Example: -# SemanticLogger.add_appender( -# appender: :http, -# url: 'http://localhost:8088/path' -# ) -# -# Batching: -# By default each log message is posted individually. To post multiple log -# messages in a single request as a JSON array (for example to the Filebeat -# http_endpoint input), enable batching when adding the appender: -# SemanticLogger.add_appender( -# appender: :http, -# url: 'http://localhost:8088/path', -# batch: true -# ) -# Forward all log messages to Apache Kafka. -# -# Example: -# -# SemanticLogger.add_appender( -# appender: :kafka, -# -# # At least one of these nodes must be available: -# seed_brokers: ["kafka1:9092", "kafka2:9092"], -# -# # Set an optional client id in order to identify the client to Kafka: -# client_id: "my-application", -# ) -# Forward application metrics to a Loki instance using HTTP push API -# -# Example: -# SemanticLogger.add_appender( -# appender: :loki, -# url: "https://logs-prod-001.grafana.net", -# username: "grafana_username", -# password: "grafana_token_here", -# compress: true -# ) -# Send log messages to NewRelic -# -# The :error and :fatal log entries will show up under -# "Applications" > "Application Name" > "Events" > "Errors" in New Relic. -# -# Example: -# SemanticLogger.add_appender(appender: :new_relic) -# Send log messages to NewRelic -# -# All log entries will appear under -# "Logs" in New Relic -# -# == Caveats -# -# * The NewRelic agent only sends logs to NewRelic when log forwarding is enabled. There is however an open -# issue to get this fixed: https://github.com/newrelic/newrelic-ruby-agent/issues/1614. Please see the guide -# for a workaround. -# -# Example: -# SemanticLogger.add_appender(appender: :new_relic_logs) -# Open Telemetry Appender -# -# Writes log messages, and metrics to Open Telemetry. -# -# Forward all log messages to OpenSearch (e.g. AWS OpenSearch). -# -# OpenSearch is a fork of Elasticsearch 7.10. The client API and bulk -# protocol are identical, so this appender reuses the same pipeline as the -# Elasticsearch appender; only the backing client gem differs. Use this -# appender (with the `opensearch-ruby` gem) instead of `:elasticsearch` -# when talking to an OpenSearch server, since modern `elasticsearch` gems -# reject non-Elasticsearch servers via a product check. -# -# Example: -# -# SemanticLogger.add_appender( -# appender: :opensearch, -# url: 'http://localhost:9200' -# ) -# Forward all log messages to RabbitMQ. -# -# Example: -# -# SemanticLogger.add_appender( -# appender: :rabbitmq, -# -# # Name of the queue in RabbitMQ where to publish the logs. This queue will be bound to "amqp.direct" exchange. -# queue_name: 'semantic_logger', -# -# # This host will be used for RabbitMQ connection. -# # NOTE this is different than :host option which is used by the logger directly. -# rabbitmq_host: '127.0.0.1', -# -# # RabbitMQ credentials -# username: 'my-username', -# password: 'my-secrect-pass', -# -# # All other options accepted by Bunny.new call -# vhost: 'production', -# ) -# Send log messages to sentry -# -# Example: -# SemanticLogger.add_appender(appender: :sentry) -# -# Send log messages to sentry -# -# Example: -# SemanticLogger.add_appender(appender: :sentry_ruby) -# -# Splunk log appender. -# -# Use the official splunk gem to log messages to Splunk. -# -# Deprecated: will be removed in v6. Use the :splunk_http appender instead. -# The splunk-sdk-ruby gem (last released in 2015) does not verify the server's TLS certificate, -# so its connection, including the login credentials, is open to interception. -# -# Example -# SemanticLogger.add_appender( -# appender: :splunk, -# username: 'username', -# password: 'password', -# host: 'localhost', -# port: 8089, -# scheme: :https, -# index: 'main' -# ) -# Splunk log appender using the Splunk HTTP(S) listener. -# -# Use the newer, faster and more complete JSON over HTTP interface for Splunk. -# -# To configure Splunk to receive log messages via this appender: -# http://dev.splunk.com/view/event-collector/SP-CAAAE7F -# -# Example -# SemanticLogger.add_appender( -# appender: :splunk_http, -# url: 'http://localhost:8080', -# token: '70CA900C-3D7E-42A4-9C79-7975D1C422A8' -# ) -# Send log messages to local syslog, or remote syslog servers over TCP or UDP. -# -# Example: -# # Log to a local Syslog daemon -# SemanticLogger.add_appender(appender: :syslog) -# -# Example: -# # Log to a remote Syslog server over TCP: -# SemanticLogger.add_appender( -# appender: :syslog, -# url: 'tcp://myloghost:514' -# ) -# -# Example: -# # Log to a remote Syslog server over UDP: -# SemanticLogger.add_appender( -# appender: :syslog, -# url: 'udp://myloghost:514' -# ) -# -# Example: -# # Log to a remote Syslog server using the CEE format over TCP: -# SemanticLogger.add_appender( -# appender: :syslog, -# url: 'tcp://myloghost:514' -# ) -# -# Send log messages to any standard Ruby logging class. -# -# Forwards logging call to loggers such as Logger, log4r, etc. -# Base logger -# -# Abstract base class for loggers -# -# Implements common behavior such as log level, default text formatter etc -# -# Logger class variable mix-in -# -# Lazy initialize a logger class variable with instance accessor -# -# By including this mix-in into any class it will define a class level logger -# and also make it accessible via instance methods -# -# Example: -# require 'semantic_logger' -# SemanticLogger.default_level = :debug -# SemanticLogger.add_appender(io: $stdout, formatter: :color) -# -# class ExternalSupplier -# # Create class and instance logger methods -# include SemanticLogger::Loggable -# -# def call_supplier(amount, name) -# logger.debug "Calculating with amount", { amount: amount, name: name } -# -# # Measure and log on completion how long the call took to the external supplier -# logger.measure_info "Calling external interface" do -# # Code to call the external supplier ... -# end -# end -# end -# -# Notes: -# * To forcibly replace Rails or any other existing logging methods -# use `prepend` instead of `include`. For example: -# ExternalSupplier.prepend SemanticLogger::Loggable -# Send Metrics to NewRelic -# -# The :error and :fatal log entries will show up under -# "Applications" > "Application Name" > "Events" > "Errors" in New Relic. -# -# Example: -# SemanticLogger.add_appender(metric: :new_relic) -# Forward application metrics to SignalFx. -# -# Example: -# SemanticLogger.add_appender( -# metric: :signalfx, -# token: 'SIGNALFX_ORG_ACCESS_TOKEN' -# ) -# Abstract Subscriber -# -# Abstract base class for all appenders. -# -# pkg:gem/semantic_logger#lib/semantic_logger/version.rb:1 -module SemanticLogger - class << self - # Return a logger for the supplied class or class_name. - # - # When `SemanticLogger.cache_loggers` is enabled (opt-in, default off) and a - # Class or Module is supplied, the same Logger instance is returned for every - # call with that class. This makes it possible to obtain a logger once and - # later change its level (or filter) and have every holder of that logger see - # the change. - # - # A String is always given its own new Logger instance, even when caching is - # enabled: callers that pass a string typically want an independent logger - # (for example to set a different level per call site). Anonymous classes - # (those with no `name`) are never cached, to avoid pinning short-lived - # dynamically created classes in memory. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:20 - def [](klass); end - - # Add a new logging appender as a new destination for all log messages - # emitted from Semantic Logger - # - # Appenders will be written to in the order that they are added - # - # If a block is supplied then it will be used to customize the format - # of the messages sent to that appender. See SemanticLogger::Logger.new for - # more information on custom formatters - # - # Parameters - # file_name: [String] - # File name to write log messages to. - # - # Or, - # io: [IO] - # An IO Stream to log to. - # For example $stdout, $stderr, etc. - # - # Or, - # appender: [Symbol|SemanticLogger::Subscriber] - # A symbol identifying the appender to create. - # For example: - # :bugsnag, :elasticsearch, :graylog, :http, :mongodb, :new_relic, :splunk_http, :syslog, :wrapper - # Or, - # An instance of an appender derived from SemanticLogger::Subscriber - # For example: - # SemanticLogger::Appender::Http.new(url: 'http://localhost:8088/path') - # - # Or, - # logger: [Logger|Log4r] - # An instance of a Logger or a Log4r logger. - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # formatter: [Symbol|Object|Proc] - # Any of the following symbol values: :default, :color, :json, :logfmt, etc... - # Or, - # An instance of a class that implements #call - # Or, - # A Proc to be used to format the output from this appender - # Default: :default - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # Examples: - # - # # Send all logging output to Standard Out (Screen) - # SemanticLogger.add_appender(io: $stdout) - # - # # Send all logging output to a file - # SemanticLogger.add_appender(file_name: 'logfile.log') - # - # # Send all logging output to a file and only :info and above to standard output - # SemanticLogger.add_appender(file_name: 'logfile.log') - # SemanticLogger.add_appender(io: $stdout, level: :info) - # - # Log to log4r, Logger, etc.: - # - # # Send Semantic logging output to an existing logger - # require 'logger' - # require 'semantic_logger' - # - # # Built-in Ruby logger - # log = Logger.new($stdout) - # log.level = Logger::DEBUG - # - # SemanticLogger.default_level = :debug - # SemanticLogger.add_appender(logger: log) - # - # logger = SemanticLogger['Example'] - # logger.info "Hello World" - # logger.debug("Login time", user: 'Joe', duration: 100, ip_address: '127.0.0.1') - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:198 - def add_appender(**args, &); end - - # Add signal handlers for Semantic Logger - # - # Two signal handlers will be registered by default: - # - # 1. Changing the log_level: - # - # The log level can be changed without restarting the process by sending the - # log_level_signal, which by default is 'USR2' - # - # When the log_level_signal is raised on this process, the global default log level - # rotates through the following log levels in the following order, starting - # from the current global default level: - # :fatal, :error, :warn, :info, :debug, :trace - # - # If the current level is :trace it wraps around back to :fatal - # - # 2. Logging a Ruby thread dump - # - # When the signal is raised on this process, Semantic Logger will write the list - # of threads to the log file, along with their back-traces when available - # - # For JRuby users this thread dump differs form the standard QUIT triggered - # Java thread dump which includes system threads and Java stack traces. - # - # It is recommended to name any threads you create in the application, by - # calling the following from within the thread itself: - # Thread.current.name = 'My Worker' - # - # Also adds JRuby Garbage collection logging so that any garbage collections - # that exceed the time threshold will be logged. Default: 100 ms - # Currently only supported when running JRuby - # - # Note: - # To only register one of the signal handlers, set the other to nil - # Set gc_log_microseconds to nil to not enable JRuby Garbage collections - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:340 - def add_signal_handler(log_level_signal = T.unsafe(nil), thread_dump_signal = T.unsafe(nil), gc_log_microseconds = T.unsafe(nil)); end - - # Returns [SemanticLogger::Subscriber] a copy of the list of active - # appenders for debugging etc. - # Use SemanticLogger.add_appender and SemanticLogger.remove_appender - # to manipulate the active appenders list - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:223 - def appenders; end - - # Returns [String] name of this application for logging purposes - # Note: Not all appenders use `application` - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:97 - def application; end - - # Override the default application - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:102 - def application=(application); end - - # Returns the current backtrace level - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:74 - def backtrace_level; end - - # Sets the level at which backtraces should be captured - # for every log message. - # - # By enabling backtrace capture the filename and line number of where - # message was logged can be written to the log file. Additionally, the backtrace - # can be forwarded to error management services such as Bugsnag. - # - # Warning: - # Capturing backtraces is very expensive and should not be done all - # the time. It is recommended to run it at :error level in production. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:67 - def backtrace_level=(level); end - - # Returns the current backtrace level index - # For internal use only - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:80 - def backtrace_level_index; end - - # Whether `SemanticLogger[Class]` returns a shared, cached Logger instance per - # class. Disabled by default. Strings are never cached (see #[]). - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:28 - def cache_loggers=(cache_loggers); end - - # Returns whether logger caching is enabled. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:34 - def cache_loggers?; end - - # Clear out all previously registered appenders - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:215 - def clear_appenders!; end - - # Discard all cached loggers so that subsequent `SemanticLogger[Class]` calls - # build fresh instances. Primarily useful in tests, or after redefining a - # class that was previously cached. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:41 - def clear_logger_cache; end - - # Close all appenders and flush any outstanding messages. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:234 - def close; end - - # Returns the global default log level - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:53 - def default_level; end - - # Sets the global default log level - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:46 - def default_level=(level); end - - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:592 - def default_level_index; end - - # Returns [String] name of this environment for logging purposes - # Note: Not all appenders use `environment` - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:108 - def environment; end - - # Override the default environment - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:113 - def environment=(environment); end - - # If the tag being supplied is definitely a string then this fast - # tag api can be used for short lived tags - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:375 - def fast_tag(tag); end - - # Flush all queued log entries disk, database, etc. - # All queued log messages are written and then each appender is flushed in turn. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:229 - def flush; end - - # Returns [String] name of this host for logging purposes - # Note: Not all appenders use `host` - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:86 - def host; end - - # Override the default host name - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:91 - def host=(host); end - - # Returns the check_interval which is the number of messages between checks - # to determine if the appender thread is falling behind. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:564 - def lag_check_interval; end - - # Set the check_interval which is the number of messages between checks - # to determine if the appender thread is falling behind. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:570 - def lag_check_interval=(lag_check_interval); end - - # Returns the amount of time in seconds - # to determine if the appender thread is falling behind. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:576 - def lag_threshold_s; end - - # :nodoc - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:451 - def named_tagged(hash); end - - # Returns [Hash] a copy of the named tags currently active for this thread. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:464 - def named_tags; end - - # Drop log messages instead of blocking the calling thread when the main - # pipeline queue is full. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:588 - def non_blocking=(non_blocking); end - - # Returns [true|false] whether log messages are dropped instead of blocking - # when the main pipeline queue is full. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:582 - def non_blocking?; end - - # Supply a callback to be called whenever a log entry is created. - # Useful for capturing appender specific context information. - # - # Parameters - # object: [Object | Proc] - # [Proc] the block to call. - # [Object] any object on which to call #call. - # - # Example: - # SemanticLogger.on_log do |log| - # log.set_context(:honeybadger, Honeybadger.get_context) - # end - # - # Example: - # module CaptureContext - # def call(log) - # log.set_context(:honeybadger, Honeybadger.get_context) - # end - # end - # SemanticLogger.on_log(CaptureContext) - # - # Note: - # * This callback is called within the thread of the application making the logging call. - # * If these callbacks are slow they will slow down the application. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:301 - def on_log(object = T.unsafe(nil), &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:481 - def pop_named_tags(quantity = T.unsafe(nil)); end - - # Remove specified number of tags from the current tag list - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:445 - def pop_tags(quantity = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:476 - def push_named_tags(hash); end - - # Add tags to the current scope - # - # Note: - # - This method does not flatten the array or remove any empty elements, or duplicates - # since the performance penalty is excessive. - # - To get the flattening behavior use the slower api: - # `logger.push_tags` - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:439 - def push_tags(*tags); end - - # Returns [Integer] the number of log entries waiting to be written to the appenders. - # - # When this number grows it is because the logging appender thread is not - # able to write to the appenders fast enough. Either reduce the amount of - # logging, increase the log level, reduce the number of appenders, or - # look into speeding up the appenders themselves - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:536 - def queue_size; end - - # Remove an existing appender - # Currently only supports appender instances - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:207 - def remove_appender(appender); end - - # Re-open any open file handles etc. to resources. - # - # Called automatically in the child process after a fork (see reopen_on_fork?), - # and may also be called manually. - # - # To avoid reopening twice after a single fork (for example when the automatic - # fork hook and a framework's `after_fork` callback both fire), reopen is a no-op - # if it has already run in the current process. Pass `force: true` to override - # this guard and reopen unconditionally, for example when re-opening file handles - # in the same process after an external log rotation. - # - # Note: - # Not all appender's implement reopen. - # Check the code for each appender you are using before relying on this behavior. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:252 - def reopen(force: T.unsafe(nil)); end - - # Enable or disable automatic reopening of appenders after a fork. - # - # # Opt out of the automatic behavior and manage reopen manually: - # SemanticLogger.reopen_on_fork = false - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:273 - def reopen_on_fork=(reopen_on_fork); end - - # Whether appenders are automatically reopened in the child process after a fork. - # - # Enabled by default. A `Process._fork` hook (Ruby 3.1+) calls SemanticLogger.reopen - # in the child after `fork`, `Process.daemon`, `IO.popen`, `Kernel#system`, and - # backticks, so framework specific `after_fork` hooks (Puma, Unicorn, Resque, - # Spring, etc.) are no longer required. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:265 - def reopen_on_fork?; end - - # Silence noisy log levels by changing the default_level within the block - # - # This setting is thread-safe and only applies to the current thread - # - # Any threads spawned within the block will not be affected by this setting - # - # #silence can be used to both raise and lower the log level within - # the supplied block. - # - # Example: - # - # # Perform trace level logging within the block when the default is higher - # SemanticLogger.default_level = :info - # - # logger.debug 'this will _not_ be logged' - # - # SemanticLogger.silence(:trace) do - # logger.debug "this will be logged" - # end - # - # Parameters - # new_level - # The new log level to apply within the block - # Default: :error - # - # Example: - # # Silence all logging for this thread below :error level - # SemanticLogger.silence do - # logger.info "this will _not_ be logged" - # logger.warn "this neither" - # logger.error "but errors will be logged" - # end - # - # Note: - # #silence does not affect any loggers which have had their log level set - # explicitly. I.e. That do not rely on the global default level - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:522 - def silence(new_level = T.unsafe(nil)); end - - # Returns [Hash] operational statistics for the logging pipeline. - # - # Useful for exporting Semantic Logger's own health to a monitoring system such as - # Prometheus, statsd, etc. The returned Hash contains: - # - # queue_size: [Integer] Number of log messages waiting on the main pipeline queue. - # capped: [Boolean] Whether the main queue has a maximum size. - # max_queue_size: [Integer] Maximum queue size, or nil when uncapped. - # thread_active: [Boolean] Whether the main pipeline thread is running. - # processed: [Integer] Cumulative number of log messages processed since startup. - # dropped: [Integer] Cumulative number of log messages dropped at the main queue. - # appenders: [Array] Per-appender statistics. Appenders that run their own - # async thread report their queue_size and - # processed/dropped/failed counts; appenders that log - # inline report `async: false`. - # - # All counters are cumulative since process startup. They are thread-safe to read and - # are maintained without adding any locking to the logging hot path. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:558 - def stats; end - - # Run Semantic Logger in Synchronous mode. - # - # I.e. Instead of logging messages in a separate thread for better performance, - # log them using the current thread. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:600 - def sync!; end - - # Running in synchronous mode? - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:605 - def sync?; end - - # Add the tags or named tags to the list of tags to log for this thread whilst the supplied block is active. - # - # Returns result of block. - # - # Tagged example: - # SemanticLogger.tagged(12345, 'jack') do - # logger.debug('Hello World') - # end - # - # Named Tags (Hash) example: - # SemanticLogger.tagged(tracking_number: 12345) do - # logger.debug('Hello World') - # end - # - # Notes: - # - Tags should be a list without any empty values, or contain any array. - # - `logger.tagged` is a slower api that will flatten the example below: - # `logger.tagged([['first', nil], nil, ['more'], 'other'])` - # to the equivalent of: - # `logger.tagged('first', 'more', 'other')` - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:407 - def tagged(*tags, &); end - - # Returns a copy of the [Array] of [String] tags currently active for this thread - # Returns nil if no tags are set - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:426 - def tags; end - - private - - # Lazily initialized thread-safe cache of one Logger per Class/Module. - # - # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:619 - def logger_cache; end - end -end - -# Formatting & colors used by optional color formatter -# -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:3 -module SemanticLogger::AnsiColors; end - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:6 -SemanticLogger::AnsiColors::BLACK = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:10 -SemanticLogger::AnsiColors::BLUE = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:5 -SemanticLogger::AnsiColors::BOLD = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:4 -SemanticLogger::AnsiColors::CLEAR = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:12 -SemanticLogger::AnsiColors::CYAN = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:8 -SemanticLogger::AnsiColors::GREEN = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:11 -SemanticLogger::AnsiColors::MAGENTA = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:7 -SemanticLogger::AnsiColors::RED = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:13 -SemanticLogger::AnsiColors::WHITE = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:9 -SemanticLogger::AnsiColors::YELLOW = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:2 -module SemanticLogger::Appender - class << self - # Returns [SemanticLogger::Subscriber] appender for the supplied options - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:35 - def factory(async: T.unsafe(nil), batch: T.unsafe(nil), max_queue_size: T.unsafe(nil), lag_check_interval: T.unsafe(nil), lag_threshold_s: T.unsafe(nil), batch_size: T.unsafe(nil), batch_seconds: T.unsafe(nil), non_blocking: T.unsafe(nil), dropped_message_report_seconds: T.unsafe(nil), async_max_retries: T.unsafe(nil), **args, &); end - - private - - # Returns [Subscriber] instance from the supplied options. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:76 - def build(io: T.unsafe(nil), file_name: T.unsafe(nil), appender: T.unsafe(nil), metric: T.unsafe(nil), logger: T.unsafe(nil), **args, &); end - end -end - -# Proxy that allows any appender to run asynchronously in a separate thread. -# -# The worker thread and the in-memory queue are owned by an internal -# SemanticLogger::QueueProcessor. This proxy forwards log/flush/close/reopen on to the -# processor, and forwards the remaining appender methods (name, level, ...) directly to -# the wrapped appender so they keep executing on the caller's thread. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:11 -class SemanticLogger::Appender::Async - extend ::Forwardable - - # Appender proxy to allow an existing appender to run asynchronously in a separate thread. - # - # Parameters: - # appender: [SemanticLogger::Subscriber] - # The appender to log to in a separate thread. - # - # max_queue_size: [Integer] - # The maximum number of log messages to hold on the queue before blocking attempts to add to the queue. - # -1: The queue size is uncapped and will never block no matter how long the queue is. - # Default: 10,000 - # - # lag_threshold_s [Float] - # Log a warning when a log message has been on the queue for longer than this period in seconds. - # Default: 30 - # - # lag_check_interval: [Integer] - # Number of messages to process before checking for slow logging. - # Default: 1,000 - # Note: Not applicable when batch: true. - # - # batch: [true|false] - # Process log messages in batches via the appender's #batch method, instead of one at a time. - # The appender must implement #batch. - # Default: false - # - # batch_size: [Integer] - # Maximum number of messages to batch up before sending. - # Default: 300 - # Note: Only applicable when batch: true. - # - # batch_seconds: [Integer] - # Maximum number of seconds between sending batches. - # Default: 5 - # Note: Only applicable when batch: true. - # - # non_blocking: [true|false] - # Whether to drop log messages instead of blocking the calling thread when the queue is full. - # When true and the queue is capped, attempts to add to a full queue return immediately and - # the message is dropped. The number of dropped messages is logged to the internal logger - # periodically (see dropped_message_report_seconds). Only applies to a capped queue. - # Default: false - # - # dropped_message_report_seconds: [Integer] - # When non_blocking is enabled, log the count of dropped messages to the internal logger - # at most once every this number of seconds. Also limits how often messages discarded - # because their content could not be written are reported, after the first. - # Default: 30 - # - # async_max_retries: [Integer] - # Maximum number of consecutive times to restart the worker thread (with a back-off) - # after it raises an exception while processing messages, before giving up and stopping - # the thread. The counter resets after any message is processed successfully. - # -1: Retry indefinitely and never stop the thread (the pre-v5 behaviour). - # Default: 100 - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:87 - def initialize(appender:, **args); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def active?(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:14 - def appender; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def application(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def batch?(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def capped?(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def close(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def console_output?(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def console_stream(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def dropped_count(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def environment(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def failed_count(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def filter(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def flush(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def host(*args, **, &block); end - - # Returns [String] the class and object address of this proxy, whether it batches, and the - # wrapped appender's own #inspect, which shows only what that appender says is safe, but none of - # the instance variables of this proxy or its queue processor. See Subscriber#inspect. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:95 - def inspect; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def lag_check_interval(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def lag_check_interval=(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def lag_threshold_s(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def lag_threshold_s=(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def level(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def level=(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def log(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def logger(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def logger=(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def max_queue_size(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def name(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def non_blocking=(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def non_blocking?(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def processed_count(*args, **, &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:14 - def processor; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def queue(*args, **, &block); end - - # Re-open appender after a fork. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:101 - def reopen; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 - def should_log?(*args, **, &block); end - - # Returns [Hash] operational statistics for this appender. - # - # name: [String] Name of the wrapped appender. - # async: [true] This appender logs asynchronously via a separate thread. - # thread_active: [Boolean] Whether the worker thread is currently running. - # queue_size: [Integer] Number of log messages currently waiting to be written. - # capped: [Boolean] Whether the queue has a maximum size. - # max_queue_size: [Integer] Maximum queue size, or nil when uncapped. - # processed: [Integer] Cumulative number of log messages written since startup. - # dropped: [Integer] Cumulative number of log messages dropped because the queue - # was full (only possible when non_blocking is enabled). - # failed: [Integer] Cumulative number of log messages discarded because their - # content could not be written (see Subscriber#message_error?). - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:119 - def stats; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:26 - def thread(*args, **, &block); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:14 -class SemanticLogger::Appender::Bugsnag < ::SemanticLogger::Subscriber - # Create Bugsnag Error / Exception Appender - # - # Parameters - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: :error - # - # formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:32 - def initialize(level: T.unsafe(nil), **args, &block); end - - # Returns [Hash] of parameters to send to Bugsnag. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:43 - def call(log, logger); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:53 - def log(log); end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:66 - def bugsnag_notify(exception, hash, level); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:78 - def extract_exception(log); end - - # Bugsnag supports: error, warning or info - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:91 - def log_level(level); end -end - -# Abstract base appender for Elasticsearch-compatible search engines. -# -# Implements the shared bulk-indexing pipeline used by both the -# {Elasticsearch} and {OpenSearch} appenders. Subclasses only need to -# supply the backing client class. -# -# This class is internal: applications add an appender via -# `SemanticLogger.add_appender(appender: :elasticsearch, ...)` or -# `appender: :opensearch`, never by referencing this class directly. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:14 -class SemanticLogger::Appender::ElasticsearchBase < ::SemanticLogger::Subscriber - # Create an Elasticsearch-compatible appender over persistent HTTP(S). - # - # Parameters: - # index: [String] - # Prefix of the index to store the logs in. - # The final index appends the date so that indexes are used per day. - # I.e. The final index will look like 'semantic_logger-YYYY.MM.DD' - # Default: 'semantic_logger' - # - # date_pattern: [String] - # The time format used to generate the full index name. Useful - # if you want monthly indexes ('%Y.%m') or weekly ('%Y.%W'). - # Default: '%Y.%m.%d' - # - # type: [String] - # Deprecated and ignored. Document `_type` has been unused since - # Elasticsearch 7 and is ignored by OpenSearch. Passing it logs a - # deprecation warning; it will be removed in v6. - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # formatter: [Object|Proc|Symbol|Hash] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: :raw_json (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # Client Parameters (passed through to the backing client): - # url: [String] - # Fully qualified address to the service. - # Default: 'http://localhost:9200' - # - # hosts: [String|Hash|Array] - # Single host passed as a String or Hash, or multiple hosts - # passed as an Array; `host` or `url` keys are also valid. - # Note: - # :url above is ignored when supplying this option. - # - # resurrect_after [Float] - # After how many seconds a dead connection should be tried again. - # - # reload_connections [true|false|Integer] - # Reload connections after X requests. - # Default: false - # - # randomize_hosts [true|false] - # Shuffle connections on initialization and reload. - # Default: false - # - # sniffer_timeout [Integer] - # Timeout for reloading connections in seconds. - # Default: 1 - # - # retry_on_failure [true|false|Integer] - # Retry X times when request fails before raising and exception. - # Default: false - # - # retry_on_status [Array] - # Retry when specific status codes are returned. - # - # reload_on_failure [true|false] - # Reload connections after failure. - # Default: false - # - # request_timeout [Integer] - # The request timeout to be passed to transport in options. - # - # adapter [Symbol] - # A specific adapter for Faraday (e.g. `:patron`) - # - # transport_options [Hash] - # Options to be passed to the `Faraday::Connection` constructor. - # - # transport_class [Constant] - # A specific transport class to use, will be initialized by - # the client and passed hosts and all arguments. - # - # transport [Object] - # A specific transport instance. - # - # serializer_class [Constant] - # A specific serializer class to use, will be initialized by - # the transport and passed the transport instance. - # - # selector - # An instance of a connection selector strategy. - # - # send_get_body_as [String] - # Specify the HTTP method to use for GET requests with a body. - # Default: 'GET' - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:123 - def initialize(url: T.unsafe(nil), index: T.unsafe(nil), date_pattern: T.unsafe(nil), type: T.unsafe(nil), level: T.unsafe(nil), formatter: T.unsafe(nil), filter: T.unsafe(nil), application: T.unsafe(nil), environment: T.unsafe(nil), host: T.unsafe(nil), data_stream: T.unsafe(nil), **client_args, &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:169 - def batch(logs); end - - # The whole batch is formatted into a single bulk request before anything is sent. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:180 - def batch_all_or_nothing?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def batch_size; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def batch_size=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def client; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def client=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def client_args; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def client_args=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def date_pattern; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def date_pattern=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def flush_interval; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def flush_interval=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def index; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def index=(_arg0); end - - # The url without its credentials, and the index. See Subscriber#inspect. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:185 - def inspect_details; end - - # Log to the index for today - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:164 - def log(log); end - - # The url is left to the client gem to parse, since it also takes a comma separated list of - # urls, an Array of them, or hosts without a scheme. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:159 - def reopen; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def timeout_interval; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def timeout_interval=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def url; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:15 - def url=(_arg0); end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:224 - def bulk_index(log); end - - # Returns [String] the log message formatted as a bulk line, serialized by Utils.to_json - # and handed to the client as a String. The client gem's serializer writes Infinity and NaN - # as bare words, which is not JSON, and does not repair invalid UTF-8, a structure nested too - # deeply, or a Struct (written through its #inspect), so such an entry was dropped or its - # objects' instance variables were written. Serializing is part of formatting, so an error - # doing so discards the message rather than stalling the appender (see #format_log). A - # formatter that returns a String is taken to have serialized the line itself. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:204 - def bulk_line(log); end - - # Serializes the action lines; the documents already are (see #bulk_line). - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:209 - def bulk_write(messages); end - - # The backing client class, e.g. ::Elasticsearch::Client or ::OpenSearch::Client. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:193 - def client_class; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:231 - def default_formatter; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:15 -class SemanticLogger::Appender::ElasticsearchHttp < ::SemanticLogger::Appender::Http - # Create Elasticsearch appender over persistent HTTP(S) - # - # Parameters: - # index: [String] - # Prefix of the index to store the logs in Elasticsearch. - # The final index appends the date so that indexes are used per day. - # I.e. The final index will look like 'semantic_logger-YYYY.MM.DD' - # Default: 'semantic_logger' - # - # type: [String] - # Deprecated and ignored. Document `_type` has been unused since - # Elasticsearch 7. Passing it logs a deprecation warning; it will be - # removed in v6. - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # formatter: [Object|Proc|Symbol|Hash] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:54 - def initialize(index: T.unsafe(nil), type: T.unsafe(nil), url: T.unsafe(nil), **http_args, &); end - - # Deletes all log data captured for a day. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:80 - def delete_all(date = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:16 - def index; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:16 - def index=(_arg0); end - - # Log to the index for today. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:75 - def log(log); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:8 -class SemanticLogger::Appender::File < ::SemanticLogger::Subscriber - # Create an appender to log to a named file. - # - # Parameters - # file_name [String] - # Name of the file to write to. - # - # File name format directives: - # %p - Process Id - # %n - Short hostname (SemanticLogger.host). Everything before the first period in the hostname. - # %N - Full hostname (SemanticLogger.host) - # %a - Application name (SemanticLogger.application) - # %e - Environment name (SemanticLogger.environment) - # %D - Current Date. Equivalent to "%Y%m%d" - # %T - Current Time. Equivalent to "%H%M%S" - # %% - Literal `%` character - # - # Date: - # %Y - Year with century - # %C - year / 100 (round down. 20 in 2009) - # %y - year % 100 (00..99) - # %m - Month of the year, zero-padded (01..12) - # %d - Day of the month, zero-padded (01..31) - # %j - Day of the year (001..366) - # %U - Week number of the year. The week starts with Sunday. (00..53) - # %W - Week number of the year. The week starts with Monday. (00..53) - # - # Time: - # %H - 24 Hour of the day, zero-padded (00..23) - # %M - Minute of the hour (00..59) - # %S - Second of the minute (00..60) - # - # Examples: - # Create a log file name consisting of the short host name, process id, date, and time. - # "log/production-%n-%p-%D-%T.log" - # - # :level [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # :formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # :filter [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # :append [true|false] - # Append to the log file if already present? - # Default: true - # - # :exclusive_lock [true|false] - # Obtain an exclusive lock on the file, for operating systems that support it. - # Prevents multiple processes from trying to write to the same log file. - # Default: false - # - # :encoding ["UTF-8", "UTF-16", etc.] - # Encoding to use when writing to the file. - # Default: Encoding::BINARY - # - # :permissions [Integer] - # Octal file permissions to apply to the log file. - # Log files frequently contain sensitive information, so restrict access - # by supplying for example `0o640` (owner read/write, group read). - # Applied both when the file is created and to an existing log file, which must be - # a regular file owned by the process, with a single hard link, that the file_name - # names directly rather than through a symbolic link. Nothing is written to any - # other file, or when the file cannot be opened: the appender raises IOError when it - # is created, and when the file is later reopened, it reports why and writes nothing - # until the file is fixed, trying again every few seconds. - # Default: nil (use the process umask, the standard Ruby behavior) - # - # :retry_count [Integer] - # Number of times to attempt to re-open the file name when an error occurs trying to - # write to the file. - # Note: Set to 0 to disable retries. - # Default: 1 - # - # :reopen_period [String] - # Specify a period after which to re-open the log file, specified in minutes, hours, or days. - # The format of the duration must start with an Integer or Float number, - # followed by the duration specified as: - # "m" : minutes - # "h" : hours - # "d" : days - # The time is rounded down to the specified time interval, so that: - # - "1h" will re-open every hour at the beginning of the hour. - # - "30m" will re-open every 30 minutes at the beginning of the 30th minute. - # - "1d" will re-open every day at midnight. - # Examples: - # "60m" : Every 60 minutes at the beginning of the minute: 10:24:00, 11:24:00, 12:24:00, ... - # "1h" : Every hour at the beginning of the hour: 10:00:00, 11:00:00, 12:00:00, ... - # "1d" : Every day at the beginning of the day: "20211008 00:00:00", "20211009 00:00:00", ... - # Default: nil (Disabled) - # - # :reopen_count [Integer] - # Close and re-open the log file after every `reopen_count` number of logged entries. - # Default: 0 (Disabled) - # - # :reopen_size [Integer] - # Approximate number of bytes to write to a log file by this process before closing and re-opening it. - # Notes: - # - When `append: true` and the file already exists, it reads the size of the current log file - # and starts with that size. - # - If the current log file size already exceeds the `reopen_size`, its current size is ignored. - # - The `reopen_size` is only the amount of bytes written by this process, it excludes data - # written by other processes. Use a unique filename to prevent multiple processes from writing to - # the same log file at the same time. - # Default: 0 (Disabled) - # - # Example - # require "semantic_logger" - # - # # Enable trace level logging - # SemanticLogger.default_level = :info - # - # # Log to a file - # SemanticLogger.add_appender(file_name: "application.log", formatter: :color) - # - # logger = SemanticLogger["test"] - # logger.info "Hello World" - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:146 - def initialize(file_name, retry_count: T.unsafe(nil), append: T.unsafe(nil), reopen_period: T.unsafe(nil), reopen_count: T.unsafe(nil), reopen_size: T.unsafe(nil), encoding: T.unsafe(nil), exclusive_lock: T.unsafe(nil), permissions: T.unsafe(nil), **args, &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def append; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def append=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 - def current_file_name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def encoding; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def encoding=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def exclusive_lock; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def exclusive_lock=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def file_name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def file_name=(_arg0); end - - # Flush all pending logs to disk. - # Waits for all sent documents to be written to disk - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:235 - def flush; end - - # See Subscriber#inspect. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:240 - def inspect_details; end - - # Since only one appender thread will be writing to the file at a time - # it is not necessary to protect access to the file with a semaphore. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:208 - def log(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 - def log_count; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 - def log_size; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def permissions; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def permissions=(_arg0); end - - # After forking an active process call #reopen to re-open - # open the file handles etc to resources. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:177 - def reopen; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 - def reopen_at; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def reopen_count; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def reopen_count=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def reopen_period; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def reopen_period=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def reopen_size; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def reopen_size=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def retry_count; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 - def retry_count=(_arg0); end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:351 - def apply_format_directives(file_name); end - - # Round down the current time based on the period, then add on the duration for that period - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:410 - def calculate_reopen_at(duration, period, time = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:325 - def close_quietly(file); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:246 - def current_file_name=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:357 - def format_directive(directive); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:246 - def log_count=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:246 - def log_size=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:331 - def monotonic_time; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:384 - def next_reopen_period(period_string); end - - # Returns why the log file could not be opened with permissions. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:299 - def open_refusal(error); end - - # Opens the log file and applies the permissions to it, when it is safe to do so (see - # #permissions_refusal). Returns the open file, or nil after closing it and recording why it is - # refused, so that nothing is written to it. - # - # Changing the permissions of a file that another name links to could loosen them on an - # unrelated file, such as a private key linked into a shared log directory. Writing log messages - # to a file that this process does not own, or that another name links to, would let whoever - # controls it read them, despite the permissions asked for. So with permissions, the appender - # fails closed: it raises when it is created (see #initialize), and when the file is later - # reopened, on a rotation, a fork, or a write retry, it stops writing and reports why (see - # #refused) until the file is fixed (see #refused_retry_due?). - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:259 - def open_with_permissions(options); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:391 - def parse_period(period_string); end - - # Returns why the permissions must not be applied to the open log file, nor log messages - # written to it, or nil when they can. - # - # It must be a regular file owned by this process, with a single hard link, since a hard link - # planted in the log directory is otherwise indistinguishable from the file it links to. The - # path must also still name it, so that swapping the path after opening cannot redirect the - # log messages. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:312 - def permissions_refusal(file); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:294 - def refusal_message; end - - # Records why the log file is refused, and returns nil. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:276 - def refuse(reason, cause = T.unsafe(nil)); end - - # Reports why log messages are not being written to the log file, once for each file and - # reason, and returns false. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:285 - def refused; end - - # A refused log file is opened again every few seconds, and at the next scheduled reopen, - # rather than for every message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:345 - def refused_retry_due?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:246 - def reopen_at=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:335 - def time_to_reopen?; end -end - -# Seconds to wait before opening a refused log file again. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:19 -SemanticLogger::Appender::File::REFUSED_RETRY_INTERVAL = T.let(T.unsafe(nil), Integer) - -# With permissions, the log file is opened without following a symbolic link, so that a link -# planted in the log directory can neither create nor open the file it points at, without -# blocking, so that a planted FIFO fails to open instead of waiting for a reader, and without -# becoming the controlling terminal. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:17 -SemanticLogger::Appender::File::SECURE_OPEN_FLAGS = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:14 -class SemanticLogger::Appender::Honeybadger < ::SemanticLogger::Subscriber - # Honeybadger Appender - # - # Parameters - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: :error - # - # formatter: [Object|Proc|Symbol|Hash] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:40 - def initialize(level: T.unsafe(nil), **args, &block); end - - # Send an error notification to honeybadger - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:45 - def log(log); end - - private - - # Use Raw Formatter by default - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:65 - def default_formatter; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:14 -class SemanticLogger::Appender::HoneybadgerInsights < ::SemanticLogger::Subscriber - # Honeybadger Appender - # - # Parameters - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: :error - # - # formatter: [Object|Proc|Symbol|Hash] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:40 - def initialize(level: T.unsafe(nil), **args, &block); end - - # Send log to honeybadger events API - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:45 - def log(log); end - - private - - # Use Raw Formatter by default - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:56 - def default_formatter; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:31 -class SemanticLogger::Appender::Http < ::SemanticLogger::Subscriber - # Create HTTP(S) log appender - # - # Parameters: - # url: [String] - # Valid URL to post to. - # Example: http://example.com/some_path - # To enable SSL include https in the URL. - # Example: https://example.com/some_path - # verify_mode will default: OpenSSL::SSL::VERIFY_PEER - # A query string is kept and sent with every request that submits log data, - # for the log servers that are configured through it. - # Example: http://example.com/some_path?source=my_app - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # username: [String] - # User name for basic Authentication. - # Default: nil ( do not use basic auth ) - # - # password: [String] - # Password for basic Authentication. - # - # header: [Hash] - # Custom HTTP headers to send with each request. - # Default: {} ( do not send any custom headers) - # Example: {"Authorization" => "Bearer BEARER_TOKEN"} - # - # compress: [true|false] - # Whether to compress the JSON string with GZip. - # Default: false - # - # ssl: [Hash] - # Specific SSL options: For more details see NET::HTTP.start - # ca_file, ca_path, cert, cert_store, ciphers, key, ssl_timeout, - # ssl_version, verify_callback, verify_depth and verify_mode. - # - # proxy_url: [String] - # URL of proxy server to use for HTTP(s) connections. Should - # include username and password if required. - # Example: http://user@pass:example.com/some_path - # To enable SSL include https in the URL. - # Example: https://example.com/some_path - # If this is set to :ENV, Net::HTTP will use the environment http_proxy* - # variables if they are set. If set to nil then no proxy will be used, - # even if the environment variables are set. - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # open_timeout: [Float] - # Default: 2.0 - # - # read_timeout: [Float] - # Default: 1.0 - # - # continue_timeout: [Float] - # Default: 1.0 - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:117 - def initialize(url:, compress: T.unsafe(nil), ssl: T.unsafe(nil), username: T.unsafe(nil), password: T.unsafe(nil), header: T.unsafe(nil), proxy_url: T.unsafe(nil), open_timeout: T.unsafe(nil), read_timeout: T.unsafe(nil), continue_timeout: T.unsafe(nil), **args, &); end - - # Forward a batch of log messages to the HTTP Server in a single request. - # Only used when the appender is created with `batch: true`. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:219 - def batch(logs); end - - # The whole batch is formatted into a single request before anything is sent. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:233 - def batch_all_or_nothing?; end - - # The HTTP appender supports batching, but only when explicitly requested - # via `batch: true`, so that the default behaviour (one request per log - # message) is preserved. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:228 - def batch_by_default?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def compress; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def compress=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def continue_timeout; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def continue_timeout=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def header; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def header=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def http; end - - # Only the redacted url, since the instance variables hold the password, the authorization - # headers, and any credential a subclass adds. See Subscriber#inspect. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:245 - def inspect_details; end - - # Forward log messages to HTTP Server - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:211 - def log(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def open_timeout; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def open_timeout=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def path; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def port; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def proxy_url; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def query; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def read_timeout; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def read_timeout=(_arg0); end - - # Returns [String] the scheme, host, and any non-default port of the url. Safe to log. - # See Utils.redacted_url. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:239 - def redacted_url; end - - # Re-open after process fork - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:182 - def reopen; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def server; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def ssl_options; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:34 - def url; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def username; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:32 - def username=(_arg0); end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:261 - def compress_data(data); end - - # Use JSON Formatter by default - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:257 - def default_formatter; end - - # HTTP Delete - # - # The query string of the configured url is _not_ applied here: it configures how - # the server ingests log data, and servers reject it on a maintenance request. - # Appender::ElasticsearchHttp#delete_all deletes an index, and Elasticsearch fails - # the request with a 400 when it carries unrecognized parameters. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:287 - def delete(request_uri = T.unsafe(nil)); end - - # Returns [URI] the parsed url, without the url in the error raised for an invalid one. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:252 - def parse_url(url); end - - # HTTP Post - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:270 - def post(body, request_uri = T.unsafe(nil)); end - - # Process HTTP Request - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:309 - def process_request(request, body = T.unsafe(nil)); end - - # HTTP Put - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:276 - def put(body, request_uri = T.unsafe(nil)); end - - # Applies the query string of the configured url, if any, to the uri of a request - # that submits log data. - # - # Kept out of `path` on purpose: subclasses build their own request paths from it - # (Appender::ElasticsearchHttp appends the index name and `_doc` to it), and the - # query has to stay at the end of the request uri regardless. - # - # @param request_uri [String] path of the request, `path` by default. - # @return [String] - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:301 - def uri_with_query(request_uri); end -end - -# Maximum number of bytes of an error response body to write to the internal logger. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:37 -SemanticLogger::Appender::Http::MAX_LOGGED_RESPONSE_BODY = T.let(T.unsafe(nil), Integer) - -# Describes a valid url in the error raised for an invalid one. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:40 -SemanticLogger::Appender::Http::URL_FORMAT_HINT = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:7 -class SemanticLogger::Appender::IO < ::SemanticLogger::Subscriber - # Create a Stream Logger appender instance. - # - # Parameters - # io [IO] - # An IO stream to which to write the log messages to. - # - # :level [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # :formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # :filter [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # Example - # require "semantic_logger" - # - # # Enable trace level logging - # SemanticLogger.default_level = :info - # - # # Log to screen - # SemanticLogger.add_appender(io: $stdout, formatter: :color) - # - # logger = SemanticLogger['test'] - # logger.info 'Hello World' - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:40 - def initialize(io, **args, &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:63 - def console_stream; end - - # Flush all pending logs to disk. - # Waits for all sent documents to be written to disk - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:59 - def flush; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:49 - def log(log); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:13 -class SemanticLogger::Appender::Loki < ::SemanticLogger::Appender::Http - # Create Grafana Loki appender. - # - # Parameters: - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true. - # The Proc must return true or false. - # - # host: [String] - # Name of this host to send as a dimension. - # Default: SemanticLogger.host - # - # application: [String] - # Name of this application to send as a dimension. - # Default: SemanticLogger.application - # - # url: [String] - # Define the loki instance URL. - # Example: https://logs-prod-999.grafana.net - # A query string is kept and sent with every request. - # Example: https://logs-prod-999.grafana.net?orgid=my_org - # Default: nil - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:39 - def initialize(url: T.unsafe(nil), formatter: T.unsafe(nil), header: T.unsafe(nil), path: T.unsafe(nil), **args, &); end - - # Logs in batches - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:63 - def batch(logs); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:56 - def log(log); end - - class << self - # Appends the ingestion path to the supplied url, keeping any query string at the - # end of the url where Appender::Http can parse it out. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:50 - def ingestion_url(url, path); end - end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:14 -SemanticLogger::Appender::Loki::INGESTION_PATH = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:14 -class SemanticLogger::Appender::SentryRuby < ::SemanticLogger::Subscriber - # Create Appender - # - # Parameters - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: :error - # - # formatter: [Object|Proc|Symbol|Hash] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:49 - def initialize(level: T.unsafe(nil), **args, &block); end - - # Send an error notification to sentry - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:62 - def log(log); end - - private - - # Use Raw Formatter by default - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:103 - def default_formatter; end - - # Returns [Array] the fingerprint taken from the named tags or payload, an Array of - # Strings, Symbols, or numbers. Returns nil when there is none, or it is of another type, which - # is then left where it is and sent to Sentry as data. As for the user, taking it from the - # payload is deprecated. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:164 - def extract_fingerprint!(source, from_payload: T.unsafe(nil)); end - - # Extract tags. - # - # Named tags will be stringified (both key and value). - # Unnamed tags will be stringified and joined with a comma. Then they will - # be used as a "tag" named tag. If such a tag already exists, it is also - # joined with a comma. - # - # Finally, the tag names are limited to 32 characters and the tag values to 256. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:208 - def extract_tags!(context); end - - # Extract user data from named tags or payload. - # - # Keys :user_id and :user_email will be used as :id and :email respectively. - # Keys :username and :ip_address will be used verbatim. - # - # Any additional value nested in a :user key will be added, provided any of - # the above keys is already present. - # - # The payload can hold untrusted data, such as a request body, so taking the user from it is - # deprecated, and the named tags win: a payload field is only taken when the named tags do not - # set it, and its value is a String, Symbol, or Integer. A payload value that is not taken is - # left where it is, and sent to Sentry as data. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:119 - def extract_user!(named_tags, payload); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:172 - def fingerprint_part?(part); end - - # Adds the fields of a :user Hash in the payload that the user does not have yet, when each of - # its keys is a Symbol or String, and each of its values a String, Symbol, or Integer. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:141 - def merge_payload_user!(user, payload); end - - # Warns once that the Sentry user or fingerprint was taken from the payload. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:187 - def payload_context_deprecated; end - - # Returns [Hash] a copy of the payload that keys can be taken out of. A payload that is not a - # Hash is sent to Sentry as the extra named payload. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:178 - def payload_copy(payload); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:152 - def user_key?(key); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:156 - def user_value?(value); end -end - -# The types of value accepted in a fingerprint, which Sentry turns into Strings. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:22 -SemanticLogger::Appender::SentryRuby::FINGERPRINT_PART_TYPES = T.let(T.unsafe(nil), Array) - -# Keys of the named tags or payload that set the Sentry user, mapped to its fields. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:16 -SemanticLogger::Appender::SentryRuby::USER_KEYS = T.let(T.unsafe(nil), Hash) - -# The types of value taken from the payload for a field of the Sentry user. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:19 -SemanticLogger::Appender::SentryRuby::USER_VALUE_TYPES = T.let(T.unsafe(nil), Array) - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:17 -class SemanticLogger::Appender::SplunkHttp < ::SemanticLogger::Appender::Http - # Create Splunk appender over persistent HTTP(S) - # - # Parameters: - # token: [String] - # Token created in Splunk for this HTTP Appender - # Mandatory. - # - # source_type: [String] - # Optional: Source type to display in Splunk - # - # index: [String] - # Optional: Name of a valid index for this message in Splunk. - # - # url: [String] - # Valid URL to post to. - # Example: http://example.com - # To enable SSL include https in the URL. - # Example: https://example.com - # verify_mode will default: OpenSSL::SSL::VERIFY_PEER - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # compress: [true|false] - # Splunk supports HTTP Compression, enable by default. - # Default: true - # - # ssl: [Hash] - # Specific SSL options: For more details see NET::HTTP.start - # ca_file, ca_path, cert, cert_store, ciphers, key, open_timeout, read_timeout, ssl_timeout, - # ssl_version, use_ssl, verify_callback, verify_depth and verify_mode. - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:71 - def initialize(token: T.unsafe(nil), source_type: T.unsafe(nil), index: T.unsafe(nil), compress: T.unsafe(nil), **args, &); end - - # Returns [String] JSON to send to Splunk. - # - # For splunk format requirements see: - # https://docs.splunk.com/Documentation/Splunk/latest/Data/FormateventsforHTTPEventCollector - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:90 - def call(log, logger); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:18 - def index; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:18 - def index=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:18 - def source_type; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:18 - def source_type=(_arg0); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:32 -class SemanticLogger::Appender::Syslog < ::SemanticLogger::Subscriber - # Create a Syslog appender instance. - # - # Parameters - # url: [String] - # Default: 'syslog://localhost' - # For writing logs to a remote syslog server - # URL of server: protocol://host:port - # Uses port 514 by default for TCP and UDP. - # local syslog example: 'syslog://localhost' - # TCP example with default port: 'tcp://logger' - # TCP example with custom port: 'tcp://logger:8514' - # UDP example with default port: 'udp://logger' - # UDP example with custom port: 'udp://logger:8514' - # When using the :syslog protocol, logs will always be sent to the localhost syslog - # - # host: [String] - # Host name to provide to the remote syslog. - # Default: SemanticLogger.host - # - # tcp_client: [Hash] - # Default: {} - # Only used with the TCP protocol. - # Specify custom parameters to pass into Net::TCPClient.new - # For a list of options see the net_tcp_client documentation: - # https://github.com/reidmorrison/net_tcp_client/blob/master/lib/net/tcp_client/tcp_client.rb - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # application: [String] - # Identity of the program. - # Default: SemanticLogger.application - # - # max_size: [Integer] - # Set your own packet size. - # Default: 1024 bytes - # - # options: [Integer] - # Default: ::Syslog::LOG_PID | ::Syslog::LOG_CONS (when logging to a local syslog daemon) - # Any of the following (options can be logically OR'd together) - # ::Syslog::LOG_CONS - # ::Syslog::LOG_NDELAY - # ::Syslog::LOG_NOWAIT - # ::Syslog::LOG_ODELAY - # ::Syslog::LOG_PERROR - # ::Syslog::LOG_PID - # Note: - # - Only applicable when logging to a local syslog instance. - # I.e. When `url: 'syslog://localhost'` - # - # facility: [Integer] - # Default: ::Syslog::LOG_USER (the same value as SemanticLogger::Formatters::Syslog::LOG_USER) - # Type of program (can be logically OR'd together) - # ::Syslog::LOG_AUTH - # ::Syslog::LOG_AUTHPRIV - # ::Syslog::LOG_CONSOLE - # ::Syslog::LOG_CRON - # ::Syslog::LOG_DAEMON - # ::Syslog::LOG_FTP - # ::Syslog::LOG_KERN - # ::Syslog::LOG_LRP - # ::Syslog::LOG_MAIL - # ::Syslog::LOG_NEWS - # ::Syslog::LOG_NTP - # ::Syslog::LOG_SECURITY - # ::Syslog::LOG_SYSLOG - # ::Syslog::LOG_USER - # ::Syslog::LOG_UUCP - # ::Syslog::LOG_LOCAL0 - # ::Syslog::LOG_LOCAL1 - # ::Syslog::LOG_LOCAL2 - # ::Syslog::LOG_LOCAL3 - # ::Syslog::LOG_LOCAL4 - # ::Syslog::LOG_LOCAL5 - # ::Syslog::LOG_LOCAL6 - # ::Syslog::LOG_LOCAL7 - # - # level_map: [Hash | SemanticLogger::Formatters::Syslog::LevelMap] - # Supply a custom map of SemanticLogger levels to syslog levels. - # - # Example: - # # Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING. - # SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE}) - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:125 - def initialize(url: T.unsafe(nil), facility: T.unsafe(nil), max_size: T.unsafe(nil), level_map: T.unsafe(nil), options: T.unsafe(nil), tcp_client: T.unsafe(nil), **args, &); end - - # Returns [SemanticLogger::Formatters::Base] default formatter for this Appender - # depending on the protocol selected - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:229 - def default_formatter; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def facility; end - - # Flush is called by the semantic_logger during shutdown. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:218 - def flush; end - - # The url without any credentials. See Subscriber#inspect. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:248 - def inspect_details; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def level_map; end - - # Write the log using the specified protocol and server. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:201 - def log(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def max_size; end - - # Over UDP, a log message too large for a datagram (Errno::EMSGSIZE) cannot be sent by retrying. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:223 - def message_error?(exception); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def options; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def port; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def protocol; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def remote_syslog; end - - # After forking an active process call #reopen to re-open - # open the handles to resources - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:183 - def reopen; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def server; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 - def url; end - - private - - # Returns the supplied `formatter:` argument, with this appender's facility, level map, and - # maximum packet size added when it names one of the PACKET_FORMATTERS, so that they are not - # silently ignored. Options in a - # `{syslog: {...}}` Hash take precedence. A formatter instance keeps its own settings. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:258 - def with_packet_options(formatter); end -end - -# The formatters that build remote syslog packets, and so need this appender's facility, level map, -# and maximum packet size. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:244 -SemanticLogger::Appender::Syslog::PACKET_FORMATTERS = T.let(T.unsafe(nil), Array) - -# UDP log appender. -# -# Write log messages to UDP. -# By default messages are in JSON format. -# -# Example: -# SemanticLogger.add_appender( -# appender: :udp, -# server: 'server:3300', -# ) -# -# pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:14 -class SemanticLogger::Appender::Udp < ::SemanticLogger::Subscriber - # Create UDP log appender. - # - # server: [String] - # URL of the server to write UDP messages to. - # - # udp_flags: [Integer] - # Should be a bitwise OR of Socket::MSG_* constants. - # Default: 0 - # - # Common Appender Parameters: - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # metrics: [Boolean] - # Send metrics only events over udp. - # Default: true - # - # Limitations: - # * UDP packet size is limited by the connected network and any routers etc - # that the message has to traverse. See https://en.wikipedia.org/wiki/Maximum_transmission_unit - # - # Example: - # SemanticLogger.add_appender( - # appender: :udp, - # server: 'server:3300' - # ) - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:64 - def initialize(server:, udp_flags: T.unsafe(nil), metrics: T.unsafe(nil), **args, &); end - - # Close is called during shutdown, or with reopen - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:93 - def close; end - - # Flush is called by the semantic_logger during shutdown. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:88 - def flush; end - - # See Subscriber#inspect. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:103 - def inspect_details; end - - # Write the log using the specified protocol and server. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:82 - def log(log); end - - # A log message too large for a datagram (Errno::EMSGSIZE) cannot be sent by retrying. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:98 - def message_error?(exception); end - - # After forking an active process call #reopen to re-open - # open the handles to resources - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:74 - def reopen; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:15 - def server; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:15 - def server=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:16 - def socket; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:15 - def udp_flags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:15 - def udp_flags=(_arg0); end - - private - - # Returns [SemanticLogger::Formatters::Default] formatter default for this Appender - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:110 - def default_formatter; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:6 -class SemanticLogger::Appender::Wrapper < ::SemanticLogger::Subscriber - # Forward all logging calls to the supplied logging instance. - # - # Parameters - # logger: [Object] - # Instance of an existing logger conforming to the Ruby Logger methods. - # - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this appender. - # Default: SemanticLogger.default_level - # - # formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this appender - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # Ruby Logger - # require 'logger' - # require 'semantic_logger' - # - # ruby_logger = Logger.new($stdout) - # SemanticLogger.add_appender(logger: ruby_logger) - # - # logger = SemanticLogger['test'] - # logger.info('Hello World', some: :payload) - # - # Install the `rails_semantic_logger` gem to replace the Rails logger with Semantic Logger. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:41 - def initialize(logger:, **args, &); end - - # Close underlying log - # Waits for all queued log messages to be written to disk. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:72 - def close; end - - # Flush all pending logs to disk. - # Waits for all queued log messages to be written to disk. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:66 - def flush; end - - # Pass log calls to the underlying Rails, log4j or Ruby logger - # trace entries are mapped to debug since :trace is not supported by the - # Ruby or Rails Loggers - # - # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:58 - def log(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:7 - def logger; end -end - -# Manage a collection of appenders. -# -# pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:3 -class SemanticLogger::Appenders < ::Concurrent::Array - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:6 - def initialize(logger = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:12 - def add(**args, &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:78 - def close; end - - # Whether any of the existing appenders already output to the console? - # I.e. Writes to stdout or stderr. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:33 - def console_output?; end - - # The console streams (:stdout and/or :stderr) already being written to by the existing appenders. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:27 - def console_streams; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:68 - def flush; end - - # Write the log message to every appender that should log it. An appender that fails is - # reported, and the others still write the message. - # - # A stack overflow is not a failure of the appender but of the thread, which must not overflow - # again: on macOS a second stack overflow on the same thread crashes Ruby. It is raised to the - # processor running this thread instead, and the message goes to no further appenders. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:58 - def log(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:4 - def logger; end - - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:4 - def logger=(_arg0); end - - # After a fork reopen each appender. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:94 - def reopen; end - - # Returns [Array] operational statistics for each appender. - # - # Appenders that run asynchronously (see SemanticLogger::Appender::Async#stats) report - # their queue size and processed/dropped/failed counts. Appenders that log inline on the - # processor thread report only their name with `async: false`. - # - # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:42 - def stats; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/base.rb:8 -class SemanticLogger::Base - # Initializer for Abstract Class SemanticLogger::Base - # - # Parameters - # klass [String] - # Name of the class, module, or other identifier for which the log messages - # are being logged - # - # level [Symbol] - # Only allow log entries of this level or higher to be written to this appender - # For example if set to :warn, this appender would only log :warn and :fatal - # log messages when other appenders could be logging :info and lower - # - # filter [Regexp|Proc|Module] - # RegExp: Only include log messages where the class name matches the supplied - # regular expression. All other messages will be ignored - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false - # Module: A module that implements `.call`. For example: - # module ComplexFilter - # def self.call(log) - # (/\AExclude/ =~ log.message).nil? - # end - # end - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:324 - def initialize(klass, level = T.unsafe(nil), filter = T.unsafe(nil)); end - - # Log a thread backtrace - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:155 - def backtrace(thread: T.unsafe(nil), level: T.unsafe(nil), message: T.unsafe(nil), payload: T.unsafe(nil), metric: T.unsafe(nil), metric_amount: T.unsafe(nil)); end - - # Backward compatibility - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:152 - def benchmark(level, message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def benchmark_debug(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def benchmark_error(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def benchmark_fatal(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def benchmark_info(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def benchmark_trace(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def benchmark_warn(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def debug(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def debug?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def error(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def error?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:280 - def fast_tag(tag, &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def fatal(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def fatal?; end - - # Class name to be logged - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 - def filter; end - - # Class name to be logged - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 - def filter=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def info(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def info?; end - - # Tags permanently bound to this logger instance via `#tagged` (without a block). - # Empty for a regular (non-child) logger. - # Only assigned to when building a child logger via `#tagged` (see #tagged_child). - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:255 - def instance_named_tags; end - - # Tags permanently bound to this logger instance via `#tagged` (without a block). - # Empty for a regular (non-child) logger. - # Only assigned to when building a child logger via `#tagged` (see #tagged_child). - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:255 - def instance_tags; end - - # Returns the level set by an enclosing `#with_level` block on the current fiber, - # otherwise the level set for this instance, otherwise the global default level. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:33 - def level; end - - # Set the logging level for this logger - # - # Note: This level is only for this particular instance. It does not override - # the log level in any logging instance or the default log level - # SemanticLogger.default_level - # - # Must be one of the values in SemanticLogger::LEVELS, or - # nil if this logger instance should use the global default level - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:20 - def level=(level); end - - # Write log data to underlying data storage - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:285 - def log(_log_); end - - # Dynamically supply the log level with every measurement call - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:142 - def measure(level, message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def measure_debug(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def measure_error(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def measure_fatal(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def measure_info(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def measure_trace(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def measure_warn(message, params = T.unsafe(nil), &block); end - - # Class name to be logged - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 - def name; end - - # Class name to be logged - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 - def name=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:249 - def named_tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:270 - def pop_tags(quantity = T.unsafe(nil)); end - - # Returns the list of tags pushed after flattening them out and removing blanks - # - # Note: - # - This method is slow since it needs to flatten the tags and remove empty elements - # to support Rails 4. - # - For better performance with clean tags, use `SemanticLogger.push_tags` - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:263 - def push_tags(*tags); end - - # Whether this log entry meets the criteria to be logged by this appender. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:290 - def should_log?(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:275 - def silence(new_level = T.unsafe(nil), &); end - - # Add the tags or named tags to the list of tags to log for this thread whilst the supplied block is active. - # - # Returns result of block. - # - # Tagged example: - # SemanticLogger.tagged(12345, 'jack') do - # logger.debug('Hello World') - # end - # - # Named Tags (Hash) example: - # SemanticLogger.tagged(tracking_number: 12345) do - # logger.debug('Hello World') - # end - # - # Notes: - # - Named tags are the recommended approach since the tag consists of a name value pair this is more useful - # than just a string value in the logs, or centralized logging system. - # - This method is slow when using multiple text tags since it needs to flatten the tags and - # remove empty elements to support Rails 4. - # - It is recommended to keep tags as a list without any empty values, or contain any child arrays. - # However, this api will convert: - # `logger.tagged([['first', nil], nil, ['more'], 'other'])` - # to: - # `logger.tagged('first', 'more', 'other')` - # - For better performance with clean tags, see `SemanticLogger.tagged`. - # - # Child logger: - # - When called *without* a block, returns a new logger instance that permanently - # carries the supplied tags ("instance tags"). Those tags are added to every log - # entry emitted by the returned logger, and _only_ that logger, even across threads. - # Unlike the block form they are not pushed onto the thread, so other loggers are - # unaffected. This is the recommended way to bind a logger to an object's identity: - # logger = SemanticLogger['Cart'].tagged(cart_id: cart.id) - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:222 - def tagged(*tags); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:245 - def tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def trace(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def trace?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def warn(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:109 - def warn?; end - - # Change the log level of this instance while the block runs, on the current fiber only. - # - # Other threads and fibers that share this instance keep logging at its own level. - # The level set with `#level=` is left untouched, so an instance that follows the - # global default level keeps following it after the block. Blocks can be nested. - # - # Matches Ruby's `Logger#with_level`, which Sidekiq calls to apply a job's `log_level`. - # Accepts the same levels as `#level=`. Returns the result of the block. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:48 - def with_level(level); end - - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:242 - def with_tags(*tags); end - - protected - - # Tags permanently bound to this logger instance via `#tagged` (without a block). - # Empty for a regular (non-child) logger. - # Only assigned to when building a child logger via `#tagged` (see #tagged_child). - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:297 - def instance_named_tags=(_arg0); end - - # Tags permanently bound to this logger instance via `#tagged` (without a block). - # Empty for a regular (non-child) logger. - # Only assigned to when building a child logger via `#tagged` (see #tagged_child). - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:297 - def instance_tags=(_arg0); end - - private - - # Merge the result of a logging block into the log entry. - # - # Zero-arity blocks (e.g. `logger.info { "msg" }` or a zero-arity lambda) are called without - # arguments. Lambdas enforce their arity, so yielding the log to a zero-arity lambda would - # raise ArgumentError. Blocks that accept an argument still receive the log so they can read - # or mutate it. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:469 - def apply_block_result(log, &block); end - - # Merge this logger's instance tags into the supplied Log entry. - # - # Composition (mirrors the per-logger merge rule proposed in PR #301): - # - Positional: thread tags first, then this logger's instance tags appended. - # - Named: instance named tags merged on top of the thread named tags, so on a - # key conflict the logger's own identity wins (it is the more specific value). - # Only this logger's entries are affected; the thread context is left untouched. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:396 - def apply_instance_tags(log); end - - # Level to use when no level has been set for this instance: the global default level. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:356 - def fallback_level; end - - # Level index to use when no level has been set for this instance. Unlike - # `#fallback_level`, it honors `SemanticLogger.silence`. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:362 - def fallback_level_index; end - - # Whether to log the supplied message based on the current filter if any - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:372 - def filtered?(log); end - - # Return the level index for fast comparisons, resolved in the same order as `#level`. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:351 - def level_index; end - - # Log message at the specified level - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:430 - def log_internal(level, index, message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # Measure the supplied block and log the message - # - # The options can hold untrusted data, so an option with a value that is not valid for it is - # ignored (see Log.argument?) and its default is used instead. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:483 - def measure_internal(level, index, message, params); end - - # For measuring methods and logging their duration. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:554 - def measure_method(index:, level:, message:, min_duration:, metric:, log_exception:, on_exception_level:); end - - # Returns the value of the measure option that is also a log argument, or nil when it is not - # supplied or its value is not valid for that argument. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:539 - def measure_option(params, key); end - - # Returns the level to silence other log messages to within a measure block, or nil when none - # is supplied or it is not a valid level. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:546 - def measure_silence_level(params); end - - # Ensure minimum log level is met - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:379 - def meets_log_level?(log); end - - # Build a new Log entry, layering this logger's instance tags on top of the - # current thread context. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:385 - def new_log(level, index = T.unsafe(nil)); end - - # Returns a copy of this logger that permanently carries the supplied tags. - # Positional (string) and named (Hash) tags may be mixed; they are merged on - # top of any instance tags this logger already carries. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:409 - def tagged_child(tags); end - - # Level index set for this instance by an enclosing `#with_level` block on the current fiber. - # - # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:367 - def with_level_index; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:4 -module SemanticLogger::Concerns; end - -# pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:6 -module SemanticLogger::Concerns::Compatibility - # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:40 - def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:32 - def close; end - - # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:36 - def reopen(logdev = T.unsafe(nil)); end - - class << self - # For compatibility with Ruby Logger only. - # - # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:10 - def included(base); end - end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:2 -module SemanticLogger::CoreExt; end - -# Reopen all appenders in the child process after a fork. -# -# Prepended onto `Process.singleton_class` when Semantic Logger is loaded. -# Enabled by default; opt out with `SemanticLogger.reopen_on_fork = false`. -# -# `Process._fork` (Ruby 3.1+) is the single method that every fork path routes -# through (`Kernel#fork`, `Process.fork`, `IO.popen`, `Kernel#system`, and -# backticks), so overriding it covers them all with one hook. -# -# Note: both `_fork` and `daemon` must be overridden to reliably restart the -# appender thread, since `Process.daemon` does not route through `_fork` -# (https://bugs.ruby-lang.org/issues/18911). Do not collapse this down to only -# `_fork`. -# -# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:16 -module SemanticLogger::CoreExt::Process - # `_fork` runs in both the parent and the child. It returns 0 in the child - # and the child's pid in the parent, so only reopen in the child. Reopening - # in the parent would needlessly recreate its queue and worker thread, - # risking the loss of messages still on the queue. - # - # pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:21 - def _fork; end - - # `Process.daemon` does not route through `_fork`, so reopen explicitly. Once - # it returns, the caller is running as the daemon (child) process. - # - # pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:29 - def daemon(*, **, &); end -end - -# Custom logger that maps all calls to debug to trace calls -# This is useful for existing gems / libraries that log too much to debug -# when most of the debug logging should be at the trace level -# -# pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:5 -class SemanticLogger::DebugAsTraceLogger < ::SemanticLogger::Logger - # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:9 - def benchmark_debug(message, params = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:6 - def debug(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:7 - def debug?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:8 - def measure_debug(message, params = T.unsafe(nil), &block); end -end - -# Separates the detail that Ruby's Exception#detailed_message adds to an exception's message, -# such as did_you_mean suggestions or error_highlight's source snippet, from the message itself. -# -# Internal: Log caches the result for each of its exceptions; see Log#exception_details. -# -# pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:6 -module SemanticLogger::ExceptionDetails - class << self - # Returns [String] the detail that #detailed_message adds to the exception's message, without - # the class name that Ruby also adds, or nil when there is none or it cannot be separated. - # - # Never raises, so that an exception's own #detailed_message cannot stop a log entry being - # written. - # - # pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:16 - def extract(exception, source: T.unsafe(nil)); end - - private - - # Whether error_highlight adds a source snippet to this exception's #detailed_message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:45 - def error_highlighted?(exception); end - - # Returns [String] the exception's #detailed_message, with or without error_highlight's - # source snippet, or nil when the snippet cannot be left out. - # - # pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:32 - def full_detailed_message(exception, source); end - end -end - -# Ruby's own Exception#detailed_message: the message, decorated with the class name. -# -# pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:8 -SemanticLogger::ExceptionDetails::DETAILED_MESSAGE = T.let(T.unsafe(nil), UnboundMethod) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters.rb:2 -module SemanticLogger::Formatters - class << self - # Return formatter that responds to call. - # - # Supports formatter supplied as: - # - Symbol - # - Hash ( Symbol => { options }) - # - Instance of any of SemanticLogger::Formatters - # - Proc - # - Any object that responds to :call - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters.rb:28 - def factory(formatter); end - end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:4 -class SemanticLogger::Formatters::Base - # Parameters - # time_format: [String|Symbol|nil] - # See Time#strftime for the format of this string. - # :iso_8601 Outputs an ISO8601 Formatted timestamp. - # :ms Output in miliseconds since epoch. - # :notime Returns an empty string for time ( no time is output ). - # Default: '%Y-%m-%d %H:%M:%S.%N' - # log_host: [Boolean] - # Whether or not to include hostname in logs - # Default: true - # log_application: [Boolean] - # Whether or not to include application name in logs - # Default: true - # precision: [Integer] - # How many fractional digits to log times with. - # Default: PRECISION (6, except on older JRuby, where 3) - # escape_control_chars: [Boolean] - # Replace control characters (newlines, the ANSI escape, etc.) in - # untrusted log data (logger name, thread name, message, payload, tags, - # named tags, and the message and backtrace lines of the exception and - # of each exception that caused it) with a printable escaped form, e.g. "\n". - # This prevents log forging and terminal escape-sequence injection - # when logging data that may contain attacker-controlled content. - # Note: Has no effect on structured formatters such as :json, which - # already escape control characters via JSON encoding. - # Default: false (preserve newlines and ANSI colors in text output) - # log_exception_details: [true|false|:with_source] - # Whether to log the detail that Ruby's Exception#detailed_message adds to an - # exception's message, such as did_you_mean suggestions ("Did you mean? upcase") or - # the detail an exception class supplies by overriding #detailed_message. - # :with_source also logs error_highlight's snippet of the failing source line. It is - # about 100 times slower, since it re-parses that source file, and it copies source - # code into the log. - # On Ruby 3.2 a NameError or NoMethodError builds its message from receiver.inspect each - # time it is asked, and logging the details asks for it twice more, so turn this off when - # inspecting the receivers of logged exceptions is slow. - # Default: true for the Default, Color, and Pattern text formatters, false otherwise. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:72 - def initialize(time_format: T.unsafe(nil), log_host: T.unsafe(nil), log_application: T.unsafe(nil), log_environment: T.unsafe(nil), precision: T.unsafe(nil), escape_control_chars: T.unsafe(nil), log_exception_details: T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def escape_control_chars; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def escape_control_chars=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_application; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_application=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_environment; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_environment=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_exception_details; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_exception_details=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_host; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def log_host=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def logger; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def logger=(_arg0); end - - # Process ID - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:104 - def pid; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def precision; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def precision=(_arg0); end - - # Date & time - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:99 - def time; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def time_format; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 - def time_format=(_arg0); end - - private - - # Whether this formatter logs exception details unless told otherwise. See #initialize. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:131 - def default_log_exception_details; end - - # When `escape_control_chars` is enabled, return a copy of the supplied - # value with any control characters replaced by a printable escaped form - # so that untrusted log data cannot forge log entries or inject terminal - # escape sequences. Otherwise the value is returned unchanged. - # - # Note: This escapes (preserves) control characters, and is opt-in. It is - # distinct from Log#cleansed_message, which unconditionally *strips* ANSI - # colorization from the message for structured (JSON/Loki) output. - # - # A string with invalid byte sequences, for example an exception message that quotes - # untrusted binary input, or in another encoding, is first converted to valid UTF-8 - # (dropping the invalid bytes), since matching against it would raise and the log entry - # would be lost. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:123 - def escape_control_characters(value); end - - # Returns [String] the backtrace of the logged exception, followed by each exception - # that caused it, as laid out by Log#backtrace_to_s. - # - # When `escape_control_chars` is enabled, the message of each cause and each backtrace - # line is passed through #escape_control_characters, the same as the message of the - # logged exception: causes are often parser or validation errors that quote untrusted - # input, and a backtrace can be set from untrusted data. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:150 - def exception_backtrace; end - - # Returns [String] the detail Ruby adds to the message of the supplied exception (see - # Log#exception_details), or nil when there is none or this formatter does not log it. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:137 - def exception_details_for(exception); end - - # Return the Time as a formatted string - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:157 - def format_time(time); end - - class << self - # Return default time format string - # - # Parameters - # precision: [Integer] - # How many fractional digits to log times with. - # Default: PRECISION (6, except on older JRuby, where 3) - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:94 - def build_time_format(precision = T.unsafe(nil)); end - end -end - -# Matches C0 control characters (including newlines and the ANSI escape) and DEL. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:19 -SemanticLogger::Formatters::Base::CONTROL_CHARS = T.let(T.unsafe(nil), Regexp) - -# Printable escapes for the most common control characters. Any other -# control character is escaped to its hexadecimal `\xHH` form by -# #escape_control_characters. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:11 -SemanticLogger::Formatters::Base::CONTROL_CHAR_ESCAPES = T.let(T.unsafe(nil), Hash) - -# Time precision varies by Ruby interpreter -# JRuby 9.1.8.0 supports microseconds -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:23 -SemanticLogger::Formatters::Base::PRECISION = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:14 -class SemanticLogger::Formatters::Color < ::SemanticLogger::Formatters::Default - # Adds color to the default log formatter - # - # Example: - # # Use a colorized output logger. - # SemanticLogger.add_appender(io: $stdout, formatter: :color) - # - # Example: - # # Use a colorized output logger changing the color for info to yellow. - # SemanticLogger.add_appender(io: $stdout, formatter: {color: {color_map: {info: SemanticLogger::AnsiColors::YELLOW}}}) - # - # Example: - # # Override the Awesome Print options to output hashes over multiple lines: - # SemanticLogger.add_appender(io: $stdout, formatter: {color: {ap: {multiline: true}}}) - # - # # Calling the appender added above: - # SemanticLogger['Test'].info('hi', {a: 1, b: 2}) - # => true - # => 2019-02-12 11:47:50.794339 I [35832:70112015269920] Test -- hi -- { - # :a => 1, - # :b => 2 - # } - # - # Parameters: - # ap: [Hash] - # Any valid Amazing Print option for rendering data. - # These options can also be changed be creating a `~/.aprc` file. - # See: https://github.com/amazing-print/amazing_print - # - # Note: The option :multiline is set to false if not supplied. - # Note: Has no effect if Awesome Print is not installed. - # Note: With `escape_control_chars: true` the payload is always rendered plain - # (without colors) and on a single line, then escaped. - # - # color_map: [Hash | SemanticLogger::Formatters::Color::ColorMap] - # ColorMaps each of the log levels to a color - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:79 - def initialize(ap: T.unsafe(nil), color_map: T.unsafe(nil), **args); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:139 - def call(log, logger); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 - def color; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 - def color=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 - def color_map; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 - def color_map=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:108 - def duration; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:130 - def exception; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:85 - def level; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:112 - def name; end - - # Named Tags - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:97 - def named_tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:116 - def payload; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:89 - def tags; end - - private - - # Returns [Hash] the Amazing Print options to render the payload with. - # - # When `escape_control_chars` is enabled the payload is rendered plain, on one line: - # the colors and line breaks Amazing Print adds cannot be told apart from control - # characters in the data (for example an object whose #inspect returns them), and - # escaping them all leaves no colors or line breaks to keep. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:152 - def ai_options; end -end - -# Supply a custom color map for every log level -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:18 -class SemanticLogger::Formatters::Color::ColorMap - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:21 - def initialize(trace: T.unsafe(nil), debug: T.unsafe(nil), info: T.unsafe(nil), warn: T.unsafe(nil), error: T.unsafe(nil), fatal: T.unsafe(nil), bold: T.unsafe(nil), clear: T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:39 - def [](level); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def bold; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def bold=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def clear; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def clear=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def debug; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def debug=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def error; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def error=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def fatal; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def fatal=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def info; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def info=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def trace; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def trace=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def warn; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 - def warn=(_arg0); end -end - -# Default non-colored text log output -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:4 -class SemanticLogger::Formatters::Default < ::SemanticLogger::Formatters::Base - # Default text log format - # Generates logs of the form: - # 2011-07-19 14:36:15.660235 D [1149:ScriptThreadProcess] Rails -- Hello World - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:96 - def call(log, logger); end - - # Duration - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:56 - def duration; end - - # Exception - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:79 - def exception; end - - # The detail Ruby adds to the exception's message, such as did_you_mean suggestions. - # See Base#initialize for the `log_exception_details` option. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:89 - def exception_details; end - - # Ruby file name and line number that logged the message. - # - # The file name is escaped like the other fields, since it comes from the first line of the - # backtrace, which a log call can supply from untrusted data. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:22 - def file_name_and_line; end - - # Log level - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:9 - def level; end - - # Log message - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:66 - def message; end - - # Class / app name - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:61 - def name; end - - # Named Tags - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:44 - def named_tags; end - - # Payload - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:71 - def payload; end - - # Returns [String] the available process info - # Example: - # [18934:thread_name test_logging.rb:51] - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:30 - def process_info; end - - # Tags - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:37 - def tags; end - - # Name of the thread that logged the message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:14 - def thread_name; end - - private - - # Text output is read by people, who benefit most from exception details. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:106 - def default_log_exception_details; end -end - -# Formatter conforming to the Elastic Common Schema (ECS). -# -# Emits log events using the nested field names defined by ECS so that they -# integrate cleanly with Filebeat and the Elastic stack (Elasticsearch, -# Kibana) without requiring an ingest pipeline to rename fields. -# -# Usage: -# SemanticLogger.add_appender(io: $stdout, formatter: :ecs) -# -# # Route the payload, metric, and other SemanticLogger-specific data into -# # a custom top-level namespace (default "semantic_logger"): -# SemanticLogger.add_appender(io: $stdout, formatter: {ecs: {namespace: "my_app"}}) -# -# # Or merge the payload directly into ECS `labels` instead of a namespace: -# SemanticLogger.add_appender(io: $stdout, formatter: {ecs: {namespace: nil}}) -# -# == Field mapping (SemanticLogger -> ECS 8.x) -# time -> @timestamp (ISO-8601) -# level -> log.level -# name -> log.logger -# file_name / line -> log.origin.file.name / log.origin.file.line -# message -> message -# thread_name -> process.thread.name -# pid -> process.pid -# host -> host.hostname -# application -> service.name -# environment -> service.environment -# exception -> error.type / error.message / error.stack_trace -# duration -> event.duration (nanoseconds, as required by ECS) -# tags -> tags (ECS top-level array) -# named_tags -> labels.* (scalar key/value pairs) -# payload -> .* (or labels.* when namespace is nil) -# metric/metric_amount -> .metric / .metric_amount -# -# == Reference -# * https://www.elastic.co/docs/reference/ecs -# * https://www.elastic.co/docs/reference/ecs/ecs-custom-fields-in-ecs -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:41 -class SemanticLogger::Formatters::Ecs < ::SemanticLogger::Formatters::Raw - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:53 - def initialize(namespace: T.unsafe(nil), time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end - - # Returns a batch of log events as a single JSON array. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:66 - def batch(logs, logger); end - - # Returns the log event as a single line of ECS-formatted JSON, so it can - # be written to stdout / a file and shipped by Filebeat or Elastic Agent. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:61 - def call(log, logger); end - - # namespace: [String|Symbol|nil] - # Top-level field set used to hold SemanticLogger-specific data that has - # no native ECS home (payload, metric, metric_amount). A proper-noun - # namespace is guaranteed never to collide with a current or future ECS - # field. Set to nil to merge the payload into ECS `labels` instead. - # Default: "semantic_logger" - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:51 - def namespace; end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:123 - def add_error(result, hash); end - - # ECS event.duration is measured in nanoseconds. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:117 - def add_event(result, hash); end - - # Place SemanticLogger-specific data (payload, metric) that has no native - # ECS home into the configured namespace, plus named_tags into labels. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:135 - def add_extras(result, hash); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:110 - def add_origin(result, hash); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:103 - def add_service(result, hash); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:86 - def base(hash); end - - # Remap the flat hash built by Raw#call into the nested ECS field layout. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:73 - def ecs_hash(hash); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:97 - def process(hash); end -end - -# ECS version this formatter targets. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:43 -SemanticLogger::Formatters::Ecs::ECS_VERSION = T.let(T.unsafe(nil), String) - -# Fluentd is similar to SemanticLogger::Formatters::Json but with log levels that are recognized -# by kubernetes fluentd. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:7 -class SemanticLogger::Formatters::Fluentd < ::SemanticLogger::Formatters::Json - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:10 - def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), need_process_info: T.unsafe(nil), log_host: T.unsafe(nil), **args); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:32 - def file_name_and_line; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:15 - def level; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:8 - def need_process_info; end - - # Ignore process fields: pid, thread, file and line by default. - # These are rarely useful under Fluentd (e.g. containerized processes - # usually have pid 1), so they are only included when explicitly requested - # via `need_process_info: true`. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:24 - def pid; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:28 - def thread_name; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:4 -class SemanticLogger::Formatters::Json < ::SemanticLogger::Formatters::Raw - # Default JSON time format is ISO8601 - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:6 - def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end - - # Returns a batch of log messages as a single JSON array. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:16 - def batch(logs, logger); end - - # Returns log messages in JSON format - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:11 - def call(log, logger); end -end - -# Produces logfmt formatted messages -# -# The following fields are extracted from the raw log and included in the formatted message: -# :timestamp, :level, :name, :message, :duration, :tags, :named_tags -# -# E.g. -# timestamp="2020-07-20T08:32:05.375276Z" level=info name="DefaultTest" base="breakfast" -# spaces="second breakfast" double_quotes="\"elevensies\"" single_quotes="'lunch'" tag="success" -# -# All timestamps are ISO8601 formatteed -# All user supplied values are escaped and surrounded by double quotes to avoid ambiguious message delimeters -# `tags` are treated as keys with boolean values. -# In every key (tags, named tags, payload), spaces, control and format characters, `=`, and `"` -# are replaced with `_`, so that untrusted data cannot inject fields or lines, or disguise a key. -# `tags`, `named_tags`, and `payload` are flattened into the top level fields. A key named like -# one of the entry's own fields (the time key, `level`, `name`, `message`, `duration`, -# `duration_ms`, `tag`) or an exception field is prefixed with its source, as in `payload.level`, -# so that logged data cannot replace those fields. So is a key that starts with `tags.`, -# `named_tags.`, or `payload.`, so that it cannot forge another source's field. Other keys that -# are the same once encoded, such as `:user` and `"user"`, or `"a b"` and `"a=b"`, are written -# once, with the value from the later source: `payload` values take precedence over -# `named_tags`, and `named_tags` over `tags`. -# An exception is emitted as `exception_name`, `exception_message`, `stack_trace`, and `cause`, -# and with `log_exception_details` also `exception_details`. -# -# Futher Reading https://brandur.org/logfmt -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:31 -class SemanticLogger::Formatters::Logfmt < ::SemanticLogger::Formatters::Raw - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:70 - def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:81 - def call(log, logger); end - - # Also writes and reserves the new time key in place of the old one. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:76 - def time_key=(time_key); end - - private - - # Adds a field from logged data, under the name returned by #field_name. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:128 - def add_field(prefix, key, value); end - - # Returns [String] the logfmt name of a key from logged data: the key encoded by #logfmt_key, - # prefixed with its source, as in "payload.level", when it names one of the entry's own fields - # or starts with a source's prefix, so that untrusted data cannot replace or forge that field, - # or a field from another source. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:137 - def field_name(prefix, key); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:153 - def flatten_log; end - - # Integers, true, false, and nil have a single JSON form, so they skip the cost of `to_json`. - # Strings, the most common values, are checked first. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:164 - def format_value(value); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:120 - def handle_exception; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:107 - def handle_payload; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:102 - def handle_tags; end - - # Returns [String] the key as valid UTF-8, with every character that would break the logfmt - # structure replaced by an underscore. Keys come from tags, named tags, and payloads, which - # can hold untrusted data; unescaped, they could inject fields or forge an entire line. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:199 - def logfmt_key(key); end - - # Names the entry's own fields from the time key, and reserves those names and the - # exception's, so that logged data cannot use them. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:182 - def name_entry_fields; end - - # Whether the name is already a valid logfmt key, made of ASCII characters that are all safe. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:192 - def plain_name?(name); end - - # @parsed maps the logfmt name of each field to its value. Logged data is added after the - # entry's own fields, and a field with the same name as an earlier one replaces its value, so - # the payload takes precedence over named tags, and named tags over tags. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:92 - def raw_to_logfmt; end - - # Remembers the name of a Symbol key that is not reserved, while there is room. The cache is - # replaced rather than updated, since a formatter can be shared by several threads. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:148 - def remember_symbol(symbol, name); end -end - -# The entry's own fields in the Raw hash, written in this order after the time key. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:33 -SemanticLogger::Formatters::Logfmt::ENTRY_FIELDS = T.let(T.unsafe(nil), Array) - -# The exception's fields in the Raw hash, mapped to their logfmt names, so that the exception's -# name and message do not replace the entry's own. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:40 -SemanticLogger::Formatters::Logfmt::EXCEPTION_FIELDS = T.let(T.unsafe(nil), Hash) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:51 -SemanticLogger::Formatters::Logfmt::NAMED_TAGS_PREFIX = T.let(T.unsafe(nil), String) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:52 -SemanticLogger::Formatters::Logfmt::PAYLOAD_PREFIX = T.let(T.unsafe(nil), String) - -# The most Symbol keys to remember the names of, so that untrusted keys cannot grow the cache -# without bound. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:68 -SemanticLogger::Formatters::Logfmt::PLAIN_SYMBOL_CACHE_SIZE = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:53 -SemanticLogger::Formatters::Logfmt::SOURCE_PREFIXES = T.let(T.unsafe(nil), Array) - -# Prefixes that mark a key from logged data with its source, when the key alone would name -# one of the entry's own fields, or look like a key marked this way. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:50 -SemanticLogger::Formatters::Logfmt::TAGS_PREFIX = T.let(T.unsafe(nil), String) - -# The field that tells an entry with an exception from one without. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:36 -SemanticLogger::Formatters::Logfmt::TAG_FIELD = T.let(T.unsafe(nil), String) - -# The ASCII subset of UNSAFE_KEY_CHARS, which is much faster to match against the ASCII keys -# that make up nearly every log event. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:64 -SemanticLogger::Formatters::Logfmt::UNSAFE_ASCII_KEY_CHARS = T.let(T.unsafe(nil), Regexp) - -# Characters that cannot appear in a logfmt key: spaces and control characters (including -# NEL), which would end the key or the line, the `=` and `"` delimiters, LINE SEPARATOR and -# PARAGRAPH SEPARATOR, which some readers treat as newlines, and the invisible format -# characters, such as ZERO WIDTH SPACE and RIGHT-TO-LEFT OVERRIDE, which would let a key pass -# for another one, such as "level" followed by a ZERO WIDTH SPACE for "level". -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:60 -SemanticLogger::Formatters::Logfmt::UNSAFE_KEY_CHARS = T.let(T.unsafe(nil), Regexp) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:5 -class SemanticLogger::Formatters::Loki < ::SemanticLogger::Formatters::Base - # Returns [String] a JSON batch of logs - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:17 - def batch(logs, logger); end - - # Returns [String] a single JSON log - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:9 - def call(log, logger); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:6 - def payload_value; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:6 - def payload_value=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:6 - def stream; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:6 - def stream=(_arg0); end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:56 - def application; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:30 - def build_stream; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:80 - def context; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:119 - def duration; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:60 - def environment; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:126 - def exception; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:96 - def format_time(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:52 - def host; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:64 - def level; end - - # Returns [String] the value as Loki accepts it. - # - # A structure is written once, as JSON, depth-limited and repaired by Utils.to_json. - # Encoding each nested level into a String that the next level encodes again doubled the - # escaping at every level, so a request parameter 30 levels deep produced gigabytes. A - # structure's #to_s is its #inspect, which would also expose the instance variables of any - # object it holds. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:150 - def loki_value(value); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:92 - def message; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:112 - def metric; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:76 - def named_tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:100 - def payload; end - - # Loki only accepts Strings as keys and values. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:137 - def stringify_hash(hash); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:72 - def tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:68 - def thread; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:88 - def time; end -end - -# Only output one line for each log entry. -# -# Notes: -# * New lines and carriage returns are stripped from every text field: the name, thread name, -# file name, tags, named tags, message, payload and exception message. -# With `escape_control_chars: true` they, and all other control characters, are escaped -# instead, like the other text formatters. -# * Exceptions only include the class and message, the stack trace is not shown. -# * Exception details, when enabled, are joined onto the same line. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:12 -class SemanticLogger::Formatters::OneLine < ::SemanticLogger::Formatters::Default - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:50 - def exception; end - - # The exception details, with each line trimmed and joined by a space. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:58 - def exception_details; end - - # A log call can supply the backtrace that the file name comes from. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:36 - def file_name_and_line; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:41 - def message; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:31 - def name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:23 - def named_tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:45 - def payload; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:17 - def tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:13 - def thread_name; end - - private - - # Off by default, so that existing one line output does not change. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:68 - def default_log_exception_details; end - - # Returns [String] the value without line breaks, so that the entry stays on one line. - # - # A String with invalid bytes, such as a request parameter decoded from "%FF", or in another - # encoding, such as a binary request body, is converted to valid UTF-8 first, since deleting - # from it, or joining it with UTF-8 text, would raise and lose the entry. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:77 - def one_line(value); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:4 -class SemanticLogger::Formatters::OpenTelemetry < ::SemanticLogger::Formatters::Raw - # Returns the attributes hash submitted to the OpenTelemetry SDK. - # - # Unlike the JSON formatters there is no single `.to_json` boundary here: - # the hash is handed to the OTLP exporter, which requires valid UTF-8. Cleanse - # the whole structure so binary / non UTF-8 strings cannot break the export. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:13 - def call(log, logger); end - - # Log level - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:18 - def level; end - - # Payload is submitted directly as attributes, which must be a Hash. A log call can supply - # any value as the payload, such as a String parsed from a request body, so any other value - # is submitted as a single "payload" attribute. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:26 - def payload; end - - private - - # A primitive as-is, and anything else as a String: a structure (such as a Hash, Struct, or - # Set) as JSON, depth-limited and repaired by Utils.to_json, rather than its #to_s, which is - # its #inspect and would expose the instance variables of any object it holds. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:42 - def coerce_element(v); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:49 - def coerce_map(h); end - - # An attribute value: a primitive, or an Array of them. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:35 - def coerce_value(v); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:57 - def severity_number(severity); end -end - -# primitives allowed by OTLP logs in Ruby: String, Integer, Float, TrueClass, FalseClass -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:6 -SemanticLogger::Formatters::OpenTelemetry::PRIMS = T.let(T.unsafe(nil), Array) - -# Formats log messages using a configurable pattern string, so a custom -# log line layout can be specified directly in the configuration without -# having to write a new formatter class. -# -# Pattern placeholders use the form `%{directive}`, where `directive` is the -# name of any of the formatting methods (inherited from Default, or defined -# below). Named tags support a parameterized form: `%{named_tags:request_id}` -# returns the value of a single named tag. Use `%%{...}` to emit a literal -# `%{...}` without interpolation. -# -# Example: -# SemanticLogger.add_appender( -# io: $stdout, -# formatter: { -# pattern: { pattern: "%{time} %{level} %{name} -- %{message}" } -# } -# ) -# -# Available directives: -# time Formatted timestamp. Optionally accepts a strftime -# format, e.g. time:%Y-%m-%dT%H:%M:%S.%6N. -# level Full level name, e.g. "debug". -# level_short Single character level, e.g. "D". -# name Logger / class name. -# message Log message. -# payload Payload rendered as a string. -# exception_class Class of the logged exception, e.g. "RuntimeError". -# exception_message Message of the logged exception. -# exception_details Detail Ruby adds to the exception's message, such as -# did_you_mean suggestions (see the log_exception_details option). -# backtrace Backtrace of the logged exception. -# duration Human readable duration, e.g. "1.2ms". -# duration_ms Duration in milliseconds (numeric). -# thread_name Name of the thread that logged the message. -# pid Process id. -# file_name Ruby file name that logged the message, e.g. "app.rb". -# line Line number within the Ruby file, e.g. 42. -# tags Tags, comma separated. -# named_tags All named tags, or one tag with named_tags:key. -# host Host name. -# application Application name. -# environment Environment name. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:47 -class SemanticLogger::Formatters::Pattern < ::SemanticLogger::Formatters::Default - # Parameters: - # pattern: [String] - # The pattern string used to format every log entry. - # Default: DEFAULT_PATTERN - # - # Plus all the options supported by SemanticLogger::Formatters::Base. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:89 - def initialize(pattern: T.unsafe(nil), **args); end - - # Application name. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:191 - def application; end - - # Backtrace of the logged exception. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:138 - def backtrace; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:200 - def call(log, logger); end - - # Human readable duration (without the Default formatter's surrounding parentheses). - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:143 - def duration; end - - # Duration in milliseconds. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:148 - def duration_ms; end - - # Environment name. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:196 - def environment; end - - # Class of the logged exception, e.g. "RuntimeError". - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:128 - def exception_class; end - - # Message of the logged exception. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:133 - def exception_message; end - - # Name of the Ruby file that logged the message, e.g. "app.rb". Escaped like the other - # fields, since a log call can supply the backtrace it comes from. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:154 - def file_name; end - - # Host name. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:186 - def host; end - - # Full level name, e.g. "debug" (Default formatter uses the short "D"). - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:108 - def level; end - - # Single character level, e.g. "D". - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:113 - def level_short; end - - # Line number within the Ruby file that logged the message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:159 - def line; end - - # Log message (without the "-- " prefix the Default formatter adds). - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:118 - def message; end - - # With a key: the value of a single named tag, e.g. %{named_tags:request_id}. - # Without a key: all named tags rendered as "key: value, ...". - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:172 - def named_tags(key = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:48 - def pattern; end - - # Raw payload rendered as a string. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:123 - def payload; end - - # Tags joined by a comma (without the Default formatter's surrounding brackets). - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:164 - def tags; end - - # Formatted timestamp. With a strftime format argument, e.g. - # %{time:%Y-%m-%dT%H:%M:%S.%6N}, the time is formatted with that string. - # Without an argument it uses the formatter's configured time_format. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:101 - def time(format = T.unsafe(nil)); end - - private - - # Parse the pattern string into an array of tokens: frozen literal strings - # and Token structs for each %{directive} placeholder. %%{...} is an escape - # that produces a literal %{...}. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:214 - def compile(string); end -end - -# Approximates the Default formatter's output. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:51 -SemanticLogger::Formatters::Pattern::DEFAULT_PATTERN = T.let(T.unsafe(nil), String) - -# The directives that may appear in a pattern. The value is whether the -# directive accepts a parameter, e.g. %{named_tags:request_id}. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:55 -SemanticLogger::Formatters::Pattern::DIRECTIVES = T.let(T.unsafe(nil), Hash) - -# A single interpolated directive within a compiled pattern. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 -class SemanticLogger::Formatters::Pattern::Token < ::Struct - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def arguments; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def arguments=(_); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def method_name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def method_name=(_); end - - class << self - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def [](*_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def inspect; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def keyword_init?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def members; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:80 - def new(*_arg0); end - end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:4 -class SemanticLogger::Formatters::Raw < ::SemanticLogger::Formatters::Base - # By default Raw formatter does not reformat the time - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:9 - def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end - - # Application name - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:20 - def application; end - - # Returns log messages in Hash format - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:114 - def call(log, logger); end - - # Duration - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:70 - def duration; end - - # Environment - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:25 - def environment; end - - # Exception - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:93 - def exception; end - - # Ruby file name and line number that logged the message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:51 - def file_name_and_line; end - - # Fields are added by populating this hash. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 - def hash; end - - # Fields are added by populating this hash. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 - def hash=(_arg0); end - - # Host name - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:15 - def host; end - - # Log level - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:35 - def level; end - - # Log message - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:83 - def message; end - - # Metric - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:108 - def metric; end - - # Class / app name - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:78 - def name; end - - # Named Tags - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:65 - def named_tags; end - - # Payload - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:88 - def payload; end - - # Process ID - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:41 - def pid; end - - # Tags - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:60 - def tags; end - - # Name of the thread that logged the message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:46 - def thread_name; end - - # Date & time - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:30 - def time; end - - # Fields are added by populating this hash. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 - def time_key; end - - # Fields are added by populating this hash. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 - def time_key=(_arg0); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:4 -class SemanticLogger::Formatters::Signalfx < ::SemanticLogger::Formatters::Base - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:7 - def initialize(token:, dimensions: T.unsafe(nil), gauge_name: T.unsafe(nil), counter_name: T.unsafe(nil), time_format: T.unsafe(nil), **args); end - - # Returns [Hash] a batch of log messages. - # Signalfx has a minimum resolution of 1 second. - # Metrics of the same type, time (second), and dimensions can be aggregated together. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:110 - def batch(logs, logger); end - - # Returns [Hash] log message in Signalfx format. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:79 - def call(log, logger); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def counter_name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def counter_name=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def dimensions; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def dimensions=(_arg0); end - - # Dimensions for this metric - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:57 - def format_dimensions; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def gauge_name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def gauge_name=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def hash; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def hash=(_arg0); end - - # Create SignalFx friendly metric. - # Strip leading '/' - # Convert remaining '/' to '.' - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:24 - def metric; end - - # Date & time - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:46 - def time; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def token; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:5 - def token=(_arg0); end - - # Value of this metric - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:52 - def value; end - - private - - # Sum counters with the same time (second), name, and dimensions. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:151 - def add_counter(counters, metric); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:146 - def add_gauge(gauges, metric); end - - # Find Metrics with the same timestamp, metric name, and dimensions. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:157 - def find_match(list, metric); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:3 -class SemanticLogger::Formatters::Syslog < ::SemanticLogger::Formatters::Default - # Create a Syslog Log Formatter - # - # Parameters: - # facility: [Integer] - # One of the ::Syslog::LOG_* facility constants, for example ::Syslog::LOG_LOCAL0. - # Default: LOG_USER - # - # level_map: [Hash | SemanticLogger::Formatters::Syslog::LevelMap] - # Supply a custom map of SemanticLogger levels to syslog levels. - # - # escape_control_chars: [Boolean] - # Replace control characters (newlines, the ANSI escape, etc.) in - # untrusted log data with a printable escaped form so that they cannot - # forge or split syslog records. - # Default: true (unlike other formatters, since syslog frames records - # with a separator) - # - # max_size: [Integer] - # Maximum size of each syslog packet, in bytes. - # Default: DEFAULT_MAX_SIZE (1024) - # - # Example: - # # Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING. - # SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE}) - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:132 - def initialize(facility: T.unsafe(nil), level_map: T.unsafe(nil), max_size: T.unsafe(nil), escape_control_chars: T.unsafe(nil), **args); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:163 - def call(log, logger); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:5 - def facility; end - - # Set the facility to one of the ::Syslog::LOG_* facility constants. - # Raises ArgumentError for any other value, so that a mistake surfaces here rather than on - # every log entry. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:148 - def facility=(facility); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:5 - def level_map; end - - # Set the map of log levels to syslog severities, as a LevelMap or a Hash of overrides. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:154 - def level_map=(level_map); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:4 - def max_size; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:4 - def max_size=(_arg0); end - - # Time is part of the syslog packet and is not included in the formatted message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:159 - def time; end - - private - - # Create Syslog Packet - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:174 - def create_syslog_packet(message); end - - # Off by default, so that existing syslog records do not change. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:186 - def default_log_exception_details; end - - class << self - # Returns [Integer] the facility number (0 to 23) that the syslog protocol sends, for a facility - # given as documented: one of the `::Syslog::LOG_*` facility constants, such as - # `::Syslog::LOG_LOCAL0`. syslog(3) defines each of those as the facility number shifted left - # by 3 bits, so `::Syslog::LOG_USER` is 8 and its facility number is 1. - # - # Raises ArgumentError for any other value, including a bare facility number. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:51 - def facility_number(facility); end - - # Load the syslog_protocol gem, which builds the packets for remote syslog. - # Called when a syslog formatter is created, so the gem is only needed by applications - # that log to a remote syslog server. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:100 - def require_syslog_protocol; end - end -end - -# Default maximum size of a syslog packet, in bytes, as for the syslog appender. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:40 -SemanticLogger::Formatters::Syslog::DEFAULT_MAX_SIZE = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:22 -SemanticLogger::Formatters::Syslog::LOG_AUTH = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:28 -SemanticLogger::Formatters::Syslog::LOG_AUTHPRIV = T.let(T.unsafe(nil), Integer) - -# Syslog severities and facilities, with the same values as the matching `::Syslog` constants. -# The `syslog` gem is only needed to log to a local syslog daemon, and since Ruby 3.4 it is a -# bundled gem, so remote syslog must not depend on it for these values. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:10 -SemanticLogger::Formatters::Syslog::LOG_CRIT = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:27 -SemanticLogger::Formatters::Syslog::LOG_CRON = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:21 -SemanticLogger::Formatters::Syslog::LOG_DAEMON = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:15 -SemanticLogger::Formatters::Syslog::LOG_DEBUG = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:11 -SemanticLogger::Formatters::Syslog::LOG_ERR = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:29 -SemanticLogger::Formatters::Syslog::LOG_FTP = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:14 -SemanticLogger::Formatters::Syslog::LOG_INFO = T.let(T.unsafe(nil), Integer) - -# Syslog facilities, as syslog(3) defines them: the facility number shifted left by 3 bits. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:18 -SemanticLogger::Formatters::Syslog::LOG_KERN = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:30 -SemanticLogger::Formatters::Syslog::LOG_LOCAL0 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:31 -SemanticLogger::Formatters::Syslog::LOG_LOCAL1 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:32 -SemanticLogger::Formatters::Syslog::LOG_LOCAL2 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:33 -SemanticLogger::Formatters::Syslog::LOG_LOCAL3 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:34 -SemanticLogger::Formatters::Syslog::LOG_LOCAL4 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:35 -SemanticLogger::Formatters::Syslog::LOG_LOCAL5 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:36 -SemanticLogger::Formatters::Syslog::LOG_LOCAL6 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:37 -SemanticLogger::Formatters::Syslog::LOG_LOCAL7 = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:24 -SemanticLogger::Formatters::Syslog::LOG_LPR = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:20 -SemanticLogger::Formatters::Syslog::LOG_MAIL = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:25 -SemanticLogger::Formatters::Syslog::LOG_NEWS = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:13 -SemanticLogger::Formatters::Syslog::LOG_NOTICE = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:23 -SemanticLogger::Formatters::Syslog::LOG_SYSLOG = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:19 -SemanticLogger::Formatters::Syslog::LOG_USER = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:26 -SemanticLogger::Formatters::Syslog::LOG_UUCP = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:12 -SemanticLogger::Formatters::Syslog::LOG_WARNING = T.let(T.unsafe(nil), Integer) - -# Default level map for every log level -# -# :fatal => ::Syslog::LOG_CRIT - "A critical condition has occurred" -# :error => ::Syslog::LOG_ERR - "An error occurred" -# :warning =>::Syslog::LOG_WARNING - "Warning of a possible problem" -# :info => ::Syslog::LOG_NOTICE - "A normal but significant condition occurred" -# :debug => ::Syslog::LOG_INFO - "Informational message" -# :trace => ::Syslog::LOG_DEBUG - "Debugging information" -# -# The following levels are not used by default. -# ::Syslog::LOG_EMERG - "System is unusable" -# ::Syslog::LOG_ALERT - "Action needs to be taken immediately" -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:73 -class SemanticLogger::Formatters::Syslog::LevelMap - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:82 - def initialize(trace: T.unsafe(nil), debug: T.unsafe(nil), info: T.unsafe(nil), warn: T.unsafe(nil), error: T.unsafe(nil), fatal: T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:92 - def [](level); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def debug; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def debug=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def error; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def error=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def fatal; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def fatal=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def info; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def info=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def trace; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def trace=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def warn; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:74 - def warn=(_arg0); end - - class << self - # Returns [LevelMap] the supplied level map, or a new one with a Hash of overrides applied, - # for example `{warn: LOG_NOTICE}`. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:78 - def build(level_map); end - end -end - -# The highest facility the syslog protocol can encode. -# -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:43 -SemanticLogger::Formatters::Syslog::MAX_FACILITY = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:3 -class SemanticLogger::Formatters::SyslogCee < ::SemanticLogger::Formatters::Raw - # CEE JSON Syslog format - # Untested prototype code. Based on documentation only. - # If this works for you, please let us know by opening an issue. - # - # Parameters: - # facility: [Integer] - # One of the ::Syslog::LOG_* facility constants, for example ::Syslog::LOG_LOCAL0. - # Default: SemanticLogger::Formatters::Syslog::LOG_USER - # - # level_map: [Hash | SemanticLogger::Formatters::Syslog::LevelMap] - # Supply a custom map of SemanticLogger levels to syslog levels. - # - # max_size: [Integer] - # Maximum size of each syslog packet, in bytes. - # Default: SemanticLogger::Formatters::Syslog::DEFAULT_MAX_SIZE (1024) - # - # Example: - # # Log via udp to a remote syslog server on host: `server1` and port `8514`, using the CEE format. - # SemanticLogger.add_appender(appender: :syslog, formatter: :syslog_cee, url: 'udp://server1:8514') - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:26 - def initialize(facility: T.unsafe(nil), level_map: T.unsafe(nil), max_size: T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:53 - def call(log, logger); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:5 - def facility; end - - # Set the facility to one of the ::Syslog::LOG_* facility constants. - # Raises ArgumentError for any other value, so that a mistake surfaces here rather than on - # every log entry. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:39 - def facility=(facility); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:5 - def level_map; end - - # Set the map of log levels to syslog severities, as a LevelMap or a Hash of overrides. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:45 - def level_map=(level_map); end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:4 - def max_size; end - - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:4 - def max_size=(_arg0); end - - # Time is part of the syslog packet and is not included in the formatted message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:50 - def time; end - - private - - # Create Syslog Packet - # - # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:61 - def create_syslog_packet(message); end -end - -# Logging levels in order of most detailed to most severe -# -# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:5 -SemanticLogger::LEVELS = T.let(T.unsafe(nil), Array) - -# pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:4 -module SemanticLogger::Levels - class << self - # Internal method to return the log level as an internal index - # Also supports mapping the ::Logger levels to SemanticLogger levels - # - # pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:17 - def index(level); end - - # Returns the symbolic level for the supplied level index - # - # pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:41 - def level(level_index); end - - # Returns [true|false] whether the supplied value is a level that #index accepts. - # Never raises, so it can be used to check values that come from untrusted data. - # - # pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:34 - def valid?(level); end - end -end - -# Logging levels in order of most detailed to most severe -# -# pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:6 -SemanticLogger::Levels::LEVELS = T.let(T.unsafe(nil), Array) - -# Map the built-in `Logger` levels to SemanticLogger levels. -# -# pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:9 -SemanticLogger::Levels::MAPPED_LEVELS = T.let(T.unsafe(nil), Array) - -# Log -# -# Class to hold all log entry information -# -# level -# Log level of the supplied log call -# :trace, :debug, :info, :warn, :error, :fatal -# -# thread_name -# Name of the thread in which the logging call was called, -# or its object id when the thread has no name -# -# name -# Class name supplied to the logging instance -# -# message -# Text message to be logged -# -# payload -# Optional Hash or Ruby Exception object to be logged -# -# time -# The time at which the log entry was created -# -# duration -# The time taken to complete a measure call -# -# tags -# Any tags active on the thread when the log call was made -# -# level_index -# Internal index of the log level -# -# exception -# Ruby Exception object to log -# -# metric [Object] -# Object supplied when measure_x was called -# -# backtrace [Array] -# The backtrace captured at source when the log level >= SemanticLogger.backtrace_level -# -# metric_amount [Numeric] -# Used for numeric or counter metrics. -# For example, the number of inquiries or, the amount purchased etc. -# -# context [Hash] -# Named contexts that were captured when the log entry was created. -# -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:50 -class SemanticLogger::Log - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:96 - def initialize(name, level, index = T.unsafe(nil)); end - - # Assign named arguments to this log entry, supplying defaults where applicable - # - # Returns [true|false] whether this log entry should be logged - # - # Example: - # logger.info(name: 'value') - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:112 - def assign(message: T.unsafe(nil), payload: T.unsafe(nil), min_duration: T.unsafe(nil), exception: T.unsafe(nil), metric: T.unsafe(nil), metric_amount: T.unsafe(nil), duration: T.unsafe(nil), backtrace: T.unsafe(nil), log_exception: T.unsafe(nil), on_exception_level: T.unsafe(nil), dimensions: T.unsafe(nil)); end - - # Assign the Hash returned by a logging block, after #assign has applied the log call. - # - # A block can return untrusted data, such as a parsed request body, so its keys are classified - # by #extract_arguments, as for a Hash passed after the message. A log argument is only assigned - # when this entry does not have it yet (an exception must also be an Exception), and otherwise - # goes to the payload like any other key. Whatever the key order, the log call's values win, - # then the block's top-level keys, then those of its :payload. No supplied Hash is modified. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:180 - def assign_hash(hash); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def backtrace; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def backtrace=(_arg0); end - - # Returns [String] the exception backtrace including all of the child / caused by exceptions - # - # When a block is supplied, each cause's message and each backtrace line is passed - # to it, and the value it returns is written in its place. This lets a caller, for - # example a formatter, transform that text while this method keeps the layout. - # - # Example: - # log.backtrace_to_s { |text| text.gsub("\n", "\\n") } - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:300 - def backtrace_to_s(&block); end - - # Strip the standard Rails colorizing from the logged message. - # - # Note: This unconditionally *strips* ANSI colorization, and is used to keep - # terminal escape codes out of structured (JSON/Loki) output. It is distinct - # from Formatters::Base#escape_control_characters, which instead *escapes* - # (preserves) control characters and is opt-in for the text formatters. - # - # A message tagged UTF-8 can hold invalid bytes, for example a request parameter that Rack - # decoded from "%FF", or be in another encoding, such as a binary request body. Stripping or - # matching such a String raises, so it is converted to valid UTF-8 first, dropping the - # invalid bytes, as the JSON formatters do. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:391 - def cleansed_message; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def context; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def context=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def dimensions; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def dimensions=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def duration; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def duration=(_arg0); end - - # Returns [String] the duration in human readable form - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:331 - def duration_human; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:323 - def duration_to_s; end - - # Call the block for exception and any nested exception - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:243 - def each_exception; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def exception; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def exception=(_arg0); end - - # Returns [String] the detail that Ruby's Exception#detailed_message adds to the message of the - # supplied exception, without the class name that Ruby also adds. Since Ruby 3.2 this is where - # did_you_mean suggestions ("Did you mean? upcase") and the detail an exception class supplies - # by overriding #detailed_message appear, rather than in #message. - # Returns nil when there is no detail. - # - # Parameters - # exception: [Exception] - # This entry's exception, or one of its causes (see #each_exception). - # source: [true|false] - # Whether to include error_highlight's snippet of the failing source line, for example - # "user_name.upcas" with "^^^^^^" under the unknown method. It re-parses that source - # file on every call, so it is about 100 times slower, and it copies source code into - # the log. - # Default: false - # - # The result is cached on this entry, since every appender's formatter may ask for it. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:281 - def exception_details(exception, source: T.unsafe(nil)); end - - # Extract the arguments from a Hash Payload - # - # The hash can hold untrusted data, so this never fails because of its content: keys that are - # not log attributes, or that hold a value that is not valid for it (see .argument?), are kept - # in the payload. A log attribute key with a nil value counts as not supplied, so #assign uses - # its default. When the hash supplies an explicit :payload, any other keys are merged into it, - # and win over its values of the same name, since the explicit payload is where untrusted data - # goes (see docs/security.md). - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:212 - def extract_arguments(payload, message = T.unsafe(nil)); end - - # Extract the filename and line number from the last entry in the supplied backtrace - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:364 - def extract_file_and_line(stack, short_name = T.unsafe(nil)); end - - # Returns [String, String] the file_name and line_number from the backtrace supplied - # in either the backtrace or exception - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:375 - def file_name_and_line(short_name = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def level; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def level=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def level_index; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def level_index=(_arg0); end - - # Returns [String] single character upper case log level - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:349 - def level_to_s; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def message; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def message=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def metric; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def metric=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def metric_amount; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def metric_amount=(_arg0); end - - # A metric only event has a metric but no message or exception. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:425 - def metric_only?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def name=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def named_tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def named_tags=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def payload; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def payload=(_arg0); end - - # Returns [true|false] whether the log entry has a payload - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:409 - def payload?; end - - # Return the payload in text form - # Returns nil if payload is missing or empty - # - # Rendered with #inspect, or with the block when given (for example Amazing Print). A payload - # nested too deeply for either is first cut off at Utils::MAX_JSON_SAFE_DEPTH, rather than - # raising SystemStackError (see Utils.safe_inspect). - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:404 - def payload_to_s(&); end - - # DEPRECATED - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:354 - def process_info(thread_name_length = T.unsafe(nil)); end - - # Lazy initializes the context hash and assigns a key value pair. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:420 - def set_context(key, value); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def tags; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def tags=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def thread_name; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def thread_name=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def time; end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:91 - def time=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:413 - def to_h(host = T.unsafe(nil), application = T.unsafe(nil), environment = T.unsafe(nil)); end - - private - - # Whether a log argument from the Hash returned by a logging block, already checked by - # .argument?, is assigned to its attribute: only when this entry does not have it yet. As in - # #extract_arguments, an empty message counts as none. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:457 - def block_attribute?(key, value); end - - # Returns the kept payload with the keys of the added one that it does not have, so that a kept - # value is never replaced. A String and a Symbol key of the same name, such as "account_id" from - # JSON.parse and :account_id, count as the same key, since the formatters write both under that - # name. A payload that is not a Hash is kept as its :payload key, but the kept payload is - # returned unchanged when there is nothing to add. Neither payload is modified. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:436 - def merge_payload(kept, added); end - - class << self - # Returns [true|false] whether the value can be used as the log argument named by the key. - # - # Never raises, so it can check values from untrusted data before they are passed to #assign. - # A nil value is never an argument, since it means the argument was not supplied. Arguments - # without a validator in ARGUMENT_VALIDATORS (such as :message, :metric, or :exception, which - # #assign logs as an ArgumentError when it is not an Exception) accept any other value. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:197 - def argument?(key, value); end - - # Whether the value is accepted for the :log_exception argument of #assign. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:83 - def log_exception_option?(value); end - - # Returns [String] the name that identifies the thread in a log entry: the thread's own name, - # or its object id when it has none, which Ruby never reuses within a process. - # - # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:89 - def thread_name_for(thread); end - end -end - -# Checks that a value is valid for its argument, for the arguments that do not accept any value. -# Any other value would make #assign, or the formatters, raise. -# -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:67 -SemanticLogger::Log::ARGUMENT_VALIDATORS = T.let(T.unsafe(nil), Hash) - -# Log attributes that a Hash returned by a logging block can set (see #assign_hash). Its other -# keys go to the payload, so that it cannot set fields such as :level, :name, or :time. -# -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:171 -SemanticLogger::Log::ASSIGNABLE_KEYS = T.let(T.unsafe(nil), Array) - -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:361 -SemanticLogger::Log::CALLER_REGEXP = T.let(T.unsafe(nil), Regexp) - -# Hash#key?, which unlike HashWithIndifferentAccess#key? only matches the exact Symbol key. -# -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:79 -SemanticLogger::Log::HASH_KEY = T.let(T.unsafe(nil), UnboundMethod) - -# Values accepted for the :log_exception argument. -# -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:58 -SemanticLogger::Log::LOG_EXCEPTION_OPTIONS = T.let(T.unsafe(nil), Array) - -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:241 -SemanticLogger::Log::MAX_EXCEPTIONS_TO_UNWRAP = T.let(T.unsafe(nil), Integer) - -# Keys passed in without a payload that will be extracted and the remainder passed into the payload. -# -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:52 -SemanticLogger::Log::NON_PAYLOAD_KEYS = T.let(T.unsafe(nil), Array) - -# A finite real number, which #assign can compare with another one. -# -# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:62 -SemanticLogger::Log::REAL_NUMBER = T.let(T.unsafe(nil), Proc) - -# pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:32 -module SemanticLogger::Loggable - mixes_in_class_methods ::SemanticLogger::Loggable::ClassMethods - - class << self - # pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:33 - def included(base); end - end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:65 -module SemanticLogger::Loggable::ClassMethods - # Measure and log the performance of an instance method. - # - # Parameters: - # method_name: [Symbol] - # The name of the method that should be measured. - # - # options: [Hash] - # Any valid options that can be passed to measure. - # - # Approximate overhead when logging a method call with a metric: - # 0.044 ms per method call. - # 0.009 ms per method call. If `min_duration` is not met - # 0.0005 ms per method call. If `level` is not met - # - # pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:79 - def logger_measure_method(method_name, min_duration: T.unsafe(nil), metric: T.unsafe(nil), log_exception: T.unsafe(nil), on_exception_level: T.unsafe(nil), message: T.unsafe(nil), level: T.unsafe(nil)); end - - private - - # Dynamic Module to intercept method calls for measuring purposes. - # - # pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:143 - def logger_measure_module; end -end - -# Logger stores the class name to be used for all log messages so that every -# log message written by this instance will include the class name -# -# pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:4 -class SemanticLogger::Logger < ::SemanticLogger::Base - include ::SemanticLogger::Concerns::Compatibility - - # Returns a Logger instance - # - # Return the logger for a specific class, supports class specific log levels - # logger = SemanticLogger::Logger.new(self) - # OR - # logger = SemanticLogger::Logger.new('MyClass') - # - # Parameters: - # klass - # A class, module or a string with the application/class name - # to be used in the logger - # - # level - # The initial log level to start with for this logger instance - # Default: SemanticLogger.default_level - # - # filter [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied - # regular expression. All other messages will be ignored - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false - # - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:59 - def initialize(klass, level = T.unsafe(nil), filter = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def <<(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def datetime_format; end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def datetime_format=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def formatter; end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def formatter=(_arg0); end - - # Place log request on the queue for the Appender thread to write to each - # appender in the order that they were registered - # - # Subscribers are called inline before handing off to the queue so that - # they can capture additional context information as needed. - # - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:68 - def log(log, message = T.unsafe(nil), progname = T.unsafe(nil), &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def progname; end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def progname=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def sev_threshold; end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def sev_threshold=(level); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def silence_logger(new_level = T.unsafe(nil), &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def unknown(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 - def unknown?; end - - class << self - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:80 - def call_subscribers(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:22 - def processor; end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:7 - def subscribe(object = T.unsafe(nil), &block); end - - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:19 - def subscribers; end - - # Switch to the synchronous processor - # - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:27 - def sync!; end - - # Running without the background logging thread? - # - # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:34 - def sync?; end - end -end - -# @formatter:off -# -# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:625 -module SemanticLogger::Metric; end - -# pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:10 -class SemanticLogger::Metric::Signalfx < ::SemanticLogger::Appender::Http - # Create SignalFx metrics appender. - # - # Parameters: - # token: [String] - # Access Token to use for sending metrics. - # Obtain the Signalfx token via the Signalfx Web UI under `Organization` -> `Access Tokens`. - # - # dimensions: [Array] - # Dimensions to forward to signalfx when they are present in the named tags of any log message. - # By default `application` and `host` are always included as dimensions in all forwarded metrics. - # Example: [:user_id, :state] - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true. - # The Proc must return true or false. - # - # host: [String] - # Name of this host to send as a dimension. - # Default: SemanticLogger.host - # - # application: [String] - # Name of this application to send as a dimension. - # Default: SemanticLogger.application - # - # url: [String] - # Override the SignalFx service url. - # For historical data use: https://backfill.signalfx.com/v1/backfill - # Default: https://ingest.signalfx.com - # - # Notes: - # - # When sending a metric to Signalfx, it is necessary to send both a `gauge` and a `counter` when a - # duration is included in the metric, otherwise it is not possible to chart counts of the metric. - # Unfortunately this doubles the number of metrics, but it is the way Signalfx works. - # Using a `count` of a `gauge` in a chart will significantly under-count the number of occurrences. - # - # If dimensions are added to the metric, then the metric will be sent as-is and - # the above logic will _not_ be applied. - # - # Example, Gauge metric, supplying the duration in `metric_amount`: - # logger.info(metric: 'Filters.average', metric_amount: 1.2, dimensions: {user: 'jbloggs'}) - # - # Example, Counter metric: - # logger.info(metric: 'Filters.count', dimensions: {user: 'jbloggs'}) - # - # Example, Counter metric with a count other than 1: - # logger.info(metric: 'Filters.count', metric_amount: 23, dimensions: {user: 'jbloggs'}) - # - # When a duration is supplied and no dimensions are supplied: - # logger.info(metric: 'Common/User/authorize', duration: 1.4) - # - # Then it is translated into the following 2 log entries under the covers: - # logger.info(metric: 'Application.average', metric_amount: 1.4, - # dimensions: {class: 'Common::User', action: 'authorize'}) - # logger.info(metric: 'Application.counter', metric_amount: 1, - # dimensions: {class: 'Common::User', action: 'authorize'}) - # - # Similarly with a measure block which automatically supplies the duration: - # logger.measure_info(metric: 'Common/User/authorize') do - # sleep 1 - # end - # - # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:78 - def initialize(token:, dimensions: T.unsafe(nil), url: T.unsafe(nil), formatter: T.unsafe(nil), **args, &); end - - # Logs in batches - # - # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:101 - def batch(logs); end - - # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:11 - def full_path; end - - # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:94 - def log(log); end - - # Only forward log entries that contain metrics. - # - # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:108 - def should_log?(log); end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:13 -SemanticLogger::Metric::Signalfx::END_POINT = T.let(T.unsafe(nil), String) - -# Thread that submits and processes log requests -# -# pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:3 -class SemanticLogger::Processor < ::SemanticLogger::Appender::Async - # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:26 - def initialize(max_queue_size: T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:24 - def appenders; end - - # Start the appender thread - # - # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:32 - def start; end - - # Returns [Hash] operational statistics for the logging pipeline. - # - # queue_size: [Integer] Number of log messages waiting on the main pipeline queue. - # capped: [Boolean] Whether the main queue has a maximum size. - # max_queue_size: [Integer] Maximum queue size, or nil when uncapped. - # thread_active: [Boolean] Whether the main pipeline thread is running. - # processed: [Integer] Cumulative number of log messages processed since startup. - # dropped: [Integer] Cumulative number of log messages dropped at the main queue. - # appenders: [Array] Per-appender statistics, see Appenders#stats. - # - # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:48 - def stats; end - - class << self - # Internal logger for SemanticLogger - # For example when an appender is not working etc.. - # By default logs to $stderr - # - # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:15 - def logger; end - - # Internal logger for SemanticLogger - # For example when an appender is not working etc.. - # By default logs to $stderr - # - # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:9 - def logger=(_arg0); end - end -end - -# Internal class that processes log messages from a queue on a separate thread. -# -# Internal use only: it owns the worker thread and the in-memory queue that back the -# asynchronous appender proxy (SemanticLogger::Appender::Async). It is never returned to -# application code. -# -# Supports two processing modes, selected by the `batch:` option: -# * Streaming (batch: false): each log message is written to the appender as it is dequeued. -# * Batching (batch: true): log messages are grouped and written via the appender's #batch -# method, either once batch_size messages have accumulated, or -# batch_seconds have elapsed since the previous batch. -# -# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:2 -class SemanticLogger::QueueProcessor - # Parameters: - # appender: [SemanticLogger::Subscriber] - # The appender to forward log messages to from the worker thread. - # - # max_queue_size: [Integer] - # The maximum number of log messages to hold on the queue before blocking attempts to add to the queue. - # -1: The queue size is uncapped and will never block no matter how long the queue is. - # Default: 10,000 - # - # lag_threshold_s: [Float] - # Log a warning when a log message has been on the queue for longer than this period in seconds. - # Default: 30 - # - # lag_check_interval: [Integer] - # Number of messages to process before checking for slow logging. - # Default: 1,000 - # Note: Not applicable when batch: true. - # - # batch: [true|false] - # Process log messages in batches via the appender's #batch method. - # Default: false - # Note: The appender must implement #batch. - # - # batch_size: [Integer] - # Maximum number of messages to batch up before sending. - # Default: 300 - # Note: Only applicable when batch: true. - # - # batch_seconds: [Integer] - # Maximum number of seconds between sending batches. - # Default: 5 - # Note: Only applicable when batch: true. - # - # non_blocking: [true|false] - # Whether to drop log messages instead of blocking the calling thread when the queue is full. - # Only applies to a capped queue. - # Default: false - # - # dropped_message_report_seconds: [Integer] - # When non_blocking is enabled, log the count of dropped messages to the internal logger - # at most once every this number of seconds. Also limits how often messages discarded - # because their content could not be written are reported, after the first. - # Default: 30 - # - # async_max_retries: [Integer] - # Maximum number of consecutive times to restart the worker thread after it raises an - # exception while processing messages. Each restart first sleeps for `retry_count` seconds - # (1s, then 2s, ...) as a back-off. Once this many consecutive retries are exhausted the - # thread stops instead of restarting. The counter resets to zero whenever a message is - # processed successfully. - # -1: Retry indefinitely and never stop the thread (the pre-v5 behaviour). The back-off - # still applies, and still resets after any successful message. - # Default: 100 - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:82 - def initialize(appender:, max_queue_size: T.unsafe(nil), lag_check_interval: T.unsafe(nil), lag_threshold_s: T.unsafe(nil), batch: T.unsafe(nil), batch_size: T.unsafe(nil), batch_seconds: T.unsafe(nil), non_blocking: T.unsafe(nil), dropped_message_report_seconds: T.unsafe(nil), async_max_retries: T.unsafe(nil)); end - - # Returns [true|false] whether the worker thread is running. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:129 - def active?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:19 - def appender; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:19 - def async_max_retries; end - - # Returns [true|false] whether messages are processed in batches. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:146 - def batch?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def batch_seconds; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def batch_seconds=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def batch_size; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def batch_size=(_arg0); end - - # Returns [true|false] whether the queue has a capped size. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:132 - def capped?; end - - # Flush any outstanding messages and close the appender. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:187 - def close; end - - # Returns [Integer] the number of log messages dropped because the queue was full. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:139 - def dropped_count; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def dropped_message_report_seconds; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def dropped_message_report_seconds=(_arg0); end - - # Returns [Integer] the number of log messages discarded because their content could not be - # written (see Subscriber#message_error?). - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:143 - def failed_count; end - - # Flush all queued log entries to the appender. - # All queued log messages are written and then the appender is flushed. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:182 - def flush; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def lag_check_interval; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def lag_check_interval=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def lag_threshold_s; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def lag_threshold_s=(_arg0); end - - # Add a log message to the queue for processing. - # - # When non-blocking and the queue is full, the message is dropped instead of blocking the - # calling thread, and the count of dropped messages is reported periodically. - # - # Once the worker thread has stopped for good (see async_max_retries), nothing will empty the - # queue, so messages are also dropped instead of blocking the calling thread forever. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:159 - def log(log); end - - # Internal logger used to report problems encountered while processing log messages. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:117 - def logger; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:19 - def max_queue_size; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def non_blocking; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:17 - def non_blocking=(_arg0); end - - # Returns [true|false] whether messages are dropped instead of blocking when the queue is full. - # Only a capped queue can drop messages. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:136 - def non_blocking?; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:19 - def processed_count; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:19 - def queue; end - - # Re-open the queue and worker thread after a fork. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:192 - def reopen; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:19 - def retry_count; end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:19 - def signal; end - - # Returns [true|false] whether the worker thread gave up after an error, so that queued - # messages are no longer being processed. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:150 - def stopped?; end - - # Returns [Thread] the worker thread. - # - # Starts the worker thread if it is not currently running. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:122 - def thread; end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:437 - def check_lag(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:224 - def create_queue; end - - # Record a dropped message, reporting the running count to the internal logger at most - # once every dropped_message_report_seconds. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:427 - def message_dropped; end - - # Whether the appender says the exception was caused by the content of a log message, rather - # than by the destination. An appender that cannot tell (it does not implement - # #message_error?) has every error retried with a back-off. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:412 - def message_error?(exception); end - - # Record log messages discarded because their content could not be written. The first is - # reported to the internal logger straight away, with the error. After that the count is - # reported, with the latest error, at most once every dropped_message_report_seconds. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:417 - def messages_failed(logs, exception); end - - # Name the worker thread after its appender, such as "SL File", short enough for tools that - # list threads, such as `top -H`, to tell the workers apart: Linux keeps only the first 15 bytes. - # The name is only a label, so when Ruby rejects it, for example for a class given a temporary - # name with a NUL byte, the thread carries on without one. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:218 - def name_worker; end - - # Separate thread for processing log messages. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:235 - def process; end - - # Run a command after a batch could not be written. Returns false once a command (:close) - # stops processing, even when the command itself fails. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:351 - def process_message_after_failure(command); end - - # Streaming: write each log message to the appender as it is dequeued. - # - # Returns true when processing must carry on in a new thread (see #stack_overflowed). - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:274 - def process_messages; end - - # Batching: group up log messages before writing them via the appender's #batch method. - # - # Returns true when processing must carry on in a new thread (see #stack_overflowed). - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:299 - def process_messages_in_batches; end - - # Log to the internal logger, ignoring any error. - # These calls may run after Ruby has released file handles during shutdown. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:265 - def safe_log(level, message, exception = T.unsafe(nil)); end - - # Start the worker thread. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:205 - def spawn_worker; end - - # Discard log messages whose writing overflowed the stack, for example a value nested too - # deeply for a custom formatter. Retrying cannot write them, as for #message_error?. - # - # This thread must not overflow its stack again: on macOS a second stack overflow on the same - # thread crashes Ruby. So nothing else is written on it, including the rest of a batch, which - # is discarded rather than split up further to find the message at fault. Once any commands - # taken off the queue with the messages have run, a new thread carries on (see #process). - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:404 - def stack_overflowed(logs, exception); end - - # Submit a command to the worker thread and wait for the reply. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:447 - def submit_request(command); end - - # Write the log messages to the appender as a batch. - # - # When the content of a message cannot be written (see #message_error?), and the appender's - # #batch is all or nothing, the batch is split in half and each half written separately, so - # that only the offending message is discarded rather than every message in the batch. - # Otherwise the batch is discarded, since writing it again could duplicate the messages that - # the appender had already written. A stack overflow discards the batch, and the rest of the - # batch being split, without splitting it further (see #stack_overflowed). - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:383 - def write_batch(logs); end - - # Write the log messages taken off the queue as a batch, then run the commands taken off the - # queue with them. Returns false once a command (:close) stops processing. - # - # When the batch cannot be written, for example because the destination is unavailable, the - # commands still run before the error propagates to #process to back off. Otherwise they - # would be lost, and a caller waiting on #flush or #close, such as the flush at exit, would - # wait forever. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:336 - def write_batch_then_run(logs, commands); end - - # Write one log message to the appender. - # - # A message whose content cannot be written (see #message_error?) is discarded and reported, - # without restarting the thread. Any other error, such as the destination being unavailable, - # propagates to #process, which backs off before retrying. A stack overflow discards the - # message too (see #stack_overflowed). - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:364 - def write_message(log); end - - class << self - # Create a new processor and start its worker thread. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:23 - def start(**args); end - end -end - -# Internal: a command, such as :flush or :close, submitted on the queue for the worker thread -# to run, while the submitting thread waits for the reply. -# -# It knows its command and how its reply gets back to the submitting thread, and makes sure -# that the submitting thread is never left waiting on a reply that cannot come. -# -# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:8 -class SemanticLogger::QueueProcessor::Request - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:11 - def initialize(command); end - - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:9 - def command; end - - # Called by the worker thread: run the block for this request, then reply with true, or - # with false when the block raised. Replies either way. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:18 - def reply; end - - # Called by the worker thread: run this command on the appender, then reply. Returns false - # once message processing must stop (:close). - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:28 - def run(appender); end - - # Called by the submitting thread: wait for the reply from the worker thread. - # - # The block returns whether a worker thread that can still reply is running. Returns the - # reply, or false once none is, for example once the worker gave up after - # async_max_retries, or was replaced after a fork. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:46 - def wait; end -end - -# Internal: counts occurrences of a problem, such as a dropped log message, and has it -# reported at most once per interval instead of once per occurrence. -# -# It knows the total number of occurrences, how many there have been since the previous -# report, and when that report was made. What to report, and where, is up to the caller. -# -# Thread-safe: occurrences may be recorded from any thread. -# -# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:10 -class SemanticLogger::QueueProcessor::ThrottledCounter - # Parameters: - # reported_at: [Time|nil] - # When counting starts, so that the first report is due one interval later. - # nil: Report the first occurrence straight away. - # Default: Time.now - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:19 - def initialize(reported_at: T.unsafe(nil)); end - - # Record one or more occurrences. - # - # When the previous report was at least `interval` seconds ago, yields the number of - # occurrences since then (including these) and the seconds elapsed since that report (nil - # when there has been no report yet), then starts counting afresh for the next report. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:31 - def record(count = T.unsafe(nil), interval:); end - - # Returns [Integer] the total number of occurrences recorded. - # - # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:12 - def total; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:631 -module SemanticLogger::Reporters; end - -# When using Minitest to run tests, log start and end messages for every test to the log file. -# On completion the time it took to run the test is also logged. -# -# For example, add the following lines to `test_helper.rb`: -# require 'minitest/reporters' -# -# reporters = [ -# Minitest::Reporters::ProgressReporter.new, -# SemanticLogger::Reporters::Minitest.new -# ] -# Minitest::Reporters.use!(reporters) -# -# And add `gem minitest-reporters` to the Gemfile. -# -# Log entries similar to the following should show up in the log file: -# -# 2019-02-06 18:58:17.522467 I [84730:70256] Minitest -- START MyJob test_0001_archives file -# 2019-02-06 18:58:17.527492 I [84730:70256] (4.980ms) Minitest -- PASS MyJob test_0001_archives file -# 2019-02-06 18:58:17.527835 I [84730:70256] Minitest -- START MyJob test_0002_returns job class -# 2019-02-06 18:58:17.529761 I [84730:70256] (1.882ms) Minitest -- PASS MyJob test_0002_returns job class -# -# pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:23 -class SemanticLogger::Reporters::Minitest < ::Minitest::AbstractReporter - include ::SemanticLogger::Loggable - extend ::SemanticLogger::Loggable::ClassMethods - - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:34 - def after_test(test); end - - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:30 - def before_test(test); end - - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:28 - def io; end - - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:28 - def io=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 - def logger; end - - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 - def logger=(logger); end - - class << self - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 - def logger; end - - # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 - def logger=(logger); end - end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:5 -class SemanticLogger::Subscriber < ::SemanticLogger::Base - # Initializer for Abstract Class SemanticLogger::Subscriber - # - # Parameters - # level: [:trace | :debug | :info | :warn | :error | :fatal] - # Override the log level for this subscriber. - # - # formatter: [Object|Proc] - # An instance of a class that implements #call, or a Proc to be used to format - # the output from this subscriber - # Default: Use the built-in formatter (See: #call) - # - # filter: [Regexp|Proc] - # RegExp: Only include log messages where the class name matches the supplied. - # regular expression. All other messages will be ignored. - # Proc: Only include log messages where the supplied Proc returns true - # The Proc must return true or false. - # - # application: [String] - # Name of this application to appear in log messages. - # Default: SemanticLogger.application - # - # host: [String] - # Name of this host to appear in log messages. - # Default: SemanticLogger.host - # - # metrics: [Boolean] - # Whether to log metric only entries with this subscriber. - # Default: false - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:208 - def initialize(level: T.unsafe(nil), formatter: T.unsafe(nil), filter: T.unsafe(nil), application: T.unsafe(nil), environment: T.unsafe(nil), host: T.unsafe(nil), metrics: T.unsafe(nil), &block); end - - # Allow application name to be set globally or on a per subscriber basis. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:31 - def application; end - - # Allow application name to be set globally or on a per subscriber basis. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:8 - def application=(_arg0); end - - # Whether #batch writes none of the log messages when it raises a message error (see - # #message_error?), for example because it formats every message before sending any. - # - # When true, a batch that fails with a message error is split up and each part retried, - # so that only the offending message is discarded. When false, retrying could write some - # messages twice, so the whole batch is discarded instead. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:138 - def batch_all_or_nothing?; end - - # Whether an appender that implements #batch should be wrapped in a batch - # proxy automatically. Appenders that support batching but should only batch - # when explicitly requested (via `batch: true`) override this to return false. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:105 - def batch_by_default?; end - - # A subscriber should implement close if it can. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:16 - def close; end - - # Whether this appender is logging to stdout or stderr. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:78 - def console_output?; end - - # The console stream this appender writes to, if any. - # Returns one of :stdout, :stderr, or nil when not writing to a console stream. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:73 - def console_stream; end - - # Returns [SemanticLogger::Formatters::Default] default formatter for this subscriber. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:26 - def default_formatter; end - - # Allow environment name to be set globally or on a per subscriber basis. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:36 - def environment; end - - # Allow environment name to be set globally or on a per subscriber basis. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:8 - def environment=(_arg0); end - - # A subscriber should implement flush if it can. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:11 - def flush; end - - # Every appender has its own formatter - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:7 - def formatter; end - - # Set the formatter from Symbol|Hash|Block - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:57 - def formatter=(formatter); end - - # Allow host name to be set globally or on a per subscriber basis. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:41 - def host; end - - # Allow host name to be set globally or on a per subscriber basis. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:8 - def host=(_arg0); end - - # Returns [String] the class and object address of this appender, like Kernel#inspect, followed - # by #inspect_details, but none of its instance variables. - # - # Appenders hold credentials in their instance variables: passwords and urls holding them, api - # keys and tokens, request headers, private keys, and the options passed to a client gem. - # Printing SemanticLogger.appenders, for example in a console or an error report, must not - # show them. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:89 - def inspect; end - - # Returns [String] what #inspect shows about this appender, such as its url without its - # credentials, or nil for nothing. Only an appender knows which of its settings are safe to - # show, so each one overrides this. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:98 - def inspect_details; end - - # Method called to log an event - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:21 - def log(log); end - - # Give each appender its own logger for logging. - # For example trace messages sent to services or errors when something fails. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:47 - def logger; end - - # Give each appender its own logger for logging. - # For example trace messages sent to services or errors when something fails. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:8 - def logger=(_arg0); end - - # Whether the supplied exception, raised by #log or #batch, was caused by the content of a - # log message, rather than by the destination, for example being unavailable. - # - # Retrying cannot write such a message, so an asynchronous appender discards it and carries - # on, instead of backing off and retrying. Any other exception is retried with a back-off. - # - # Every error raised by the formatter is one (see #format_log). An appender whose client - # raises its own errors for bad content can override this to recognize them. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:128 - def message_error?(exception); end - - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:8 - def metrics=(_arg0); end - - # Whether this log entry meets the criteria to be logged by this appender. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:67 - def should_log?(log); end - - private - - # Without a level of its own, a subscriber logs everything it receives. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:222 - def fallback_level; end - - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:226 - def fallback_level_index; end - - # Returns the log messages formatted by the formatter's #batch, as for #format_log. - # - # A formatter that cannot format a batch is a configuration error rather than bad content, so - # it raises ArgumentError instead, which is retried with a back-off and reported like any - # other. That includes an appender that is its own formatter (it implements #call), whose - # #batch is the appender's own. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:168 - def format_batch(logs); end - - # Returns the log message formatted by this appender's formatter. - # - # Any StandardError the formatter raises is raised as a FormatError, with the formatter's - # error as its cause, so that #message_error? recognizes it: an asynchronous appender then - # discards the message instead of backing off. Appenders call this rather than formatter.call. - # - # A SystemStackError is raised as it is, so that rescuing StandardError does not swallow it: - # the thread that overflowed must not keep writing (see Appenders#log). - # - # The block, when given, turns the formatter's output into what the appender sends, such as - # its JSON. An error doing so is also caused by the content of the message. - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:155 - def format_log(log); end - - # Whether to log metric only entries with this subscriber - # - # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:231 - def metrics?; end -end - -# Raised by #format_log and #format_batch when the formatter fails, with the formatter's -# error as its cause. A formatter has no destination, so it can only fail because of the -# content of the log message, whatever it raises. -# -# pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:112 -class SemanticLogger::Subscriber::FormatError < ::StandardError; end - -# Errors raised by writing a log message whose content cannot be written, such as a -# value that cannot be serialized. Excludes JSON::ParserError, which comes from parsing a -# response rather than from the message, except its subclass JSON::NestingError, which -# JSON.generate raises for a value nested too deeply. -# -# pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:118 -SemanticLogger::Subscriber::MESSAGE_ERRORS = T.let(T.unsafe(nil), Array) - -# The SyncProcessor performs logging in the current thread. -# -# Appenders are designed to only be used by one thread at a time, so all calls -# are monitor protected in case SyncProcessor is being used in a multi-threaded environment. -# -# pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:6 -class SemanticLogger::SyncProcessor - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:81 - def initialize(appenders = T.unsafe(nil)); end - - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:7 - def add(*, **, &); end - - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:73 - def appenders; end - - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:45 - def close; end - - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:41 - def flush; end - - # Logs on the calling thread, which belongs to the application, so a stack overflow while - # writing (see Appenders#log) is reported rather than raised from the log call. - # - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:13 - def log(*, **, &); end - - # Returns the internal logger of the appenders, for reporting a problem while logging, such as - # an exception raised by an on_log subscriber. The same logger as the asynchronous Processor's. - # - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:77 - def logger; end - - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:49 - def reopen(*args); end - - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:87 - def start; end - - # Returns [Hash] operational statistics for the logging pipeline. - # - # In synchronous mode there is no queue: messages are written inline on the calling - # thread, so queue_size is always 0 and no messages can be dropped. - # - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:27 - def stats; end - - class << self - # Internal logger for SemanticLogger - # For example when an appender is not working etc.. - # By default logs to $stderr - # - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:64 - def logger; end - - # Internal logger for SemanticLogger - # For example when an appender is not working etc.. - # By default logs to $stderr - # - # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:58 - def logger=(_arg0); end - end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:635 -module SemanticLogger::Test; end - -# Logging class to captures all logging events in memory. -# -# Example: -# -# class UserTest < ActiveSupport::TestCase -# describe User do -# let(:logger) { SemanticLogger::Test::CaptureLogEvents.new } -# let(:user) { User.new } -# -# it "logs message" do -# user.stub(:logger, logger) do -# user.enable! -# end -# assert log = logger.events.first -# assert_equal "Hello World", log.message -# assert_equal :info, log.level -# end -# end -# end -# -# pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:22 -class SemanticLogger::Test::CaptureLogEvents < ::SemanticLogger::Subscriber - # By default collect all log levels, and collect metric only log events. - # - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:26 - def initialize(level: T.unsafe(nil), metrics: T.unsafe(nil)); end - - # Supports batching of log events - # - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:37 - def batch(logs); end - - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:41 - def clear; end - - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:23 - def events; end - - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:23 - def events=(_arg0); end - - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:31 - def log(log); end - - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:45 - def to_h; end - - private - - # Without a level of its own, follow the global default level the way a logger does, - # so that `SemanticLogger.silence` applies. - # - # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:53 - def fallback_level_index; end -end - -# pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:3 -module SemanticLogger::Test::Minitest - # Verify a single log event has all the required attributes. - # - # pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:24 - def assert_semantic_logger_event(event, level: T.unsafe(nil), name: T.unsafe(nil), message: T.unsafe(nil), message_includes: T.unsafe(nil), payload: T.unsafe(nil), payload_includes: T.unsafe(nil), exception: T.unsafe(nil), exception_includes: T.unsafe(nil), backtrace: T.unsafe(nil), thread_name: T.unsafe(nil), tags: T.unsafe(nil), named_tags: T.unsafe(nil), context: T.unsafe(nil), level_index: T.unsafe(nil), duration: T.unsafe(nil), time: T.unsafe(nil), metric: T.unsafe(nil), metric_amount: T.unsafe(nil), dimensions: T.unsafe(nil)); end - - # Returns [Array] the log events from Semantic Logger - # captured whilst executing the supplied block. - # - # Notes: - # - All log messages are returned regardless of the global default log level. - # - # pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:9 - def semantic_logger_events(deprecated_klass = T.unsafe(nil), klass: T.unsafe(nil), silence: T.unsafe(nil), &block); end - - private - - # pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:76 - def assert_semantic_logger_entry(event, name, expected, actual = T.unsafe(nil)); end -end - -# Internal-use only utility functions for Semantic Logger. -# Not intended for public use. -# -# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:7 -module SemanticLogger::Utils - class << self - # Borrow from Rails, when not running Rails - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:62 - def camelize(term); end - - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:8 - def constantize_symbol(symbol, namespace = T.unsafe(nil)); end - - # Returns a copy of the supplied value with every String converted to valid UTF-8. - # - # Recurses through Hash and Array structures, cleansing both keys and values. - # Strings that are already valid UTF-8 are returned unchanged (the common case), - # so the fast path allocates nothing. Any other value (Symbol, Numeric, Time, nil, - # ...) is returned as-is. - # - # Used by .to_json on the rare failing path, and directly by formatters that - # serialize per value or emit to a non-JSON sink (where a single `.to_json` - # rescue boundary cannot catch an intermediate failure). - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:350 - def encode_utf8(value); end - - # Returns the string converted to valid UTF-8, dropping any invalid bytes. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:371 - def encode_utf8_string(string); end - - # Extract the backtrace stripping off the leading semantic logger entries. - # Leaves all other system and gem path entries in place. - # Returns a new Array, leaving the supplied stack unchanged since it can belong to the caller. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:85 - def extract_backtrace(stack = T.unsafe(nil)); end - - # Whether this path should be excluded from any cleansed backtrace - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:94 - def extract_path?(path); end - - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:89 - def extract_paths; end - - # Returns the value when JSON writes it as it is, otherwise a .json_safe copy, for a writer - # that serializes the value itself, such as GELF. The check costs one #to_json; only the - # rare value that needs repairing is copied. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:159 - def json_ready(value); end - - # Returns a copy of the supplied value that JSON can represent: - # * Every String is converted to valid UTF-8, as by .encode_utf8. - # * Infinity and NaN floats become the Strings "Infinity", "-Infinity", and "NaN". - # * A Struct, Data, or OpenStruct instance becomes a Hash of its members (from #to_h), - # and a Set an Array, as ActiveSupport's #as_json does, so that its members follow - # these same rules. - # * A Hash key that is itself a structure becomes the JSON of its copy, since JSON writes a - # key with #to_s, which for a structure is its #inspect. - # * Any other object whose JSON raises because of invalid UTF-8, such as an exception - # message or a Pathname built from an uploaded file name, becomes its #to_s converted to - # valid UTF-8. - # * A Hash, Array, Set, Struct, or Data nested deeper than MAX_JSON_SAFE_DEPTH is replaced - # with a placeholder String naming its class, such as "#". - # So is one that holds itself, at the point where it would repeat. - # Any other value is returned as-is. - # - # The recursion never goes deeper than MAX_JSON_SAFE_DEPTH, and the placeholder does - # not look inside the structure it replaces. Rendering it instead (for example with - # #inspect) would recurse without limit through an arbitrarily deep structure, - # raising SystemStackError (or crashing Ruby) on the appender's thread, and would - # expose the instance variables of any object inside it. Ending a self-referencing - # structure where it repeats, rather than at that depth, keeps one that holds itself - # more than once from being copied an exponential number of times. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:277 - def json_safe(value, depth = T.unsafe(nil), ancestors = T.unsafe(nil)); end - - # Returns the visibility for an instance method - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:71 - def method_visibility(mod, method_name); end - - # Returns [true|false] whether the value holds a Hash, Array, Struct, or Data nested deeper - # than MAX_JSON_SAFE_DEPTH, which .json_safe would replace with a placeholder. Never recurses - # deeper than that itself, and follows the same rules as .json_safe. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:207 - def nested_too_deeply?(value, depth = T.unsafe(nil)); end - - # Returns [URI] the parsed url, supplied as the named option. - # - # Raises URI::InvalidURIError for an invalid url, including nil, as .without_url_in_errors does. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:32 - def parse_url(url, option: T.unsafe(nil), hint: T.unsafe(nil)); end - - # Returns [String] the scheme, host, and any non-default port of the url, which is safe to log. - # - # Everything else is left out, since log services carry credentials in each part of a url: the - # user and password, the query string (for example a Datadog api key), and the path (for example - # the token at the end of a Sumo Logic HTTP source url). An invalid url is not shown at all. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:53 - def redacted_url(url); end - - # Returns [String] value#inspect, or what the block renders the value as (for example with - # Amazing Print), without overflowing the stack for a value nested too deeply. - # - # #inspect has no depth limit: a Hash a few hundred levels deep overflows the stack of a - # thread. Rescuing the SystemStackError is not enough, since on macOS a second such overflow - # on the same thread crashes Ruby instead. A value that holds a structure nested deeper than - # MAX_JSON_SAFE_DEPTH is therefore rendered from a .json_safe copy, as the JSON formatters - # write it, cut off at that depth with their placeholder. Only that case pays for the copy. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:199 - def safe_inspect(value); end - - # Try to strip everything off of the supplied backtrace, until the first application stack entry is at the top. - # For example all leading gem paths and built-in ruby code paths are removed from the top. - # Once the first application entry is found, the remaining stack is returned. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:101 - def strip_backtrace(stack = T.unsafe(nil)); end - - # Whether this path should be excluded from any cleansed backtrace - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:120 - def strip_path?(path); end - - # Paths to exclude in the stripped backtrace - # Includes Gems and built-in Ruby code paths - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:110 - def strip_paths; end - - # Returns [true|false] whether .json_safe writes the value as a JSON object or array: a Hash, - # Array, Set, Struct, Data, or OpenStruct. Every one of them would otherwise be written by its - # #to_s, which is its #inspect. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:237 - def structure?(value); end - - # Serializes the value to JSON, repairing the data only when necessary. - # - # Data that JSON cannot represent appears in well under 1% of log events, so it - # is wasteful to walk and reallocate the entire structure (see .json_safe) on - # every call. Instead this attempts `.to_json` directly and only falls back to a - # repaired copy when serialization fails because of the data: - # * Invalid UTF-8. Depending on the json gem version this raises - # Encoding::UndefinedConversionError (an EncodingError) or JSON::GeneratorError. - # * Infinity and NaN, which raise JSON::GeneratorError. - # * Structures nested deeper than the json gem allows, which raise - # JSON::NestingError (a JSON::ParserError, not a GeneratorError). - # * A Struct, Data, Set, or OpenStruct instance. The json gem writes one as the String - # returned by its #to_s, which for each is #inspect: every member is written with - # #inspect, exposing the instance variables of any object it holds, and without a - # depth limit, so a deep enough structure raises SystemStackError. The output is - # checked for that rendering (a JSON String starting with "#<", or "Set[" for a Set on - # Ruby 4.0), and SystemStackError is rescued, so .json_safe can write the members as a JSON object - # or array instead. The json gem offers no hook for these short of strict mode, - # which also rejects common values such as Time, and finding one up front would mean - # walking every payload on the hot path. ActiveSupport already writes them through - # #as_json, and escapes "<", so its output never matches the check. - # - # Log data can come from untrusted input, for example a float parsed from a request - # parameter or a deeply nested request body. Without the repair, such a value would - # make the whole log event impossible to serialize, and so silently dropped. - # - # The retry is attempted only once: if it still fails (for example an object whose - # own #to_json raises), the error propagates unchanged rather than being swallowed. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:152 - def to_json(value); end - - # Returns the result of the block, which uses the url supplied as the named option, for example - # to build a client gem's connection. - # - # Raises any of the errors from the block again, of the same class, without the url in its - # message, or as its cause, since a url can hold a user and password, or a token in its path or - # query string, and URI and client gems put the url in the error for an invalid one. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:42 - def without_url_in_errors(option: T.unsafe(nil), hint: T.unsafe(nil), errors: T.unsafe(nil)); end - - private - - # Returns [String] the value's JSON, or nil when .to_json has to repair the data. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:164 - def clean_json(value); end - - # Returns a copy of the elements of a Hash, Array, Set, Struct, or Data, each made safe - # by .json_safe at the supplied depth. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:321 - def json_safe_members(value, depth, ancestors); end - - # Returns any other object as it is, when JSON can write it, otherwise its #to_s converted - # to valid UTF-8. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:311 - def json_safe_object(value); end - - # Returns a copy of a Hash, Array, Set, Struct, Data, or OpenStruct, or the placeholder for - # one nested too deeply or that holds itself. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:294 - def json_safe_structure(value, depth, ancestors); end - - # Whether the members of a Struct, Data, or OpenStruct are nested too deeply. As in - # .json_safe_members, a #to_h that does not return a Hash is one level deeper. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:226 - def members_nested_too_deeply?(value, depth); end - - # Whether the value is an OpenStruct. The ostruct gem is only loaded by the application, and - # is a bundled gem since Ruby 4.0, so Semantic Logger never requires it. - # - # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:248 - def open_struct?(value); end - end -end - -# Options used when transcoding a string to UTF-8. -# Invalid byte sequences and characters that cannot be represented in UTF-8 are -# dropped rather than substituted, matching the preference in issue #180. -# -# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:368 -SemanticLogger::Utils::ENCODE_UTF8_OPTIONS = T.let(T.unsafe(nil), Hash) - -# How the json gem writes an object through its #to_s: a JSON String starting with "#<", as -# for a Struct, Data, Set, or OpenStruct, whose #to_s is its #inspect. -# -# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:180 -SemanticLogger::Utils::INSPECTED_OBJECT = T.let(T.unsafe(nil), String) - -# How the json gem writes a Set where Set#inspect is "Set[...]" (Ruby 4.0), which holds no -# "#<" unless the Set holds an object. Nil where Set#inspect starts with "#<" too. -# -# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:184 -SemanticLogger::Utils::INSPECTED_SET = T.let(T.unsafe(nil), T.untyped) - -# Nesting depth after which .json_safe replaces a Hash, Array, Struct, or Data with a -# placeholder. Well below the json gem's default max_nesting of 100, leaving room for -# the levels that a formatter wraps the payload in. -# -# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:189 -SemanticLogger::Utils::MAX_JSON_SAFE_DEPTH = T.let(T.unsafe(nil), Integer) - -# pkg:gem/semantic_logger#lib/semantic_logger/version.rb:2 -SemanticLogger::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/semantic_logger@5.3.0.rbi b/sorbet/rbi/gems/semantic_logger@5.3.0.rbi new file mode 100644 index 00000000..8115bfac --- /dev/null +++ b/sorbet/rbi/gems/semantic_logger@5.3.0.rbi @@ -0,0 +1,11424 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `semantic_logger` gem. +# Please instead update this file by running `bin/tapioca gem semantic_logger`. + + +module Process + extend ::ConnectionPool::ForkTracker + extend ::RedisClient::PIDCache::CoreExt + extend ::SemanticLogger::CoreExt::Process + extend ::ActiveSupport::ForkTracker::CoreExt +end + +# Send log messages to Bugsnag +# +# Example: +# SemanticLogger.add_appender(appender: :bugsnag) +# +# Forward all log messages to CloudWatch Logs. +# +# Example: +# +# SemanticLogger.add_appender( +# appender: :cloudwatch_logs, +# client_kwargs: {region: "eu-west-1"}, +# group: "/my/application", +# create_stream: true +# ) +# Forward all log messages to Elasticsearch. +# +# Example: +# +# SemanticLogger.add_appender( +# appender: :elasticsearch, +# url: 'http://localhost:9200' +# ) +# Forward all log messages to Elasticsearch one at a time via a HTTP post. +# +# Note: +# * Other than in very low volume environments it is recommended to rather use the Elasticsearch appender, +# since it supports bulk logging. This appender cannot be batched: with `batch: true`, add_appender raises +# ArgumentError (see #batch_refusal). +# +# Example: +# SemanticLogger.add_appender( +# appender: :elasticsearch_http, +# url: 'http://localhost:9200' +# ) +# File appender +# +# Writes log messages to a file or open iostream +# +# Forward log entries to a Graylog server. +# +# Example: +# SemanticLogger.add_appender( +# appender: :graylog, +# url: 'udp://localhost:12201' +# ) +# +# Notes: +# * trace is not supported by Graylog, so trace level logging will appear as debug in Graylog. +# +# In the Graylog Web UI search screen, it is recommended to include the following fields: +# `duration`, `level`, `message`, `metric`, `name`, `tags +# Send log messages to honeybadger +# +# Example: +# SemanticLogger.add_appender(appender: :honeybadger) +# +# Send log messages to honeybadger events/insights API +# +# Example: +# SemanticLogger.add_appender(appender: :honeybadger_insights) +# +# Log to any HTTP(S) server that accepts log messages in JSON form +# +# Features: +# * JSON Formatted messages. +# * Uses a persistent http connection, if the server supports it. +# * SSL encryption (https). +# +# Example: +# SemanticLogger.add_appender( +# appender: :http, +# url: 'http://localhost:8088/path' +# ) +# +# Batching: +# By default each log message is posted individually. To post multiple log +# messages in a single request as a JSON array (for example to the Filebeat +# http_endpoint input), enable batching when adding the appender: +# SemanticLogger.add_appender( +# appender: :http, +# url: 'http://localhost:8088/path', +# batch: true +# ) +# +# Responses: +# A response other than 2xx raises ResponseError from #log and #batch. A 4xx other than 408 and +# 429 rejects the request itself, so #message_error? recognizes it, and an asynchronous appender +# discards the entries straight away, counted as failed. A batch rejected for what it holds (400, +# 413, or 422) is first split up and each part sent again, to find the entries at fault; any other +# such 4xx, such as 401 or 404, would reject any part too, so the whole batch is discarded at once +# (see #fails_any_batch?). Any other status is a problem with the destination, so an asynchronous +# appender backs off. After a 408, 429, or 503, which ask to send the request again later, it then +# sends the entries again, up to QueueProcessor::HeldWrite::MAX_RESENDS times, since the server did +# not store them (see #wrote_nothing?). After any other, such as a 500, 502, 504, or a redirect, it +# discards them, counted as failed. An appender that is not asynchronous reports the error. +# Forward all log messages to Apache Kafka. +# +# Example: +# +# SemanticLogger.add_appender( +# appender: :kafka, +# +# # At least one of these nodes must be available: +# seed_brokers: ["kafka1:9092", "kafka2:9092"], +# +# # Set an optional client id in order to identify the client to Kafka: +# client_id: "my-application", +# +# # Leave out metric-only entries, as v6 does by default: +# metrics: false +# ) +# Forward log messages to a Grafana Loki instance using its HTTP push API +# +# Example: +# SemanticLogger.add_appender( +# appender: :loki, +# url: "https://logs-prod-001.grafana.net", +# username: "grafana_username", +# password: "grafana_token_here", +# compress: true, +# formatter: {loki: {structured_metadata: [:pid, :thread]}} +# ) +# +# structured_metadata: needs a Loki that accepts structured metadata (see +# SemanticLogger::Formatters::Loki#initialize). +# Send log messages to NewRelic +# +# The :error and :fatal log entries will show up under +# "Applications" > "Application Name" > "Events" > "Errors" in New Relic. +# +# Example: +# SemanticLogger.add_appender(appender: :new_relic) +# Send log messages to NewRelic +# +# All log entries will appear under +# "Logs" in New Relic +# +# == Caveats +# +# * The NewRelic agent only sends logs to NewRelic when log forwarding is enabled. There is however an open +# issue to get this fixed: https://github.com/newrelic/newrelic-ruby-agent/issues/1614. Please see the guide +# for a workaround. +# +# Example: +# SemanticLogger.add_appender(appender: :new_relic_logs) +# Open Telemetry Appender +# +# Writes log entries to Open Telemetry, as log records through its Logs API. +# +# Forward all log messages to OpenSearch (e.g. AWS OpenSearch). +# +# OpenSearch is a fork of Elasticsearch 7.10. The client API and bulk +# protocol are identical, so this appender reuses the same pipeline as the +# Elasticsearch appender; only the backing client gem differs. Use this +# appender (with the `opensearch-ruby` gem) instead of `:elasticsearch` +# when talking to an OpenSearch server, since modern `elasticsearch` gems +# reject non-Elasticsearch servers via a product check. +# +# Example: +# +# SemanticLogger.add_appender( +# appender: :opensearch, +# url: 'http://localhost:9200' +# ) +# Forward all log messages to RabbitMQ. +# +# Example: +# +# SemanticLogger.add_appender( +# appender: :rabbitmq, +# +# # Name of the queue in RabbitMQ where to publish the logs, through the default exchange. +# queue_name: 'semantic_logger', +# +# # This host will be used for RabbitMQ connection. +# # NOTE this is different than :host option which is used by the logger directly. +# rabbitmq_host: '127.0.0.1', +# +# # RabbitMQ credentials +# username: 'my-username', +# password: 'my-secret-pass', +# +# # All other options accepted by Bunny.new call +# vhost: 'production', +# +# # Leave out metric-only entries, as v6 does by default: +# metrics: false +# ) +# Send log messages to sentry +# +# Example: +# SemanticLogger.add_appender(appender: :sentry) +# +# Send log messages to sentry +# +# Example: +# SemanticLogger.add_appender(appender: :sentry_ruby) +# +# Splunk log appender. +# +# Use the official splunk gem to log messages to Splunk. +# +# Deprecated: will be removed in v6. Use the :splunk_http appender instead. +# The splunk-sdk-ruby gem (last released in 2015) does not verify the server's TLS certificate, +# so its connection, including the login credentials, is open to interception. +# +# Example +# SemanticLogger.add_appender( +# appender: :splunk, +# username: 'username', +# password: 'password', +# host: 'localhost', +# port: 8089, +# scheme: :https, +# index: 'main' +# ) +# Splunk log appender using the Splunk HTTP(S) listener. +# +# Use the newer, faster and more complete JSON over HTTP interface for Splunk. +# +# To configure Splunk to receive log messages via this appender: +# http://dev.splunk.com/view/event-collector/SP-CAAAE7F +# +# Example +# SemanticLogger.add_appender( +# appender: :splunk_http, +# url: 'http://localhost:8080', +# token: '70CA900C-3D7E-42A4-9C79-7975D1C422A8' +# ) +# +# Batching: +# Add it with `batch: true` to send many entries in each request, as event objects stacked one after +# the other, each one what the appender sends for that entry on its own (see #batch). +# +# Responses: +# The HTTP Event Collector answers 400 Bad Request both for the entries a request holds, and for its +# own configuration, such as an index it does not know. Its JSON body says which, with a numeric +# `code` and a `text`. A batch it rejects for its configuration is discarded at once, rather than +# split up to find the entries at fault, since every part would be rejected too (see +# #fails_any_batch?). For a batch it rejects at one of its events, it says which one, having indexed +# those before it (see #rejected_entry). +# Send log messages to local syslog, or remote syslog servers over TCP or UDP. +# +# Example: +# # Log to a local Syslog daemon +# SemanticLogger.add_appender(appender: :syslog) +# +# Example: +# # Log to a remote Syslog server over TCP: +# SemanticLogger.add_appender( +# appender: :syslog, +# url: 'tcp://myloghost:514' +# ) +# +# Example: +# # Log to a remote Syslog server over UDP: +# SemanticLogger.add_appender( +# appender: :syslog, +# url: 'udp://myloghost:514' +# ) +# +# Example: +# # Log to a remote Syslog server using the CEE format over TCP: +# SemanticLogger.add_appender( +# appender: :syslog, +# url: 'tcp://myloghost:514' +# ) +# +# Send log messages to any standard Ruby logging class. +# +# Forwards logging call to loggers such as Logger, log4r, etc. +# Base logger +# +# Abstract base class for loggers +# +# Implements common behavior such as log level, default text formatter etc +# +# Logger class variable mix-in +# +# Lazy initialize a logger class variable with instance accessor +# +# By including this mix-in into any class it will define a class level logger +# and also make it accessible via instance methods +# +# Example: +# require 'semantic_logger' +# SemanticLogger.default_level = :debug +# SemanticLogger.add_appender(io: $stdout, formatter: :color) +# +# class ExternalSupplier +# # Create class and instance logger methods +# include SemanticLogger::Loggable +# +# def call_supplier(amount, name) +# logger.debug "Calculating with amount", { amount: amount, name: name } +# +# # Measure and log on completion how long the call took to the external supplier +# logger.measure_info "Calling external interface" do +# # Code to call the external supplier ... +# end +# end +# end +# Send Metrics to NewRelic +# +# Records the metric of each log entry that has one as a New Relic custom metric, through the +# agent's metric API: with record_metric, in seconds, when the entry has a duration, otherwise with +# increment_metric, by its metric_amount, or 1. A metric's dimensions are left out, since that API +# takes none. +# +# Example: +# SemanticLogger.add_appender(metric: :new_relic) +# Forward application metrics to SignalFx. +# +# Example: +# SemanticLogger.add_appender( +# metric: :signalfx, +# token: 'SIGNALFX_ORG_ACCESS_TOKEN' +# ) +# Abstract Subscriber +# +# Abstract base class for all appenders. +# +# pkg:gem/semantic_logger#lib/semantic_logger/version.rb:1 +module SemanticLogger + class << self + # Return a logger for the supplied class or class_name. + # + # When `SemanticLogger.cache_loggers` is enabled (opt-in, default off) and a + # Class or Module is supplied, the same Logger instance is returned for every + # call with that class. This makes it possible to obtain a logger once and + # later change its level (or filter) and have every holder of that logger see + # the change. + # + # A String is always given its own new Logger instance, even when caching is + # enabled: callers that pass a string typically want an independent logger + # (for example to set a different level per call site). Anonymous classes + # (those with no `name`) are never cached, to avoid pinning short-lived + # dynamically created classes in memory. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:20 + def [](klass); end + + # Add a new logging appender as a new destination for all log messages + # emitted from Semantic Logger + # + # Appenders will be written to in the order that they are added + # + # If a block is supplied then it will be used to customize the format + # of the messages sent to that appender. See "Formatter as a block or Proc" in + # docs/config.md for more information on custom formatters + # + # Give it one destination: file_name:, io:, logger:, appender:, or metric:. Given more than one, it adds + # only the first, in that order, and reports a deprecation warning that names the others, which it + # ignores; v6 raises ArgumentError. A destination given as nil is not one. + # + # Parameters + # file_name: [String] + # File name to write log messages to. + # + # Or, + # io: [IO] + # An IO Stream to log to. + # For example $stdout, $stderr, etc. + # + # Or, + # appender: [Symbol|SemanticLogger::Subscriber] + # A symbol identifying the appender to create. + # For example: + # :bugsnag, :elasticsearch, :graylog, :http, :mongodb, :new_relic, :splunk_http, :syslog + # Or, + # An instance of an appender derived from SemanticLogger::Subscriber + # For example: + # SemanticLogger::Appender::Http.new(url: 'http://localhost:8088/path') + # It is added as it is: set its options, such as level: and formatter:, and its formatter block, + # on the instance itself. Only async:, batch:, and the other options of the async proxy apply to it. + # + # Or, + # logger: [Logger|Log4r] + # An instance of a Logger or a Log4r logger. + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: the appender's own. For most that is none (:trace), so it writes every entry that a + # logger emits; each logger filters by its own level. Those that send errors to a service, such + # as :bugsnag and :sentry_ruby, default to :error, and :honeybadger_insights to :info. + # + # formatter: [Symbol|Object|Proc] + # Any of the following symbol values: :default, :color, :json, :logfmt, etc... + # Or, + # An instance of a class that implements #call + # Or, + # A Proc to be used to format the output from this appender + # Default: :default + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # Examples: + # + # # Send all logging output to Standard Out (Screen) + # SemanticLogger.add_appender(io: $stdout) + # + # # Send all logging output to a file + # SemanticLogger.add_appender(file_name: 'logfile.log') + # + # # Send all logging output to a file and only :info and above to standard output + # SemanticLogger.add_appender(file_name: 'logfile.log') + # SemanticLogger.add_appender(io: $stdout, level: :info) + # + # Log to log4r, Logger, etc.: + # + # # Send Semantic logging output to an existing logger + # require 'logger' + # require 'semantic_logger' + # + # # Built-in Ruby logger + # log = Logger.new($stdout) + # log.level = Logger::DEBUG + # + # SemanticLogger.default_level = :debug + # SemanticLogger.add_appender(logger: log) + # + # logger = SemanticLogger['Example'] + # logger.info "Hello World" + # logger.debug("Login time", user: 'Joe', duration: 100, ip_address: '127.0.0.1') + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:353 + def add_appender(**args, &); end + + # Add signal handlers for Semantic Logger + # + # Two signal handlers will be registered by default: + # + # 1. Changing the log_level: + # + # The log level can be changed without restarting the process by sending the + # log_level_signal, which by default is 'USR2' + # + # When the log_level_signal is raised on this process, the global default log level + # rotates through the following log levels in the following order, starting + # from the current global default level: + # :fatal, :error, :warn, :info, :debug, :trace + # + # If the current level is :trace it wraps around back to :fatal + # + # 2. Logging a Ruby thread dump + # + # When the signal is raised on this process, Semantic Logger will write the list + # of threads to the log file, along with their back-traces when available + # + # For JRuby users this thread dump differs form the standard QUIT triggered + # Java thread dump which includes system threads and Java stack traces. + # + # It is recommended to name any threads you create in the application, by + # calling the following from within the thread itself: + # Thread.current.name = 'My Worker' + # + # Also adds JRuby Garbage collection logging so that any garbage collections + # that exceed the time threshold will be logged. Default: 100 ms + # Currently only supported when running JRuby + # + # Note: + # To only register one of the signal handlers, set the other to nil + # Set gc_log_microseconds to nil to not enable JRuby Garbage collections + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:547 + def add_signal_handler(log_level_signal = T.unsafe(nil), thread_dump_signal = T.unsafe(nil), gc_log_microseconds = T.unsafe(nil)); end + + # Returns [SemanticLogger::Subscriber] a copy of the list of active + # appenders for debugging etc. + # Use SemanticLogger.add_appender and SemanticLogger.remove_appender + # to manipulate the active appenders list + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:403 + def appenders; end + + # Returns [String] name of this application for logging purposes + # Note: Not all appenders use `application` + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:243 + def application; end + + # Override the default application + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:248 + def application=(application); end + + # Returns the application's backtrace cleaner, or nil when there is none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:166 + def backtrace_cleaner; end + + # Sets the application's backtrace cleaner, which leaves out or shortens the lines of the + # backtraces that the text and JSON formatters log, such as `Rails.backtrace_cleaner`. + # + # Parameters + # cleaner: [Object|nil] + # An object that responds to `#clean`, as ActiveSupport::BacktraceCleaner does, or to `#call`, + # such as a Proc. It is given each exception's backtrace as an Array of Strings, and returns + # the lines to log. When it leaves out every line, or raises, the full backtrace is logged, + # and an error it raises is reported to the internal logger. + # It is called on the appender threads, so it must be thread safe. + # nil: Do not clean backtraces. + # Default: nil + # + # The `:default`, `:color`, `:pattern`, `:syslog`, `:json`, and `:fluentd` formatters use it + # unless given `backtrace_cleaner: false`. Other formatters only use it when given + # `backtrace_cleaner: true`. Appenders that send the exception itself, such as error services, + # are not affected. + # + # Example: + # SemanticLogger.backtrace_cleaner = Rails.backtrace_cleaner + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:158 + def backtrace_cleaner=(cleaner); end + + # Returns the current backtrace level + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:74 + def backtrace_level; end + + # Sets the level at which backtraces should be captured + # for every log message. + # + # By enabling backtrace capture the filename and line number of where + # message was logged can be written to the log file. Additionally, the backtrace + # can be forwarded to error management services such as Bugsnag. + # + # Warning: + # Capturing backtraces is very expensive and should not be done all + # the time. It is recommended to run it at :error level in production. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:67 + def backtrace_level=(level); end + + # Returns the current backtrace level index + # For internal use only + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:78 + def backtrace_level_index; end + + # Whether `SemanticLogger[Class]` returns a shared, cached Logger instance per + # class. Disabled by default. Strings are never cached (see #[]). + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:28 + def cache_loggers=(cache_loggers); end + + # Returns whether logger caching is enabled. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:34 + def cache_loggers?; end + + # Returns the level at and above which each log entry records where it was logged, or nil when + # it is not recorded. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:105 + def call_site_level; end + + # Sets the level at and above which each log entry records where it was logged: the file, line, + # and method of the code that made the log call (see Log#call_site). The JSON and text formatters + # then write the method next to the file name and line number. + # + # Unlike backtrace_level, it reads only the frames of the stack up to the code that made the log + # call, which costs about 1.5 µs per entry however deep the stack is, instead of building + # the whole backtrace. + # + # Parameters + # level: [Symbol|nil] + # :trace, :debug, :info, :warn, :error, or :fatal. + # nil: Do not record where entries were logged. + # Default: nil + # + # Example: + # SemanticLogger.call_site_level = :info + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:96 + def call_site_level=(level); end + + # Returns the call site level index + # For internal use only + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:109 + def call_site_level_index; end + + # Returns [Array] the paths, or parts of paths, whose frames are skipped when recording + # where an entry was logged. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:136 + def call_site_skip_paths; end + + # Sets the paths, or parts of paths, of code that logs on behalf of its caller, such as an + # application's own logging helper. A frame in a file whose path includes one of them is skipped + # when recording where an entry was logged, so that the entry shows the code that called the + # helper. Semantic Logger's own frames are always skipped. + # + # Parameters + # paths: [Array|nil] + # Each matches any file whose path includes it, such as "app/lib/audit_log.rb", or + # "/my_logging_gem/" for every file of a gem. + # nil: Skip only Semantic Logger's own frames. + # Default: [] + # + # Example: + # SemanticLogger.call_site_skip_paths = ["app/lib/audit_log.rb"] + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:125 + def call_site_skip_paths=(paths); end + + # Clear out all previously registered appenders + # + # Like .close, returns false at once, without closing them, on the thread of an appender added with + # async: true or in batches. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:395 + def clear_appenders!; end + + # Discard all cached loggers so that subsequent `SemanticLogger[Class]` calls + # build fresh instances. Primarily useful in tests, or after redefining a + # class that was previously cached. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:41 + def clear_logger_cache; end + + # Close all appenders and flush any outstanding messages. + # + # Like .flush, returns false at once, without closing them, on the thread of an appender added with + # async: true or in batches. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:431 + def close; end + + # Returns [SemanticLogger::Context] a frozen snapshot of the logging context of the current fiber: + # its tags, named tags, and silence level (see .silence). + # + # The context belongs to the current fiber, so a thread or fiber started inside a `tagged` block + # does not have its tags. Hand the context over with .with_context: + # + # context = SemanticLogger.context + # Thread.new do + # SemanticLogger.with_context(context) do + # logger.info("Logged with the same tags") + # end + # end + # + # The context does not include the levels set by a logger's #with_level, which, like Ruby's + # Logger#with_level, apply only to the fiber that set them. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:659 + def context; end + + # Returns the global default log level + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:53 + def default_level; end + + # Sets the global default log level + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:46 + def default_level=(level); end + + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:800 + def default_level_index; end + + # Returns [String] name of this environment for logging purposes + # Note: Not all appenders use `environment` + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:254 + def environment; end + + # Override the default environment + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:259 + def environment=(environment); end + + # If the tag being supplied is definitely a string then this fast + # tag api can be used for short lived tags + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:582 + def fast_tag(tag, &); end + + # Flush all queued log entries disk, database, etc. + # All queued log messages are written and then each appender is flushed in turn. + # + # Once a write fails because of the destination of an appender added with async: true or in + # batches, the rest of the messages queued for that appender ahead of the flush are discarded and + # counted as failed, rather than each one tried in turn during an outage. + # + # On Ruby 4.0 and later, in the main Ractor, the entries already sent from other Ractors are + # written first. In another Ractor, it waits until the main Ractor has written that Ractor's + # entries and flushed the appenders. + # + # Returns false at once, without flushing, on the thread of an appender added with async: true or + # in batches, such as by that appender as it writes, since the processor's thread waits for that + # thread to flush the appender. The first such call is reported to the internal logger. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:421 + def flush; end + + # Returns [String] name of this host for logging purposes + # Note: Not all appenders use `host` + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:228 + def host; end + + # Override the default host name, which is this machine's host name. Set it to nil to go back to + # the default. + # + # The host, application, and environment are stored as frozen copies, so that code in any Ractor + # can read them. The value supplied is left as it is. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:237 + def host=(host); end + + # Returns the check_interval which is the number of messages between checks + # to determine if the appender thread is falling behind. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:772 + def lag_check_interval; end + + # Set the check_interval which is the number of messages between checks + # to determine if the appender thread is falling behind. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:778 + def lag_check_interval=(lag_check_interval); end + + # Returns the amount of time in seconds + # to determine if the appender thread is falling behind. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:784 + def lag_threshold_s; end + + # :nodoc + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:673 + def named_tagged(hash, &); end + + # Returns [Hash] a copy of the named tags currently active for this fiber. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:681 + def named_tags; end + + # Drop log messages instead of blocking the calling thread when the main + # pipeline queue is full. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:796 + def non_blocking=(non_blocking); end + + # Returns [true|false] whether log messages are dropped instead of blocking + # when the main pipeline queue is full. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:790 + def non_blocking?; end + + # Supply a callback to be called whenever a log entry is created. + # Useful for capturing appender specific context information. Keep an object that is for an + # appender of your own with `log.capture`, and data to be logged with `log.set_context`. + # + # Parameters + # object: [Object | Proc] + # [Proc] the block to call. + # [Object] any object on which to call #call. + # + # Example: + # SemanticLogger.on_log do |log| + # log.capture(:honeybadger, Honeybadger.get_context) + # end + # + # Example: + # module CaptureContext + # def call(log) + # log.capture(:honeybadger, Honeybadger.get_context) + # end + # end + # SemanticLogger.on_log(CaptureContext) + # + # Note: + # * This callback is called within the thread of the application making the logging call. + # * If these callbacks are slow they will slow down the application. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:508 + def on_log(object = T.unsafe(nil), &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:690 + def pop_named_tags(quantity = T.unsafe(nil)); end + + # Remove specified number of tags from the current tag list + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:640 + def pop_tags(quantity = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:685 + def push_named_tags(hash); end + + # Add tags to the current scope + # + # Note: + # - This method does not flatten the array or remove any empty elements, or duplicates + # since the performance penalty is excessive. + # - To get the flattening behavior use the slower api: + # `logger.push_tags` + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:634 + def push_tags(*tags); end + + # Returns [Integer] the number of log entries waiting to be written to the appenders. + # + # When this number grows it is because the logging appender thread is not + # able to write to the appenders fast enough. Either reduce the amount of + # logging, increase the log level, reduce the number of appenders, or + # look into speeding up the appenders themselves + # + # With sync!, entries are written on the calling thread, so only those logged in a signal trap + # wait, until another thread writes them (see SyncProcessor#queue_size). + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:744 + def queue_size; end + + # Internal: Returns [SemanticLogger::Redactor] the redactor for the sensitive keys, which each + # entry is asked to redact itself with before it is written (see Appenders#log), or nil when + # there are no sensitive keys. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:222 + def redactor; end + + # Remove an existing appender + # Currently only supports appender instances + # + # Before closing an appender that it removed, waits until the processor has written the log + # messages already queued to the other appenders, and flushed them, as .flush does, so that none is + # still being written to it when it is closed, such as a request on its connection that the + # processor's thread is sending. On the processor's own thread, such as by an appender while it + # writes, it closes it at once, since nothing else writes to it then. In a forked child, the + # appender is reopened first, when that has not happened yet, so that closing it closes only what + # the child built (see Processor#remove). + # + # On the thread of an appender added with async: true or in batches, such as by that appender as it + # writes, removing itself or another appender, it cannot wait for the processor's thread, which may + # be waiting for it. The processor's thread, once it has written the log messages queued ahead, + # closes the appender, between writes, then removes it, without this call waiting for it. Until + # then, .appenders still lists it. An appender that removes itself is closed once its current write + # has returned. + # + # Returns the result of closing the appender, or true on the thread of an appender added with + # async: true or in batches, before the appender is closed. With sync!, in a signal trap, returns + # nil when it is not closed within SyncProcessor::TRAP_WAIT_SECONDS, such as when the trap + # interrupted a log call, which must return first: it is then removed and closed just after (see + # SyncProcessor#remove). + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:385 + def remove_appender(appender); end + + # Re-open any open file handles etc. to resources. + # + # Called automatically in the child process after a fork (see reopen_on_fork?), + # and may also be called manually. + # + # To avoid reopening twice after a single fork (for example when the automatic + # fork hook and a framework's `after_fork` callback both fire), reopen is a no-op + # if it has already run in the current process. Pass `force: true` to override + # this guard and reopen unconditionally, for example when re-opening file handles + # in the same process after an external log rotation. + # + # Each appender is reopened by the thread that writes its entries, before it writes the next one, + # so that it is never reopened while it is writing, and so this returns before the appenders have + # reopened: a flush after it returns once they have. One added with async: true or in batches has + # a thread of its own; a batching one reopens at its next batch, or flush. That also lets this be + # called from a signal trap. With sync!, the appenders without a thread of their own are reopened + # on the calling thread instead, or, in a signal trap, on a thread that the trap starts and waits + # for, at most SyncProcessor::TRAP_WAIT_SECONDS (see SyncProcessor#flush). + # + # Note: + # Not all appender's implement reopen. + # Check the code for each appender you are using before relying on this behavior. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:457 + def reopen(force: T.unsafe(nil)); end + + # Enable or disable automatic reopening of appenders after a fork. + # + # # Opt out of the automatic behavior and manage reopen manually: + # SemanticLogger.reopen_on_fork = false + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:479 + def reopen_on_fork=(reopen_on_fork); end + + # Whether appenders are automatically reopened in the child process after a fork. + # + # Enabled by default. A `Process._fork` hook (Ruby 3.1+) calls SemanticLogger.reopen + # in the child after `fork`, `Process.fork`, `Process.daemon`, and `IO.popen("-")`, + # so framework specific `after_fork` hooks (Puma, Unicorn, Resque, Spring, etc.) + # are no longer required. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:471 + def reopen_on_fork?; end + + # Returns the sensitive keys, as supplied to .sensitive_keys=, or nil when there are none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:215 + def sensitive_keys; end + + # Sets the keys whose values are replaced with "[FILTERED]" in every log entry, such as + # passwords and access tokens, before any appender writes it. + # + # Parameters + # keys: [Array|Regexp|Object|nil] + # Array: Symbols and Strings, each matching any key whose name contains it, ignoring case, + # as in Rails' `config.filter_parameters`, and Regexps. + # Regexp: Matches the names of the sensitive keys. + # An object that responds to `#filter_param`, such as ActiveSupport::ParameterFilter, which + # is asked about each key name: `filter_param(name, nil)` returns nil when the key is not + # sensitive, and otherwise the value that replaces the key's value. + # An object that responds to `#call`, such as a Proc, given each key name, which returns + # whether the key is sensitive. + # nil: Do not redact. + # Default: nil + # + # The keys of the payload, named tags, context, and metric dimensions of each entry are matched, + # at any depth, both as written and in snake_case, so that "X-Api-Key" and "apiKey" are also + # matched as "x_api_key" and "api_key". The message, tags, and exception are not changed. + # + # Each entry is redacted once, on the thread that writes it to the appenders, before any of them + # writes it, so the keys must be thread safe. `on_log` subscribers and logger filters run before, + # on the thread that logs the entry, and receive it as it was logged. The application's own + # Hashes are never changed: the entry gets a copy. + # + # The keys are read when they are assigned, so changing an Array of them afterwards has no effect: + # assign them again instead. + # + # When an entry cannot be redacted, for example because the keys raise an error, the field is + # replaced with `{redaction_failed: "ErrorClass"}`, and the error is reported to the internal + # logger. + # + # Example: + # SemanticLogger.sensitive_keys = [:password, :secret, :token, :authorization] + # + # Example, with the parameters that Rails filters, except its Proc filters, which change a value + # rather than name a key (rails_semantic_logger does this once the application has initialized): + # filters = Rails.application.config.filter_parameters.reject { |filter| filter.respond_to?(:call) } + # SemanticLogger.sensitive_keys = ActiveSupport::ParameterFilter.new(filters) + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:209 + def sensitive_keys=(keys); end + + # Silence noisy log levels by changing the default_level within the block + # + # This setting only applies to the current fiber: every thread, and every fiber of a fiber + # scheduler such as Async, has its own. + # + # Threads and fibers started within the block are not affected by this setting + # + # #silence can be used to both raise and lower the log level within + # the supplied block. + # + # Example: + # + # # Perform trace level logging within the block when the default is higher + # SemanticLogger.default_level = :info + # + # logger.debug 'this will _not_ be logged' + # + # SemanticLogger.silence(:trace) do + # logger.debug "this will be logged" + # end + # + # Parameters + # new_level + # The new log level to apply within the block + # Default: :error + # + # Example: + # # Silence all logging for this thread below :error level + # SemanticLogger.silence do + # logger.info "this will _not_ be logged" + # logger.warn "this neither" + # logger.error "but errors will be logged" + # end + # + # Note: + # #silence does not affect any loggers which have had their log level set + # explicitly. I.e. That do not rely on the global default level + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:731 + def silence(new_level = T.unsafe(nil), &); end + + # Returns [Hash] operational statistics for the logging pipeline. + # + # Useful for exporting Semantic Logger's own health to a monitoring system such as + # Prometheus, statsd, etc. The returned Hash contains: + # + # queue_size: [Integer] Number of log messages waiting on the main pipeline queue. + # capped: [Boolean] Whether the main queue has a maximum size. + # max_queue_size: [Integer] Maximum queue size, or nil when uncapped. + # thread_active: [Boolean] Whether the main pipeline thread is running. + # processed: [Integer] Cumulative number of log messages processed since startup. + # dropped: [Integer] Cumulative number of log messages dropped at the main queue. + # appenders: [Array] Per-appender statistics. Appenders that run their own + # async thread report their queue_size and + # processed/dropped/failed counts; appenders that log + # inline report `async: false`. + # + # All counters are cumulative since process startup. They are thread-safe to read and + # are maintained without adding any locking to the logging hot path. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:766 + def stats; end + + # Run Semantic Logger in Synchronous mode. + # + # I.e. Instead of logging messages in a separate thread for better performance, + # log them using the current thread. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:808 + def sync!; end + + # Running in synchronous mode? + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:813 + def sync?; end + + # Add the tags or named tags to the list of tags to log for this fiber whilst the supplied block is active. + # + # Returns result of block. + # + # Tagged example: + # SemanticLogger.tagged(12345, 'jack') do + # logger.debug('Hello World') + # end + # + # Named Tags (Hash) example: + # SemanticLogger.tagged(tracking_number: 12345) do + # logger.debug('Hello World') + # end + # + # Notes: + # - Tags should be a list without any empty values, or contain any array. + # - `logger.tagged` is a slower api that will flatten the example below: + # `logger.tagged([['first', nil], nil, ['more'], 'other'])` + # to the equivalent of: + # `logger.tagged('first', 'more', 'other')` + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:608 + def tagged(*tags, &); end + + # Returns a copy of the [Array] of [String] tags currently active for this fiber. + # Returns an empty Array if no tags are set. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:623 + def tags; end + + # Runs the block with the supplied context, from .context, as the logging context of the current + # fiber. Within the block the fiber has exactly the tags, named tags, and silence level of that + # context, in place of its own, which are restored when the block exits. + # + # Returns the result of the block. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:668 + def with_context(context, &); end + + private + + # Returns the cached Logger for the Class or Module. + # + # A Ractor other than the main one cannot use the main Ractor's cache, or its loggers, so it has a + # cache of its own (experimental, Ruby 4.0 and later). + # + # In a signal trap, a new thread adds the Logger to the cache before the trap returns (see + # TrapSafe.compute_if_absent), unless the trap interrupted a thread that was adding to the cache. + # It is added just after the trap then, which leaves a window: until it is, a call on another thread + # can cache a second Logger for the class, so that the class's `logger`, if the trap asked for it, + # differs from SemanticLogger[klass]; and a .clear_logger_cache in that window is undone. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:848 + def cached_logger(klass); end + + # Lazily initialized thread-safe cache of one Logger per Class/Module. + # + # pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:833 + def logger_cache; end + end +end + +# Formatting & colors used by optional color formatter +# +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:3 +module SemanticLogger::AnsiColors; end + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:6 +SemanticLogger::AnsiColors::BLACK = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:10 +SemanticLogger::AnsiColors::BLUE = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:5 +SemanticLogger::AnsiColors::BOLD = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:4 +SemanticLogger::AnsiColors::CLEAR = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:12 +SemanticLogger::AnsiColors::CYAN = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:8 +SemanticLogger::AnsiColors::GREEN = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:11 +SemanticLogger::AnsiColors::MAGENTA = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:7 +SemanticLogger::AnsiColors::RED = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:13 +SemanticLogger::AnsiColors::WHITE = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/ansi_colors.rb:9 +SemanticLogger::AnsiColors::YELLOW = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:2 +module SemanticLogger::Appender + class << self + # Returns [SemanticLogger::Subscriber] appender for the supplied options + # + # Raises ArgumentError when the appender is to be batched, with `batch: true` or by default, see + # Subscriber#batch_by_default?, and it says why it cannot be, see Subscriber#batch_refusal. When it fails + # after .build, it first closes the appender that .build says it created, see .close_created. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:40 + def factory(async: T.unsafe(nil), batch: T.unsafe(nil), max_queue_size: T.unsafe(nil), lag_check_interval: T.unsafe(nil), lag_threshold_s: T.unsafe(nil), batch_size: T.unsafe(nil), batch_seconds: T.unsafe(nil), non_blocking: T.unsafe(nil), dropped_message_report_seconds: T.unsafe(nil), async_max_retries: T.unsafe(nil), **args, &); end + + # Returns [SemanticLogger::Base] the supplied logger, ready to be an internal logger: the one that + # Semantic Logger reports its own problems to (see Processor.logger=). + # + # An internal logger is named after whatever reports to it, logs at :trace, and takes an + # exception after the message, as every Semantic Logger appender does. So an appender, such as the + # default IO appender, or any other logger that logs at :trace, is returned as it is. Any other + # logger, such as a Ruby or Rails Logger, does none of that, so it is wrapped in a Wrapper + # appender, which writes each report to it as text, with the exception. Its own level then decides + # which reports it writes, apart from the :trace reports, which are below its lowest level, :debug, + # so are left out. + # + # Returns nil for nil or false, which restores the default internal logger. + # + # Raises ArgumentError for a SemanticLogger::Logger: it logs back into the processor, so the + # report of an appender that fails would go to that appender, fail again, and be reported again. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:159 + def internal_logger(logger); end + + private + + # Returns [Subscriber, true | false] the appender for the supplied options, and whether .build created both it + # and its destination, so that nothing else holds them, and .factory closes it when it fails afterwards (see + # .close_created): true for the appender for `file_name:`, or one named by a Symbol as `appender:` or `metric:`. + # False for a Subscriber instance that the caller supplied as `appender:` or `metric:`, and for the appender that + # writes to the caller's own `io:` or `logger:`: closing the one for `logger:` closes that logger, and the stream + # it writes to, such as $stdout. + # + # It adds one destination, the first of file_name:, io:, logger:, appender:, and metric: that is given, in that + # order, and ignores any other, see .report_ignored_destinations. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:105 + def build(io: T.unsafe(nil), file_name: T.unsafe(nil), appender: T.unsafe(nil), metric: T.unsafe(nil), logger: T.unsafe(nil), **args, &); end + + # Closes the appender that .build created, since .factory failed after creating it, such as when the appender + # cannot be batched, and nothing else holds it, yet it may have opened its destination, such as a connection. + # An error from closing it is ignored, so that .factory raises the one that it failed with. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:89 + def close_created(appender); end + + # Reports a deprecation warning when .build is given more than one of the destinations, in the order in which it + # takes the first one, naming the one that it uses and the others, which it ignores, since v6 raises ArgumentError + # for them. A destination given as nil, or false, is not one, as .build has always taken it, so that a caller can + # pass on settings of which only one is set, such as `file_name: options[:file_name], io: options[:io]`, and v6 + # must not raise for it either. Remove in v6, raising ArgumentError in its place. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:200 + def report_ignored_destinations(**destinations); end + + # Returns [Subscriber] the appender or metric subscriber supplied as an instance, with the `option` that named it, + # `:appender` or `:metric`, as it is, since it was created with its own options. The options and block that .build + # would hand to an appender that it creates are not used, so reports a deprecation warning that names each one, + # since v6 raises ArgumentError for them. An option whose value is nil, the default of a Subscriber, sets nothing, + # so it is not reported, and v6 must not raise for it either, so that a caller can pass on its optional settings. + # Since an option of .factory that is misspelled arrives here too, the warning names the options that do apply to + # an instance. Remove in v6, raising ArgumentError in its place. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:180 + def subscriber_instance(option, subscriber, **args); end + + # Returns [String] the words as a list in a sentence, such as "a", "a and b", or "a, b, and c". + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender.rb:212 + def word_list(words); end + end +end + +# Proxy that allows any appender to run asynchronously in a separate thread. +# +# The worker thread and the in-memory queue are owned by an internal +# SemanticLogger::QueueProcessor. This proxy forwards log/flush/close/reopen on to the +# processor, and forwards the remaining appender methods (name, level, ...) directly to +# the wrapped appender so they keep executing on the caller's thread. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:11 +class SemanticLogger::Appender::Async + extend ::Forwardable + + # Appender proxy to allow an existing appender to run asynchronously in a separate thread. + # + # Parameters: + # appender: [SemanticLogger::Subscriber] + # The appender to log to in a separate thread. + # + # max_queue_size: [Integer] + # The maximum number of log messages to hold on the queue before blocking attempts to add to the queue. + # -1: The queue size is uncapped and will never block no matter how long the queue is. + # Default: 10,000 + # + # lag_threshold_s [Float] + # Log a warning when a log message has been on the queue for longer than this period in seconds. + # Default: 30 + # + # lag_check_interval: [Integer] + # Number of messages to process before checking for slow logging. + # Default: 1,000 + # Note: Not applicable when batch: true. + # + # batch: [true|false] + # Process log messages in batches via the appender's #batch method, instead of one at a time. + # The appender must implement #batch. + # Default: false + # + # batch_size: [Integer] + # Maximum number of messages to batch up before sending. + # Default: 300 + # Note: Only applicable when batch: true. + # + # batch_seconds: [Integer] + # Maximum number of seconds between sending batches. + # Default: 5 + # Note: Only applicable when batch: true. + # + # non_blocking: [true|false] + # Whether to drop log messages instead of blocking the calling thread when the queue is full. + # When true and the queue is capped, attempts to add to a full queue return immediately and + # the message is dropped. The number of dropped messages is logged to the internal logger + # periodically (see dropped_message_report_seconds). Only applies to a capped queue. + # Default: false + # + # dropped_message_report_seconds: [Integer] + # Log the count of messages dropped because the queue was full, with non_blocking or once + # the worker thread has stopped (see async_max_retries), to the internal logger at most + # once every this number of seconds. Also limits how often messages discarded because + # they could not be written are reported, after the first. + # Default: 30 + # + # async_max_retries: [Integer] + # Maximum number of consecutive times to restart the worker thread (with a back-off) + # after it raises an exception while processing messages, before giving up and stopping + # the thread. The counter resets after any message is processed successfully. + # Once stopped, messages are dropped when the queue is full, rather than block. + # -1: Retry indefinitely and never stop the thread (the pre-v5 behaviour). + # Default: 100 + # + # The proxy also answers #wrapped_logger, the logger that the appender writes to, when the + # appender has one, such as one added with `logger:`, so that it is found the same way with or + # without async: true. The proxy of any other appender does not respond to it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:95 + def initialize(appender:, **args); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def active?(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:14 + def appender; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def application(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def batch?(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def capped?(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def close(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def console_output?(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def console_stream(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def dropped_count(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def environment(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def failed_count(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def filter(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def flush(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def formatter(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def formatter=(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def holding_up?(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def host(*args, **, &block); end + + # Returns [String] the class and object address of this proxy, whether it batches, and the + # wrapped appender's own #inspect, which shows only what that appender says is safe, but none of + # the instance variables of this proxy or its queue processor. See Subscriber#inspect. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:104 + def inspect; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def lag_check_interval(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def lag_check_interval=(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def lag_threshold_s(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def lag_threshold_s=(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def level(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def level=(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def log(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def logger(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def logger=(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def max_queue_size(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def name(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def non_blocking=(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def non_blocking?(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def process_exiting=(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def processed_count(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:14 + def processor; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def queue(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def renew_after_fork(*args, **, &block); end + + # Re-open the wrapped appender and the queue processor, after a fork, or within the same + # process, such as after a log rotation (see QueueProcessor#reopen). + # + # The wrapped appender is reopened by the worker thread, before it writes again, so that it + # is never reopened while it is writing, and not in a signal trap, from which this is often + # called. So this returns before it has reopened, and a reopen that fails, such as for a server + # name that no longer resolves, is reported by the worker thread, which carries on. After a + # fork, the child then always has a worker thread, which reopens the appender before it + # writes anything. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:118 + def reopen; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:17 + def should_log?(*args, **, &block); end + + # Returns [Hash] operational statistics for this appender. + # + # name: [String] Name of the wrapped appender. + # async: [true] This appender logs asynchronously via a separate thread. + # thread_active: [Boolean] Whether the worker thread is currently running. + # queue_size: [Integer] Number of log messages currently waiting to be written. + # capped: [Boolean] Whether the queue has a maximum size. + # max_queue_size: [Integer] Maximum queue size, or nil when uncapped. + # processed: [Integer] Cumulative number of log messages written since startup. + # dropped: [Integer] Cumulative number of log messages dropped because the queue + # was full: with non_blocking enabled, or once the worker + # thread has stopped (see async_max_retries). + # failed: [Integer] Cumulative number of log messages discarded because they + # could not be written, whether their content or the + # destination was at fault (see Subscriber#message_error?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:137 + def stats; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def thread(*args, **, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/async.rb:27 + def worker_thread?(*args, **, &block); end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:14 +class SemanticLogger::Appender::Bugsnag < ::SemanticLogger::Subscriber + # Create Bugsnag Error / Exception Appender + # + # Parameters + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: :error + # + # formatter: [Object|Proc] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:32 + def initialize(level: T.unsafe(nil), **args, &block); end + + # Returns [Hash] of parameters to send to Bugsnag. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:43 + def call(log, logger); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:53 + def log(log); end + + private + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:71 + def bugsnag_notify(exception, hash, level); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:83 + def extract_exception(log); end + + # Bugsnag supports: error, warning or info + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/bugsnag.rb:96 + def log_level(level); end +end + +# Abstract base appender for Elasticsearch-compatible search engines. +# +# Implements the shared bulk-indexing pipeline used by both the +# {Elasticsearch} and {OpenSearch} appenders. Subclasses only need to +# supply the backing client class. +# +# This class is internal: applications add an appender via +# `SemanticLogger.add_appender(appender: :elasticsearch, ...)` or +# `appender: :opensearch`, never by referencing this class directly. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:14 +class SemanticLogger::Appender::ElasticsearchBase < ::SemanticLogger::Subscriber + # Create an Elasticsearch-compatible appender over persistent HTTP(S). + # + # Parameters: + # index: [String] + # Prefix of the index to store the logs in. + # The final index appends the date so that indexes are used per day. + # I.e. The final index will look like 'semantic_logger-YYYY.MM.DD' + # Default: 'semantic_logger' + # + # date_pattern: [String] + # The time format used to generate the full index name. Useful + # if you want monthly indexes ('%Y.%m') or weekly ('%Y.%W'). + # Default: '%Y.%m.%d' + # + # data_stream: [true|false] + # Write to the data stream named by `index:`, with `create` actions, + # rather than to a daily index: `date_pattern:` is not used, and the + # default formatter writes the time under `@timestamp`. + # Default: false + # + # type: [String] + # Deprecated and ignored. Document `_type` has been unused since + # Elasticsearch 7 and is ignored by OpenSearch. Passing it logs a + # deprecation warning; it will be removed in v6. + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # formatter: [Object|Proc|Symbol|Hash] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender. It returns the document, as a Hash, or as a + # String of JSON. + # Default: :raw, with an ISO 8601 time under `timestamp`, or `@timestamp` with + # `data_stream: true`. + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # metrics: [true|false] + # Whether to also index metric-only entries: a metric without a message or an exception. + # Default: false + # + # Client Parameters (passed through to the backing client): + # url: [String] + # Fully qualified address to the service. + # Default: 'http://localhost:9200' + # + # hosts: [String|Hash|Array] + # Single host passed as a String or Hash, or multiple hosts + # passed as an Array. A Hash takes the keys `host`, `port`, + # `scheme`, `user`, `password`, and `path`. + # Note: + # :url above is ignored when supplying this option. + # A `host:` passed to the appender itself, outside the Hash, is + # not a server: it is the host name written in each log entry, + # see `host:` above. + # + # resurrect_after [Float] + # After how many seconds a dead connection should be tried again. + # + # reload_connections [true|false|Integer] + # Reload connections after X requests. + # Default: false + # + # randomize_hosts [true|false] + # Shuffle connections on initialization and reload. + # Default: false + # + # sniffer_timeout [Integer] + # Timeout for reloading connections in seconds. + # Default: 1 + # + # retry_on_failure [true|false|Integer] + # Retry X times when request fails before raising and exception. + # Default: false + # + # retry_on_status [Array] + # Retry when specific status codes are returned. + # + # reload_on_failure [true|false] + # Reload connections after failure. + # Default: false + # + # request_timeout [Integer] + # The request timeout to be passed to transport in options. + # + # adapter [Symbol] + # A specific adapter for Faraday (e.g. `:patron`) + # + # transport_options [Hash] + # Options to be passed to the `Faraday::Connection` constructor. + # + # transport_class [Constant] + # A specific transport class to use, will be initialized by + # the client and passed hosts and all arguments. + # + # transport [Object] + # A specific transport instance. + # + # serializer_class [Constant] + # A specific serializer class to use, will be initialized by + # the transport and passed the transport instance. + # + # selector + # An instance of a connection selector strategy. + # + # send_get_body_as [String] + # Specify the HTTP method to use for GET requests with a body. + # Default: 'GET' + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:152 + def initialize(url: T.unsafe(nil), index: T.unsafe(nil), date_pattern: T.unsafe(nil), type: T.unsafe(nil), level: T.unsafe(nil), formatter: T.unsafe(nil), filter: T.unsafe(nil), application: T.unsafe(nil), environment: T.unsafe(nil), host: T.unsafe(nil), data_stream: T.unsafe(nil), metrics: T.unsafe(nil), **client_args, &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:198 + def batch(logs); end + + # The whole batch is formatted into a single bulk request before anything is sent. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:204 + def batch_all_or_nothing?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def batch_size; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def batch_size=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def client; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def client=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def client_args; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def client_args=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def date_pattern; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def date_pattern=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def flush_interval; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def flush_interval=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def index; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def index=(_arg0); end + + # The url without its credentials, and the index. See Subscriber#inspect. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:209 + def inspect_details; end + + # Log to the index for today, or to the data stream. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:193 + def log(log); end + + # The url is left to the client gem to parse, since it also takes a comma separated list of + # urls, an Array of them, or hosts without a scheme. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:188 + def reopen; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def timeout_interval; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def timeout_interval=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def url; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:27 + def url=(_arg0); end + + private + + # Returns [Array] the errors that caused this one, from the first to the innermost. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:368 + def bulk_causes(error); end + + # Returns [String] the number of entries, such as "1 entry" or "3 entries". + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:389 + def bulk_entries(count); end + + # Returns [Array] the entry of a bulk request for the log message: its action, and its document + # (see #bulk_line). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:223 + def bulk_entry(log); end + + # Returns [String] the reason for an error, followed by each error that caused it, such as the + # parser's error under a mapping error's "failed to parse", or nil when it has none. An error + # that is a String is its reason. A cause without a reason is written as its type alone. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:355 + def bulk_error_reason(error); end + + # Returns [String] a kind of failure of the given number of entries: its status, error type, + # and index, then the error of the first, as an example when there are others. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:342 + def bulk_failure(kind, error, count); end + + # Returns [Array] the kind of failure of an entry, from the result of its action: its status, + # error type, and index, and the type of the innermost error that caused it, so that a number + # and a date that could not be parsed, both a mapping error, are told apart. An error that is a + # String, as from Elasticsearch 1.x, has no type. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:333 + def bulk_failure_kind(result); end + + # Sends the entries in one bulk request, serializing their actions; their documents already + # are (see #bulk_line). + # + # Returns [Hash{Integer => Hash}] the result of each entry that was not indexed, by its + # position in `entries`. The response has an item for each entry, in order, under the name of + # its action, such as + # `{"index" => {"_index" => ..., "status" => 400, "error" => {"type" => ..., "reason" => ...}}}`, + # without the document. An entry failed when its result has an error, or a status of 300 or + # above: an `index` action succeeds with 201 (created) or 200 (updated), and a `create` action + # with 201. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:295 + def bulk_failures(entries); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:393 + def bulk_index(log); end + + # Returns [String] the log message formatted as a bulk line, serialized by Utils.to_json + # and handed to the client as a String. The client gem's serializer writes Infinity and NaN + # as bare words, which is not JSON, and does not repair invalid UTF-8, a structure nested too + # deeply, or a Struct (written through its #inspect), so such an entry was dropped or its + # objects' instance variables were written. Serializing is part of formatting, so an error + # doing so discards the message rather than stalling the appender (see #format_log). A + # formatter that returns a String is taken to have serialized the line itself. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:234 + def bulk_line(log); end + + # Returns [String] a reason as the report writes it, or nil when there is none: its first line + # only, since the JSON parser adds the error's location on the next, with part of the document; + # cut to MAX_REPORTED_REASON characters, followed by "..."; and inspected, since it can repeat a + # value of the entry, so that a control character in that value, such as a line break, cannot + # forge a line of the log. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:380 + def bulk_reason_text(reason); end + + # Sends the entries in one bulk request, then sends again those that the server rejected with + # status 429 (see #resend_rejected). The entries still not indexed after that, for this or any + # other reason, are reported and discarded (see #report_failures). + # + # The other entries were indexed, so an error raised while sending the rejected ones again, + # such as a timeout, is reported with the failures, rather than raised, which would count every + # entry as discarded. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:245 + def bulk_write(entries); end + + # The backing client class, e.g. ::Elasticsearch::Client or ::OpenSearch::Client. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:217 + def client_class; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:399 + def default_formatter; end + + # Reports to the internal logger the results of the entries of a bulk request that were not + # indexed, of `total` entries, which are discarded (see #bulk_write), with the error that + # stopped sending them again, if any. The failures are grouped by their kind (see + # #bulk_failure_kind), since the reasons for one kind differ by each entry's id and value, so + # that a batch whose entries all fail the same way is reported in a short line. Only the first + # MAX_REPORTED_FAILURES groups are listed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:314 + def report_failures(failed, total, error = T.unsafe(nil)); end + + # Sends again the entries that the server rejected with status 429, since its write queue was + # full, so that they are likely to be indexed a little later. Only those entries are sent again, + # so that none is indexed twice. They are sent up to RESEND_DELAYS.size more times, after a + # growing wait, which holds up the thread writing the entries: the appender's own thread when it + # writes in batches, as it does by default, or with `async: true`. Otherwise it is the thread + # that writes to every appender, or with SemanticLogger.sync!, the thread that logged, and every + # other thread that logs waits for it. + # + # `failed` holds the result of each entry not indexed, by its position in `entries` (see + # #bulk_failures). The result of an entry sent again replaces it, and an entry then indexed is + # removed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:268 + def resend_rejected(entries, failed); end +end + +# The most groups of failures that one report of a bulk request lists (see #report_failures). +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:16 +SemanticLogger::Appender::ElasticsearchBase::MAX_REPORTED_FAILURES = T.let(T.unsafe(nil), Integer) + +# The most characters of each reason that the report writes: a reason can repeat a whole value, +# as the "For input string" of a number that could not be parsed does. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:19 +SemanticLogger::Appender::ElasticsearchBase::MAX_REPORTED_REASON = T.let(T.unsafe(nil), Integer) + +# The seconds to wait before each time that the entries the server rejected with status 429 are +# sent again (see #bulk_write): three times, after 0.2, 0.4, then 0.8 seconds, so waits of at +# most 1.4 seconds for a request, plus up to 3 more bulk requests. Kept short, since waiting +# holds up the thread that writes the entries. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_base.rb:24 +SemanticLogger::Appender::ElasticsearchBase::RESEND_DELAYS = T.let(T.unsafe(nil), Array) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:16 +class SemanticLogger::Appender::ElasticsearchHttp < ::SemanticLogger::Appender::Http + # Create Elasticsearch appender over persistent HTTP(S) + # + # Parameters: + # index: [String] + # Prefix of the index to store the logs in Elasticsearch. + # The final index appends the date so that indexes are used per day. + # I.e. The final index will look like 'semantic_logger-YYYY.MM.DD' + # Default: 'semantic_logger' + # + # type: [String] + # Deprecated and ignored. Document `_type` has been unused since + # Elasticsearch 7. Passing it logs a deprecation warning; it will be + # removed in v6. + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # formatter: [Object|Proc|Symbol|Hash] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:56 + def initialize(index: T.unsafe(nil), type: T.unsafe(nil), url: T.unsafe(nil), **http_args, &); end + + # Elasticsearch indexes a batch of documents only through its bulk API, which the :elasticsearch + # appender uses. The #batch inherited from Appender::Http posts the batch as a JSON array to the + # url's own path, such as `/`, which Elasticsearch rejects, so add_appender refuses to batch it. + # + # Answers only while that #batch is the one in use (see Subscriber#batch_defined_by?), so that a + # subclass with a #batch of its own, such as one that posts the batch to the bulk API, is batched + # as before. One whose #batch calls super still posts a JSON array, so it defines its own + # #batch_refusal. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:93 + def batch_refusal; end + + # Deletes all log data captured for a day. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:81 + def delete_all(date = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:17 + def index; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:17 + def index=(_arg0); end + + # Log to the index for today. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/elasticsearch_http.rb:76 + def log(log); end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:8 +class SemanticLogger::Appender::File < ::SemanticLogger::Subscriber + # Create an appender to log to a named file. + # + # Parameters + # file_name [String] + # Name of the file to write to. + # + # File name format directives: + # %p - Process Id + # %n - Short hostname (SemanticLogger.host). Everything before the first period in the hostname. + # %N - Full hostname (SemanticLogger.host) + # %a - Application name (SemanticLogger.application) + # %e - Environment name (SemanticLogger.environment) + # %D - Current Date. Equivalent to "%Y%m%d" + # %T - Current Time. Equivalent to "%H%M%S" + # %% - Literal `%` character + # + # Date: + # %Y - Year with century + # %C - year / 100 (round down. 20 in 2009) + # %y - year % 100 (00..99) + # %m - Month of the year, zero-padded (01..12) + # %d - Day of the month, zero-padded (01..31) + # %j - Day of the year (001..366) + # %U - Week number of the year. The week starts with Sunday. (00..53) + # %W - Week number of the year. The week starts with Monday. (00..53) + # + # Time: + # %H - 24 Hour of the day, zero-padded (00..23) + # %M - Minute of the hour (00..59) + # %S - Second of the minute (00..60) + # + # Examples: + # Create a log file name consisting of the short host name, process id, date, and time. + # "log/production-%n-%p-%D-%T.log" + # + # :level [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # :formatter: [Object|Proc] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # :filter [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # :append [true|false] + # Append to the log file if already present? + # Default: true + # + # :exclusive_lock [true|false] + # Obtain an exclusive lock on the file, for operating systems that support it. + # Prevents multiple processes from trying to write to the same log file. + # Default: false + # + # :encoding ["UTF-8", "UTF-16", etc.] + # Encoding to use when writing to the file. + # Default: Encoding::BINARY + # + # :permissions [Integer] + # Octal file permissions to apply to the log file. + # Log files frequently contain sensitive information, so restrict access + # by supplying for example `0o640` (owner read/write, group read). + # Applied both when the file is created and to an existing log file, which must be + # a regular file owned by the process, with a single hard link, that the file_name + # names directly rather than through a symbolic link. Nothing is written to any + # other file, or when the file cannot be opened: the appender raises IOError when it + # is created, and when the file is later reopened, it reports why and writes nothing + # until the file is fixed, trying again every few seconds. + # Default: nil (use the process umask, the standard Ruby behavior) + # + # :retry_count [Integer] + # Number of times to attempt to re-open the file name when an error occurs trying to + # write to the file. + # Note: Set to 0 to disable retries. + # Default: 1 + # + # :reopen_period [String] + # Specify a period after which to re-open the log file, specified in minutes, hours, or days. + # The format of the duration must start with an Integer or Float number, + # followed by the duration specified as: + # "m" : minutes + # "h" : hours + # "d" : days + # The time is rounded down to the specified time interval, so that: + # - "1h" will re-open every hour at the beginning of the hour. + # - "30m" will re-open every 30 minutes at the beginning of the 30th minute. + # - "1d" will re-open every day at midnight. + # Examples: + # "60m" : Every 60 minutes at the beginning of the minute: 10:24:00, 11:24:00, 12:24:00, ... + # "1h" : Every hour at the beginning of the hour: 10:00:00, 11:00:00, 12:00:00, ... + # "1d" : Every day at the beginning of the day: "20211008 00:00:00", "20211009 00:00:00", ... + # Default: nil (Disabled) + # + # :reopen_count [Integer] + # Close and re-open the log file after every `reopen_count` number of logged entries. + # Default: 0 (Disabled) + # + # :reopen_size [Integer] + # Approximate number of bytes to write to a log file by this process before closing and re-opening it. + # Notes: + # - When `append: true` and the file already exists, it reads the size of the current log file + # and starts with that size. + # - If the current log file size already exceeds the `reopen_size`, its current size is ignored. + # - The `reopen_size` is only the amount of bytes written by this process, it excludes data + # written by other processes. Use a unique filename to prevent multiple processes from writing to + # the same log file at the same time. + # Default: 0 (Disabled) + # + # Example + # require "semantic_logger" + # + # # Log :info and above + # SemanticLogger.default_level = :info + # + # # Log to a file + # SemanticLogger.add_appender(file_name: "application.log", formatter: :color) + # + # logger = SemanticLogger["test"] + # logger.info "Hello World" + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:147 + def initialize(file_name, retry_count: T.unsafe(nil), append: T.unsafe(nil), reopen_period: T.unsafe(nil), reopen_count: T.unsafe(nil), reopen_size: T.unsafe(nil), encoding: T.unsafe(nil), exclusive_lock: T.unsafe(nil), permissions: T.unsafe(nil), **args, &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def append; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def append=(_arg0); end + + # Closes the log file, such as when the appender is removed, and forgets it, so that a write after + # it opens the file again, whatever the retry_count. An error closing it, such as EIO when the + # file's last writes did not reach a network file system, is reported rather than raised. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:245 + def close; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 + def current_file_name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def encoding; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def encoding=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def exclusive_lock; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def exclusive_lock=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def file_name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def file_name=(_arg0); end + + # Flush all pending logs to disk. + # Waits for all sent documents to be written to disk + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:238 + def flush; end + + # See Subscriber#inspect. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:255 + def inspect_details; end + + # Since only one appender thread will be writing to the file at a time + # it is not necessary to protect access to the file with a semaphore. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:209 + def log(log); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 + def log_count; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 + def log_size; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def permissions; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def permissions=(_arg0); end + + # After forking an active process call #reopen to re-open + # open the file handles etc to resources. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:178 + def reopen; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:11 + def reopen_at; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def reopen_count; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def reopen_count=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def reopen_period; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def reopen_period=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def reopen_size; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def reopen_size=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def retry_count; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:9 + def retry_count=(_arg0); end + + private + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:366 + def apply_format_directives(file_name); end + + # Round down the current time based on the period, then add on the duration for that period + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:425 + def calculate_reopen_at(duration, period, time = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:340 + def close_quietly(file); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:261 + def current_file_name=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:372 + def format_directive(directive); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:261 + def log_count=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:261 + def log_size=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:346 + def monotonic_time; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:399 + def next_reopen_period(period_string); end + + # Returns why the log file could not be opened with permissions. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:314 + def open_refusal(error); end + + # Opens the log file and applies the permissions to it, when it is safe to do so (see + # #permissions_refusal). Returns the open file, or nil after closing it and recording why it is + # refused, so that nothing is written to it. + # + # Changing the permissions of a file that another name links to could loosen them on an + # unrelated file, such as a private key linked into a shared log directory. Writing log messages + # to a file that this process does not own, or that another name links to, would let whoever + # controls it read them, despite the permissions asked for. So with permissions, the appender + # fails closed: it raises when it is created (see #initialize), and when the file is later + # reopened, on a rotation, a fork, or a write retry, it stops writing and reports why (see + # #refused) until the file is fixed (see #refused_retry_due?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:274 + def open_with_permissions(options); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:406 + def parse_period(period_string); end + + # Returns why the permissions must not be applied to the open log file, nor log messages + # written to it, or nil when they can. + # + # It must be a regular file owned by this process, with a single hard link, since a hard link + # planted in the log directory is otherwise indistinguishable from the file it links to. The + # path must also still name it, so that swapping the path after opening cannot redirect the + # log messages. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:327 + def permissions_refusal(file); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:309 + def refusal_message; end + + # Records why the log file is refused, and returns nil. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:291 + def refuse(reason, cause = T.unsafe(nil)); end + + # Reports why log messages are not being written to the log file, once for each file and + # reason, and returns false. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:300 + def refused; end + + # A refused log file is opened again every few seconds, and at the next scheduled reopen, + # rather than for every message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:360 + def refused_retry_due?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:261 + def reopen_at=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:350 + def time_to_reopen?; end +end + +# Seconds to wait before opening a refused log file again. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:19 +SemanticLogger::Appender::File::REFUSED_RETRY_INTERVAL = T.let(T.unsafe(nil), Integer) + +# With permissions, the log file is opened without following a symbolic link, so that a link +# planted in the log directory can neither create nor open the file it points at, without +# blocking, so that a planted FIFO fails to open instead of waiting for a reader, and without +# becoming the controlling terminal. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/file.rb:17 +SemanticLogger::Appender::File::SECURE_OPEN_FLAGS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:14 +class SemanticLogger::Appender::Honeybadger < ::SemanticLogger::Subscriber + # Honeybadger Appender + # + # Parameters + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: :error + # + # formatter: [Object|Proc|Symbol|Hash] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:40 + def initialize(level: T.unsafe(nil), **args, &block); end + + # Send an error notification to honeybadger + # + # Honeybadger replaces each byte of text that is not valid UTF-8 with "?", including binary text + # that holds UTF-8, such as a response body, so the data is sent as a copy with its text + # converted to valid UTF-8, as the JSON formatters write it, and a Hash or Array nested too + # deeply, or that holds itself, cut off there as they cut it off (see Utils.encode_utf8). Any + # other object is sent as it is, for Honeybadger to clean. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:51 + def log(log); end + + private + + # Use Raw Formatter by default + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger.rb:71 + def default_formatter; end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:14 +class SemanticLogger::Appender::HoneybadgerInsights < ::SemanticLogger::Subscriber + # Honeybadger Appender + # + # Parameters + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: :info + # + # formatter: [Object|Proc|Symbol|Hash] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:40 + def initialize(level: T.unsafe(nil), **args, &block); end + + # Send log to honeybadger events API + # + # Honeybadger replaces each byte of text that is not valid UTF-8 with "?", including binary text + # that holds UTF-8, such as a response body, so the data is sent as a copy with its text + # converted to valid UTF-8, as the JSON formatters write it, and a Hash or Array nested too + # deeply, or that holds itself, cut off there as they cut it off (see Utils.encode_utf8). Any + # other object is sent as it is, for Honeybadger to clean. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:51 + def log(log); end + + private + + # Use Raw Formatter by default + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/honeybadger_insights.rb:62 + def default_formatter; end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:43 +class SemanticLogger::Appender::Http < ::SemanticLogger::Subscriber + # Create HTTP(S) log appender + # + # Parameters: + # url: [String] + # Valid URL to post to. + # Example: http://example.com/some_path + # To enable SSL include https in the URL. + # Example: https://example.com/some_path + # verify_mode will default: OpenSSL::SSL::VERIFY_PEER + # A query string is kept and sent with every request that submits log data, + # for the log servers that are configured through it. + # Example: http://example.com/some_path?source=my_app + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # username: [String] + # User name for basic Authentication. + # Default: nil ( do not use basic auth ) + # + # password: [String] + # Password for basic Authentication. + # + # header: [Hash] + # Custom HTTP headers to send with each request. + # Default: {} ( do not send any custom headers) + # Example: {"Authorization" => "Bearer BEARER_TOKEN"} + # + # compress: [true|false] + # Whether to compress the JSON string with GZip. + # Default: false + # + # ssl: [Hash] + # Specific SSL options: For more details see NET::HTTP.start + # ca_file, ca_path, cert, cert_store, ciphers, key, ssl_timeout, + # ssl_version, verify_callback, verify_depth and verify_mode. + # + # proxy_url: [String] + # URL of proxy server to use for HTTP(s) connections. Should + # include username and password if required. + # Example: http://user@pass:example.com/some_path + # To enable SSL include https in the URL. + # Example: https://example.com/some_path + # If this is set to :ENV, Net::HTTP will use the environment http_proxy* + # variables if they are set. If set to nil then no proxy will be used, + # even if the environment variables are set. + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # formatter: [Object|Proc] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: SemanticLogger::Formatters::Json + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # open_timeout: [Float] + # Default: 2.0 + # + # read_timeout: [Float] + # Default: 1.0 + # + # continue_timeout: [Float] + # Default: 1.0 + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:189 + def initialize(url:, compress: T.unsafe(nil), ssl: T.unsafe(nil), username: T.unsafe(nil), password: T.unsafe(nil), header: T.unsafe(nil), proxy_url: T.unsafe(nil), open_timeout: T.unsafe(nil), read_timeout: T.unsafe(nil), continue_timeout: T.unsafe(nil), **args, &); end + + # Forward a batch of log messages to the HTTP Server in a single request. + # Only used when the appender is created with `batch: true`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:288 + def batch(logs); end + + # The whole batch is formatted into a single request before anything is sent, and the + # server answers for the request as a whole. So a batch that a format error or a rejected + # request fails (see #message_error?) is split up and sent again, to find the entries at + # fault. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:305 + def batch_all_or_nothing?; end + + # The HTTP appender supports batching, but only when explicitly requested + # via `batch: true`, so that the default behaviour (one request per log + # message) is preserved. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:297 + def batch_by_default?; end + + # The #batch above formats the whole batch with #format_batch, so it needs a formatter that can + # format a batch, such as the default one, rather than a formatter block. See + # Subscriber#batch_refusal. + # + # Answers only while that #batch is the one in use (see Subscriber#batch_defined_by?). A + # subclass that replaces it answers for its own, as Loki and Signalfx do, and is otherwise + # batched with any formatter, as before, such as one whose #batch formats each log message with + # #format_log. One whose #batch calls super, or that a prepended module wraps, still formats the + # whole batch with #format_batch, so it defines its own #batch_refusal, which returns + # #format_batch_refusal, as the Custom appenders section of docs/config.md shows. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:319 + def batch_refusal; end + + # Closes the connection, if it is open, such as when the appender is removed, or add_appender + # fails to add it. The next request opens it again, see #process_request. + # + # In a forked child that has not reopened, such as one that removes the appender before its + # reopen has run, it forgets the connection it inherited instead, without finishing it, since it + # belongs to the parent (see #reopen), and the next request starts a new one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:275 + def close; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def compress; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def compress=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def continue_timeout; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def continue_timeout=(_arg0); end + + # Whether the exception, a message error, would fail any batch, whatever entries it holds (see + # Subscriber#fails_any_batch?): the server rejected the request (see ResponseError#rejected?) + # other than for the entries it holds (see ResponseError#content_rejected?), such as for its + # credentials or its url, and would reject every part of the batch too. So the batch is + # discarded at once, rather than split up. A batch that could not be formatted, or that the + # server rejected for its entries, is split up to find the entries at fault. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:336 + def fails_any_batch?(exception); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def header; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def header=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def http; end + + # Only the redacted url, since the instance variables hold the password, the authorization + # headers, and any credential a subclass adds. See Subscriber#inspect. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:376 + def inspect_details; end + + # Forward log messages to HTTP Server + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:280 + def log(log); end + + # Whether the exception, raised by #log or #batch, was caused by the entries sent, rather + # than by the destination (see Subscriber#message_error?). That includes a request the + # server rejected (see ResponseError#rejected?), since sending it again cannot succeed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:326 + def message_error?(exception); end + + # Whether the request that raised the exception from #log or #batch was never sent, because + # the appender could not connect (see NOT_SENT_ERRORS), so that the server has not answered it + # (see Subscriber#not_sent?). An asynchronous appender then sends the entries again without + # counting it towards QueueProcessor::HeldWrite::MAX_RESENDS, so that an outage loses none of + # them until the worker thread gives up after async_max_retries. Decided from the class of the + # exception alone, as for #wrote_nothing?. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:364 + def not_sent?(exception); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def open_timeout; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def open_timeout=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def path; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def port; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def proxy_url; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def query; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def read_timeout; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def read_timeout=(_arg0); end + + # Returns [String] the scheme, host, and any non-default port of the url. Safe to log. + # See Utils.redacted_url. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:370 + def redacted_url; end + + # Closes the connection, if it is open, and starts a new one, such as after a log rotation, or a + # fork. When starting it fails, such as while the server cannot be reached, it raises, and the + # next request starts it (see #process_request). + # + # After a fork, the child first forgets the connection it inherited, without finishing it: it + # belongs to the parent. Finishing an https connection sends the server a TLS close_notify, which + # ends the connection for the parent too. Ruby closes the child's copy of the socket when it + # collects it, which leaves the parent's open. Net::HTTP keeps its socket to itself, so until then + # the child holds that copy open, and over plain http the server does not see the connection end + # when the parent closes it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:264 + def reopen; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def server; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def ssl_options; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:46 + def url; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def username; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:44 + def username=(_arg0); end + + # Whether the request that raised the exception from #log or #batch stored none of its + # entries, and is worth sending again later (see Subscriber#wrote_nothing?): the server asked + # to send it again later (see ResponseError#retry_later?), or it was never sent (see + # #not_sent?). So an asynchronous appender sends the entries again once it has backed off. + # + # Decided from the class of the exception alone. Its cause, which Ruby sets to the error being + # handled when it was raised, such as a format error while a batch is split, says nothing about + # this request; #process_request raises the error of the request, not one from reconnecting. + # + # A subclass whose #log or #batch sends more than one request must override this to return + # false: a failure of a later request would otherwise have the entries of the earlier ones, + # which the server stored, sent again. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:352 + def wrote_nothing?(exception); end + + private + + # Returns [Net::HTTP] a new connection, not yet started, after making it the appender's. Records + # the process that built it, which owns its connection (see #reopen). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:384 + def build_http; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:433 + def compress_data(data); end + + # Use JSON Formatter by default + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:429 + def default_formatter; end + + # HTTP Delete + # + # The query string of the configured url is _not_ applied here: it configures how + # the server ingests log data, and servers reject it on a maintenance request. + # Appender::ElasticsearchHttp#delete_all deletes an index, and Elasticsearch fails + # the request with a 400 when it carries unrecognized parameters. + # + # A maintenance request is not log data written by the worker thread of an asynchronous + # appender, so a response other than 2xx is reported to the internal logger, and false + # returned, rather than raised. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:463 + def delete(request_uri = T.unsafe(nil)); end + + # Finishes the connection, if it is open. In a child process, first forgets the connection + # started in the parent before a fork, without finishing it. See #reopen. + # + # Used by #reopen as well as #close, rather than #reopen calling #close, so that a subclass's + # #close is not run by a reopen. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:411 + def finish_connection; end + + # In a child process, forgets the connection started in the parent before a fork. See #reopen. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:419 + def forget_inherited; end + + # Returns [URI] the parsed url, without the url in the error raised for an invalid one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:424 + def parse_url(url); end + + # HTTP Post + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:442 + def post(body, request_uri = T.unsafe(nil)); end + + # Process HTTP Request + # + # Returns true when the server answers with a 2xx status. Raises ResponseError for any other + # status, so that the entries are counted as failed rather than written. Its message names + # only the redacted url, since the url can hold credentials, and the start of the body. + # + # After a RuntimeError, such as a read timeout, it connects again for the next request, and + # raises the error of this one even when connecting again fails, since only that error says + # whether the server may have stored the request (see #wrote_nothing?). Not after a request it + # could not send (see #not_sent?), such as a Net::OpenTimeout: connecting again straight away + # would fail the same way, so that a server that cannot be reached would hold up each request + # for twice its open_timeout. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:499 + def process_request(request, body = T.unsafe(nil)); end + + # HTTP Put + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:448 + def put(body, request_uri = T.unsafe(nil)); end + + # Connects again after a request failed. A failure to connect is reported to the internal + # logger, and left to the next request, which connects again when the connection is not open. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:527 + def reconnect; end + + # Applies the query string of the configured url, if any, to the uri of a request + # that submits log data. + # + # Kept out of `path` on purpose: subclasses build their own request paths from it + # (Appender::ElasticsearchHttp appends the index name and `_doc` to it), and the + # query has to stay at the end of the request uri regardless. + # + # @param request_uri [String] path of the request, `path` by default. + # @return [String] + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:480 + def uri_with_query(request_uri); end +end + +# Maximum number of bytes of an error response body to write to the internal logger. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:49 +SemanticLogger::Appender::Http::MAX_LOGGED_RESPONSE_BODY = T.let(T.unsafe(nil), Integer) + +# The errors raised when the appender cannot connect to the server, so that the request was +# never sent: the server's name does not resolve, it cannot be reached, or it does not accept +# the connection, refusing it or within the open_timeout. Once connected, an error such as a +# read timeout or a reset connection may come after the server took the request. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:108 +SemanticLogger::Appender::Http::NOT_SENT_ERRORS = T.let(T.unsafe(nil), Array) + +# Raised when the server answers a request with a status other than 2xx. Its message holds +# the status code, the redacted url, and the start of the response body, for the internal +# logger. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:54 +class SemanticLogger::Appender::Http::ResponseError < ::StandardError + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:77 + def initialize(message, code:, body: T.unsafe(nil)); end + + # Returns [String|nil] the body of the response, for a subclass that reads the server's own + # reason from it, such as Appender::SplunkHttp. Not in the message beyond its start, see + # MAX_LOGGED_RESPONSE_BODY. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:75 + def body; end + + # Returns [Integer] the status code of the response. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:70 + def code; end + + # Whether the server rejected the request for the entries it holds (see CONTENT_CODES), so + # that it may accept a part of them. It rejects a request with any other 4xx (see + # #rejected?), such as 401 Unauthorized, 403 Forbidden, or 404 Not Found, whatever it holds. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:96 + def content_rejected?; end + + # Whether the server rejected the request itself, with a 4xx status other than 408 and + # 429, so that sending it again cannot succeed. A 408, 429, or 5xx, and a 3xx, which asks to + # send it elsewhere, are problems with the destination instead. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:86 + def rejected?; end + + # Whether the server asks to send the request again later (see RETRY_LATER_CODES). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:91 + def retry_later?; end +end + +# The 4xx statuses that reject the request for the entries it holds: 400 Bad Request, +# 413 Content Too Large, and 422 Unprocessable Content. A server can answer 400 for its own +# configuration too, such as Splunk's HTTP Event Collector for an index it does not know, which +# then rejects every part of a batch split up to find the entries at fault. A subclass that +# can tell such an answer from its body says so from #fails_any_batch?, as +# Appender::SplunkHttp does. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:67 +SemanticLogger::Appender::Http::ResponseError::CONTENT_CODES = T.let(T.unsafe(nil), Array) + +# The statuses that ask the client to send the request again later, after which the server +# has not stored it: 408 Request Timeout, 429 Too Many Requests, and 503 Service +# Unavailable. Not a 500, which often comes again for the same request, or a 502 Bad Gateway +# or 504 Gateway Timeout, which a proxy can answer once the server behind it has stored it. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:59 +SemanticLogger::Appender::Http::ResponseError::RETRY_LATER_CODES = T.let(T.unsafe(nil), Array) + +# Describes a valid url in the error raised for an invalid one. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/http.rb:102 +SemanticLogger::Appender::Http::URL_FORMAT_HINT = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:11 +class SemanticLogger::Appender::IO < ::SemanticLogger::Subscriber + # Create a Stream Logger appender instance. + # + # Parameters + # io [IO] + # An IO stream to which to write the log messages to. + # + # :level [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # :formatter: [Object|Proc] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # :filter [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # Example + # require "semantic_logger" + # + # # Log :info and above + # SemanticLogger.default_level = :info + # + # # Log to screen + # SemanticLogger.add_appender(io: $stdout, formatter: :color) + # + # logger = SemanticLogger['test'] + # logger.info 'Hello World' + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:45 + def initialize(io, **args, &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:68 + def console_stream; end + + # Flush all pending logs to disk. + # Waits for all sent documents to be written to disk + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:64 + def flush; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/io.rb:54 + def log(log); end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:17 +class SemanticLogger::Appender::Loki < ::SemanticLogger::Appender::Http + # Create Grafana Loki appender. + # + # Parameters: + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true. + # The Proc must return true or false. + # + # host: [String] + # Name of this host to send as a stream label. + # Default: SemanticLogger.host + # + # application: [String] + # Name of this application to send as a stream label. + # Default: SemanticLogger.application + # + # url: [String] + # Define the loki instance URL. + # Example: https://logs-prod-999.grafana.net + # A query string is kept and sent with every request. + # Example: https://logs-prod-999.grafana.net?orgid=my_org + # Required. + # + # path: [String] + # Path of the push API, appended to the path of the url. + # Default: 'loki/api/v1/push' + # + # header: [Hash] + # HTTP headers to send with every request, such as X-Scope-OrgID, merged over the + # headers of the HTTP appender, whose Content-Type is already application/json. + # Default: {'Content-Type' => 'application/json'} + # + # formatter: [Object|Proc|Symbol|Hash] + # An instance of a class that implements #call and #batch, or a Proc, to be used to + # format the output from this appender. + # A Hash sets the options of the Loki formatter, such as the labels to write as structured + # metadata, or the label limits of a Loki that raises them (see + # SemanticLogger::Formatters::Loki#initialize). + # Example: {loki: {structured_metadata: [:pid, :thread]}} + # Default: SemanticLogger::Formatters::Loki, which reports a deprecation warning without + # structured_metadata:, since v6 writes pid and thread as structured metadata by default. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:62 + def initialize(url: T.unsafe(nil), formatter: T.unsafe(nil), header: T.unsafe(nil), path: T.unsafe(nil), **args, &); end + + # Logs in batches + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:86 + def batch(logs); end + + # The #batch above formats the whole batch with #format_batch, so it answers as + # Appender::Http#batch_refusal does for its own #batch: only while it is the one in use. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:94 + def batch_refusal; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:79 + def log(log); end + + private + + # Use the Loki formatter by default + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:101 + def default_formatter; end + + class << self + # Appends the ingestion path to the supplied url, keeping any query string at the + # end of the url where Appender::Http can parse it out. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:73 + def ingestion_url(url, path); end + end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/loki.rb:18 +SemanticLogger::Appender::Loki::INGESTION_PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:14 +class SemanticLogger::Appender::SentryRuby < ::SemanticLogger::Subscriber + # Create Appender + # + # Parameters + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: :error + # + # formatter: [Object|Proc|Symbol|Hash] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:52 + def initialize(level: T.unsafe(nil), **args, &block); end + + # Stops capturing the Sentry scope of each log entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:68 + def close; end + + # Send an error notification to sentry + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:73 + def log(log); end + + private + + # Starts the scope of the event from the Sentry scope captured when the entry was logged, so + # that the event has the user, tags, contexts, breadcrumbs, trace, and event processors of the + # thread that logged it. Copies it again, since the scope adds tags and extras to its Hashes, + # which would otherwise be the ones held by the log entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:140 + def apply_captured_scope(scope, log); end + + # As an on_log subscriber, on the thread that logs the entry, keeps a copy of its Sentry scope + # with the entry when it meets this appender's level. The filter is left to #log, so that it + # runs once, on the appender thread. + # + # The copy leaves out the Rack env: Sentry reads and rewinds the request body in it as it builds + # the request of an event, which must not happen on the appender thread while the request is + # still using it, or after it has closed the body. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:125 + def capture_scope(log); end + + # Use Raw Formatter by default + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:157 + def default_formatter; end + + # Returns [Array] the fingerprint taken from the named tags or payload, an Array of + # Strings, Symbols, or numbers. Returns nil when there is none, or it is of another type, which + # is then left where it is and sent to Sentry as data. As for the user, taking it from the + # payload is deprecated. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:218 + def extract_fingerprint!(source, from_payload: T.unsafe(nil)); end + + # Extract tags. + # + # Named tags will be stringified (both key and value). + # Unnamed tags will be stringified and joined with a comma. Then they will + # be used as a "tag" named tag. If such a tag already exists, it is also + # joined with a comma. + # + # Finally, the tag names are limited to 32 characters and the tag values to 256. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:275 + def extract_tags!(context); end + + # Extract user data from named tags or payload. + # + # Keys :user_id and :user_email will be used as :id and :email respectively. + # Keys :username and :ip_address will be used verbatim. + # + # Any additional value nested in a :user key will be added, provided any of + # the above keys is already present. + # + # The payload can hold untrusted data, such as a request body, so taking the user from it is + # deprecated, and the named tags win: a payload field is only taken when the named tags do not + # set it, and its value is a String, Symbol, or Integer. A payload value that is not taken is + # left where it is, and sent to Sentry as data. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:173 + def extract_user!(named_tags, payload); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:226 + def fingerprint_part?(part); end + + # Returns [Hash] this appender's copy of the payload or named tags as a Hash of the class of the + # log entry's own, such as HashWithIndifferentAccess, so that the keys taken out of it, such as + # :user_id, are found as in the application's Hash. The class's own #update may convert the + # nested Hashes too, as HashWithIndifferentAccess does. A plain Hash, or one whose class cannot + # be rebuilt this way, is returned as it is. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:245 + def like_original(copy, original); end + + # Adds the fields of a :user Hash in the payload that the user does not have yet, when each of + # its keys is a Symbol or String, and each of its values a String, Symbol, or Integer. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:195 + def merge_payload_user!(user, payload); end + + # Returns [Hash] the Sentry user of the thread with the fields of the user taken from the + # named tags, whose keys are Symbols, in place of the same fields, whether keyed by a String or + # a Symbol. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:152 + def merged_user(thread_user, user); end + + # Warns once that the Sentry user or fingerprint was taken from the payload. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:255 + def payload_context_deprecated; end + + # Returns [Hash] the payload, from this appender's own copy, as a Hash that keys can be taken out + # of. A payload that is not a Hash is sent to Sentry as the extra named payload. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:232 + def payload_extras(payload, original); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:206 + def user_key?(key); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:210 + def user_value?(value); end +end + +# The types of value accepted in a fingerprint, which Sentry turns into Strings. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:22 +SemanticLogger::Appender::SentryRuby::FINGERPRINT_PART_TYPES = T.let(T.unsafe(nil), Array) + +# The key of the Sentry scope of the thread that logged the entry, as captured with the entry. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:25 +SemanticLogger::Appender::SentryRuby::SCOPE_CAPTURE_KEY = T.let(T.unsafe(nil), Symbol) + +# Keys of the named tags or payload that set the Sentry user, mapped to its fields. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:16 +SemanticLogger::Appender::SentryRuby::USER_KEYS = T.let(T.unsafe(nil), Hash) + +# The types of value taken from the payload for a field of the Sentry user. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/sentry_ruby.rb:19 +SemanticLogger::Appender::SentryRuby::USER_VALUE_TYPES = T.let(T.unsafe(nil), Array) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:29 +class SemanticLogger::Appender::SplunkHttp < ::SemanticLogger::Appender::Http + # Create Splunk appender over persistent HTTP(S) + # + # Parameters: + # token: [String] + # Token created in Splunk for this HTTP Appender + # Mandatory. + # + # source_type: [String] + # Optional: Source type to display in Splunk + # + # index: [String] + # Optional: Name of a valid index for this message in Splunk. + # + # url: [String] + # Valid URL to post to. + # Example: http://example.com + # To enable SSL include https in the URL. + # Example: https://example.com + # verify_mode will default: OpenSSL::SSL::VERIFY_PEER + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # compress: [true|false] + # Splunk supports HTTP Compression, enable by default. + # Default: true + # + # ssl: [Hash] + # Specific SSL options: For more details see NET::HTTP.start + # ca_file, ca_path, cert, cert_store, ciphers, key, open_timeout, read_timeout, ssl_timeout, + # ssl_version, use_ssl, verify_callback, verify_depth and verify_mode. + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # formatter: [Object|Proc] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:101 + def initialize(token: T.unsafe(nil), source_type: T.unsafe(nil), index: T.unsafe(nil), compress: T.unsafe(nil), **args, &); end + + # Send a batch of log messages to the HTTP Event Collector in a single request, as event objects + # stacked one after the other, the batch format of "Format events for HTTP Event Collector": + # https://help.splunk.com/en/splunk-enterprise/get-started/get-data-in/10.6/get-data-with-http-event-collector/format-events-for-http-event-collector + # + # Each event is what #log sends for that entry, formatted by #format_log. The formatter must + # format each entry as exactly one event object, as the default one, the appender itself (see + # #call), does, since the collector names a rejected event by its position in the request (see + # #rejected_entry). + # Every entry is formatted before the request is sent, so a format error sends nothing, and the + # batch is split up to find the entry at fault (see Http#batch_all_or_nothing?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:153 + def batch(logs); end + + # Returns [String] JSON to send to Splunk. + # + # For splunk format requirements see: + # https://docs.splunk.com/Documentation/Splunk/latest/Data/FormateventsforHTTPEventCollector + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:120 + def call(log, logger); end + + # Whether the exception would fail any batch, whatever entries it holds (see + # Http#fails_any_batch?), including a 400 Bad Request whose body holds one of the collector's + # CONFIGURATION_CODES, such as for a wrong `index:`. So the batch is discarded at once, and + # reported once, with the collector's text, rather than split up and each entry sent on its own. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:138 + def fails_any_batch?(exception); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:47 + def index; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:47 + def index=(_arg0); end + + # Returns [Integer|nil] the position in the batch of the event that the HTTP Event Collector + # rejected, from the `invalid-event-number` in the body of its 400 Bad Request, such as + # {"text":"Invalid data format","code":6,"invalid-event-number":2}, or nil when it holds none + # (see Subscriber#rejected_entry). + # + # The collector reads the events of a batch in order, and indexes those before the one it + # rejects. Splunk's documentation does not say so: "Troubleshoot HTTP Event Collector" and + # "Format events for HTTP Event Collector" describe neither `invalid-event-number` nor what + # happens to the rest of a batch. Users report it, for example + # https://github.com/moby/moby/issues/35862, where a batch of 10 whose last event is malformed, + # sent again and again, had "the first 1-9 ... accepted by Splunk over and over again". + # + # So splitting such a batch to find the event at fault would index the events before it twice. + # Instead the events before it are counted as written, it is discarded, and those after it, + # which the collector never read, are sent again. A 400 without the number, such as a proxy's, + # is split as for Http, and so is any other status, which the collector does not answer with an + # event number. The number counts events, so a formatter must format each entry as one event + # object, as the default one does. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:177 + def rejected_entry(exception); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:47 + def source_type; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:47 + def source_type=(_arg0); end + + private + + # Returns [Hash] the body of a response from the HTTP Event Collector, such as + # {"text":"Incorrect index","code":7}, or an empty Hash for a body that is not a JSON object, + # such as a response from a proxy in front of it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:188 + def collector_response(body); end +end + +# The status codes in the body of a 400 Bad Request from the HTTP Event Collector that reject +# the request for the collector's configuration or the appender's, whatever entries it holds: +# 7 Incorrect index +# 10 Data channel is missing +# 11 Invalid data channel +# 14 ACK is disabled +# 16 Query string authorization is not enabled +# 21 Invalid token +# 22 Token disabled +# The others it answers with a 400 are caused by the entries, so a batch is split up to find +# them: 5 No data, 6 Invalid data format, 12 Event field is required, 13 Event field cannot be +# blank, and 15 Error in handling indexed fields. +# +# See "Troubleshoot HTTP Event Collector", Possible error codes: +# https://help.splunk.com/en/splunk-enterprise/get-started/get-data-in/10.4/get-data-with-http-event-collector/troubleshoot-http-event-collector +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/splunk_http.rb:45 +SemanticLogger::Appender::SplunkHttp::CONFIGURATION_CODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:32 +class SemanticLogger::Appender::Syslog < ::SemanticLogger::Subscriber + # Create a Syslog appender instance. + # + # Parameters + # url: [String] + # Default: 'syslog://localhost' + # For writing logs to a remote syslog server + # URL of server: protocol://host:port + # Uses port 514 by default for TCP and UDP. + # local syslog example: 'syslog://localhost' + # TCP example with default port: 'tcp://logger' + # TCP example with custom port: 'tcp://logger:8514' + # UDP example with default port: 'udp://logger' + # UDP example with custom port: 'udp://logger:8514' + # When using the :syslog protocol, logs will always be sent to the localhost syslog + # + # host: [String] + # Host name to provide to the remote syslog. + # Default: SemanticLogger.host + # + # tcp_client: [Hash] + # Default: {} + # Only used with the TCP protocol. + # Specify custom parameters to pass into Net::TCPClient.new + # For a list of options see the net_tcp_client documentation: + # https://github.com/reidmorrison/net_tcp_client/blob/master/lib/net/tcp_client/tcp_client.rb + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # application: [String] + # Identity of the program. + # Default: SemanticLogger.application + # + # max_size: [Integer] + # Set your own packet size. + # Default: 1024 bytes + # + # options: [Integer] + # Default: ::Syslog::LOG_PID | ::Syslog::LOG_CONS (when logging to a local syslog daemon) + # Any of the following (options can be logically OR'd together) + # ::Syslog::LOG_CONS + # ::Syslog::LOG_NDELAY + # ::Syslog::LOG_NOWAIT + # ::Syslog::LOG_ODELAY + # ::Syslog::LOG_PERROR + # ::Syslog::LOG_PID + # Note: + # - Only applicable when logging to a local syslog instance. + # I.e. When `url: 'syslog://localhost'` + # + # facility: [Integer] + # Default: ::Syslog::LOG_USER (the same value as SemanticLogger::Formatters::Syslog::LOG_USER) + # Type of program (can be logically OR'd together) + # ::Syslog::LOG_AUTH + # ::Syslog::LOG_AUTHPRIV + # ::Syslog::LOG_CONSOLE + # ::Syslog::LOG_CRON + # ::Syslog::LOG_DAEMON + # ::Syslog::LOG_FTP + # ::Syslog::LOG_KERN + # ::Syslog::LOG_LRP + # ::Syslog::LOG_MAIL + # ::Syslog::LOG_NEWS + # ::Syslog::LOG_NTP + # ::Syslog::LOG_SECURITY + # ::Syslog::LOG_SYSLOG + # ::Syslog::LOG_USER + # ::Syslog::LOG_UUCP + # ::Syslog::LOG_LOCAL0 + # ::Syslog::LOG_LOCAL1 + # ::Syslog::LOG_LOCAL2 + # ::Syslog::LOG_LOCAL3 + # ::Syslog::LOG_LOCAL4 + # ::Syslog::LOG_LOCAL5 + # ::Syslog::LOG_LOCAL6 + # ::Syslog::LOG_LOCAL7 + # + # level_map: [Hash | SemanticLogger::Formatters::Syslog::LevelMap] + # Supply a custom map of SemanticLogger levels to syslog levels. + # + # Example: + # # Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING. + # SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE}) + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:126 + def initialize(url: T.unsafe(nil), facility: T.unsafe(nil), max_size: T.unsafe(nil), level_map: T.unsafe(nil), options: T.unsafe(nil), tcp_client: T.unsafe(nil), **args, &); end + + # Closes the connection to a remote syslog server, such as when the appender is removed, and forgets it, so + # that the next write connects again over TCP, or opens a new socket over UDP. The local syslog is left + # open, since ::Syslog is shared by the whole process. An error closing it is reported to the internal + # logger, rather than raised. + # + # Over TCP, in a forked child that has not reopened, such as one that removes the appender before its + # reopen has run, it forgets the client it inherited instead, without closing its connection, which + # belongs to the parent (see #reopen). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:231 + def close; end + + # Returns [SemanticLogger::Formatters::Base] default formatter for this Appender + # depending on the protocol selected + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:270 + def default_formatter; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def facility; end + + # Flush is called by the semantic_logger during shutdown. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:259 + def flush; end + + # Set the formatter from Symbol|Hash|Block, as for any appender. + # + # When sending over TCP or UDP, a formatter named as one of the PACKET_FORMATTERS also gets + # this appender's facility, level map, and maximum packet size, whether it is supplied when + # the appender is created or set later. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:186 + def formatter=(formatter); end + + # The url without any credentials. See Subscriber#inspect. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:289 + def inspect_details; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def level_map; end + + # Write the log using the specified protocol and server. Connects over TCP, or opens a socket over UDP, + # first when the appender has none: after #close, or over TCP when connecting failed as it was reopened + # after a fork. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:241 + def log(log); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def max_size; end + + # Over UDP, a log message too large for a datagram (Errno::EMSGSIZE) cannot be sent by retrying. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:264 + def message_error?(exception); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def options; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def port; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def protocol; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def remote_syslog; end + + # After forking an active process call #reopen to re-open + # open the handles to resources + # + # Over TCP, it connects again, and then closes the connection it replaces, such as after a log rotation. + # When connecting fails, it raises, and keeps the connection it has. Over UDP, it closes the socket it + # replaces, which in a forked child is only the child's copy. + # + # Over TCP, a child process first forgets the client it inherited, without closing its connection, which + # belongs to the parent. The child closes only its own copy of the socket's file descriptor, which sends + # the server nothing, so that the server sees the connection end once the parent closes it, rather than + # once the child exits, or collects the client. When connecting fails in the child, such as while the + # server cannot be reached, the appender connects again on its next write, rather than writing through + # the parent's connection. Over TLS, both processes would then carry on the same TLS session, so that the + # server could not decrypt what the parent writes next. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:204 + def reopen; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def server; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:33 + def url; end + + private + + # Closes the given TCP client or UDP socket, if any: the one that a reopen replaced, when replaced: is true. + # Reports an error to the internal logger as a warning, rather than raising it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:319 + def close_remote_syslog(remote_syslog, replaced: T.unsafe(nil)); end + + # Returns [Net::TCPClient] a new client, connected to the server, after making it the appender's. Records + # the process that built it, which owns its connection (see #reopen). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:297 + def connect_tcp; end + + # In a child process, forgets the TCP client built in the parent before a fork, and then closes the child's + # copy of its socket's file descriptor, without a TLS shutdown: SSLSocket#to_io is the TCPSocket under it. + # See #reopen. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:308 + def forget_inherited; end + + # Returns [Hash] a copy of the options given as tcp_client: (see Subscriber#copy_options), with the server + # from the url, for a new Net::TCPClient, since it takes handshake_timeout: out of the ssl: Hash it is + # given: each client gets a copy of its own, which keeps the timeout for the next one, such as after a + # reopen. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:329 + def tcp_client_options; end + + # Returns the supplied formatter, with this appender's facility, level map, and + # maximum packet size added when it names one of the PACKET_FORMATTERS, so that they are not + # silently ignored. Options in a + # `{syslog: {...}}` Hash take precedence. A formatter instance keeps its own settings. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:337 + def with_packet_options(formatter); end +end + +# The formatters that build remote syslog packets, and so need this appender's facility, level map, +# and maximum packet size. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/syslog.rb:285 +SemanticLogger::Appender::Syslog::PACKET_FORMATTERS = T.let(T.unsafe(nil), Array) + +# Writes the formatted text of log entries to an IO, such as a log file or standard output, for +# the appenders that write to one (Appender::File and Appender::IO). +# +# An IO with an external encoding converts what it writes to that encoding, and raises an +# EncodingError for text that it cannot convert, which would lose the entry. A file opened with an +# which a custom formatter can return, and a character that its encoding does not have. An IO +# that converts to UTF-8, such as one opened after Rails set `Encoding.default_internal`, refuses +# only such binary text: it writes text tagged UTF-8 that holds invalid bytes as it is. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/text_output.rb:12 +module SemanticLogger::Appender::TextOutput + class << self + # Returns [String] the formatted text of a log entry as the line that .write writes: a new + # String of it followed by a line break. A new one, since the formatter's String can be one it + # does not own, such as a custom formatter's log.message, the application's own, or frozen. It + # keeps the text's encoding. An object that converts to a String implicitly (#to_str) is read + # as that String, and anything else, such as nil, a Hash, or a Pathname, raises TypeError. + # Interpolation would write any object, and tag US-ASCII text UTF-8. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/text_output.rb:57 + def line(text); end + + # Writes the text to the IO, or, when the IO cannot convert it to its encoding, the text + # converted first (see .writable_text). Only text that the IO refuses is converted. + # + # Only an IO that converts the whole text before it writes any of it is written to again (see + # .converts_whole_text?). Another object that responds to #write, such as one that writes to + # two IOs, could have written part of the text before it raised, which would then be written + # twice, so its error is raised as before. + # + # Returns what IO#write returns: the number of bytes written, in the IO's encoding. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/text_output.rb:22 + def write(io, text); end + + private + + # Whether the IO converts the whole text before it writes any of it: an ::IO, a Tempfile, which + # writes with File#write, or a StringIO. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/text_output.rb:45 + def converts_whole_text?(io); end + + # Returns [String] the text, converted to valid UTF-8 as the JSON formatters convert it (see + # Utils.encode_utf8_string), and then, for an IO with an external encoding other than UTF-8, + # converted to that encoding, with "?" (or U+FFFD for a Unicode encoding) in place of each + # character that it does not have. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/text_output.rb:34 + def writable_text(text, io); end + end +end + +# UDP log appender. +# +# Write log messages to UDP. +# By default messages are in JSON format. +# +# Example: +# SemanticLogger.add_appender( +# appender: :udp, +# server: 'server:3300', +# metrics: false +# ) +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:15 +class SemanticLogger::Appender::Udp < ::SemanticLogger::Subscriber + # Create UDP log appender. + # + # server: [String] + # The server to write UDP messages to, as "host:port", such as "localhost:8088", with an IPv6 + # address in brackets, as a URL writes it, such as "[::1]:8088". A host name is sent to over + # IPv4 when it has an IPv4 address, and otherwise, or when it cannot connect over IPv4, over IPv6. + # + # udp_flags: [Integer] + # Should be a bitwise OR of Socket::MSG_* constants. + # Default: 0 + # + # Common Appender Parameters: + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # formatter: [Object|Proc|Symbol|Hash] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: :json + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # metrics: [Boolean] + # Send metrics only events over udp. + # Default: true, with a deprecation warning when it is not supplied, since v6 changes it to false. + # + # Limitations: + # * UDP packet size is limited by the connected network and any routers etc + # that the message has to traverse. See https://en.wikipedia.org/wiki/Maximum_transmission_unit + # + # Example: + # SemanticLogger.add_appender( + # appender: :udp, + # server: 'server:3300', + # metrics: false + # ) + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:80 + def initialize(server:, udp_flags: T.unsafe(nil), metrics: T.unsafe(nil), **args, &); end + + # Closes the socket, such as when the appender is removed, and forgets it, so that the next write opens a new + # one. An error closing it is reported to the internal logger as a warning, rather than raised. + # + # In a forked child, the socket is the child's own copy of the parent's, so closing it leaves the parent's open. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:119 + def close; end + + # Flush is called by the semantic_logger during shutdown. Does nothing after #close, which left no socket. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:111 + def flush; end + + # See Subscriber#inspect. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:131 + def inspect_details; end + + # Write the log using the specified protocol and server. Opens a new socket, connected to the server, first + # when the appender has none, after #close. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:105 + def log(log); end + + # A log message too large for a datagram (Errno::EMSGSIZE) cannot be sent by retrying. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:126 + def message_error?(exception); end + + # After forking an active process call #reopen to re-open + # open the handles to resources + # + # Connects a new socket to the server before closing the one it replaces. When it cannot, it + # raises, keeping the socket it has: ArgumentError for a server that is not "host:port", or + # the error from resolving or connecting, such as SocketError for a host name that does not resolve. + # An error closing the socket it replaced is reported to the internal logger as a warning, since the + # reopen itself worked. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:96 + def reopen; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:27 + def server; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:27 + def server=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:28 + def socket; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:27 + def udp_flags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:27 + def udp_flags=(_arg0); end + + private + + # Closes the given socket, if any: the one that a reopen replaced, when replaced: is true. An error closing + # it is reported to the internal logger as a warning, rather than raised. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:139 + def close_socket(socket, replaced: T.unsafe(nil)); end + + # Returns [UDPSocket] a new socket of the address's family, connected to it. Closes the socket when it does not + # return it, such as when connecting raises, or the thread is interrupted. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:196 + def connect_to(address); end + + # Returns [UDPSocket] a new socket, connected to the first of the server's addresses that it can connect to, as + # Ruby's own UDPSocket#connect tries the addresses of its socket's family in turn. A host name's IPv4 addresses + # come first, so that a name with both is still sent to over IPv4, as when the socket was IPv4 only, whichever + # address the resolver returns first. Its IPv6 addresses are looked up only when the resolver answers that it has + # no IPv4 address, or it has none that it can connect to, so that a resolver that does not answer for them does + # not hold up the others. Each family keeps the resolver's order. When looking up its IPv4 addresses fails for + # another reason, such as a resolver that does not answer in time, raises that SocketError at once, rather than + # sending over IPv6 to a name that has IPv4 addresses, or waiting for a resolver that is down a second time. + # + # When it cannot connect to any address, raises the error from the first one it tried, the one it prefers. When + # the host has no address, such as a name that does not resolve, raises the SocketError from looking up its IPv6 + # addresses, with the one from looking up its IPv4 addresses as its cause (see #raise_lookup_error). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:157 + def connected_socket; end + + # Returns [SemanticLogger::Formatters::Json] formatter default for this Appender + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:222 + def default_formatter; end + + # Returns [true|false] whether the SocketError from looking up a host's addresses of one family says that it has + # none, rather than that the lookup failed. It cannot tell without the error's code, which Socket::ResolutionError + # has from Ruby 3.3, so on Ruby 3.2, or on JRuby, it takes any SocketError to say so, as before. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:179 + def no_address?(error); end + + # Raises the last of the SocketErrors from looking up the host's addresses, with the one before it, if any, as its + # cause, since it looked up the later family only because the earlier one had no address. Raises a SocketError + # of its own, naming the host, when no lookup raised, since JRuby returns no addresses for a family that the host + # has none in, rather than raising. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:187 + def raise_lookup_error(host, errors); end + + # Returns [Array(String, Integer, Array)] the host and port of the server, and the address families to + # look the host up in, in the order to try them. A host in brackets is an IPv6 address. Any other host is an IPv4 + # address, or a name, which is looked up for its IPv4 addresses first, then for its IPv6 addresses. Whitespace + # around the server, such as the newline at the end of an environment variable, is ignored. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:209 + def server_endpoint; end +end + +# The codes of a lookup that found no address of the family it asked for, rather than failing, of those that +# the platform defines. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:22 +SemanticLogger::Appender::Udp::NO_ADDRESS = T.let(T.unsafe(nil), Array) + +# The host and port of a server, with an IPv6 address in brackets, as a URL writes it. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appender/udp.rb:17 +SemanticLogger::Appender::Udp::SERVER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:6 +class SemanticLogger::Appender::Wrapper < ::SemanticLogger::Subscriber + # Forward all logging calls to the supplied logging instance. + # + # Parameters + # logger: [Object] + # Instance of an existing logger conforming to the Ruby Logger methods. + # + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this appender. + # Default: none (:trace), so it writes every entry that a logger emits; each logger + # filters by its own level. + # + # formatter: [Object|Proc] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this appender + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # Ruby Logger + # require 'logger' + # require 'semantic_logger' + # + # ruby_logger = Logger.new($stdout) + # SemanticLogger.add_appender(logger: ruby_logger) + # + # logger = SemanticLogger['test'] + # logger.info('Hello World', some: :payload) + # + # Install the `rails_semantic_logger` gem to replace the Rails logger with Semantic Logger. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:44 + def initialize(logger:, **args, &); end + + # Close underlying log + # Waits for all queued log messages to be written to disk. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:75 + def close; end + + # Flush all pending logs to disk. + # Waits for all queued log messages to be written to disk. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:69 + def flush; end + + # Pass log calls to the underlying Rails, log4j or Ruby logger + # trace entries are mapped to debug since :trace is not supported by the + # Ruby or Rails Loggers + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:61 + def log(log); end + + # The logger this appender writes to. Not #logger, which is the internal logger that this + # appender reports its own problems to, as every appender does (see Subscriber#logger). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appender/wrapper.rb:9 + def wrapped_logger; end +end + +# Manage a collection of appenders. +# +# While the process exits, it also knows which of its appenders it skips: those without a queue of +# their own whose destination failed meanwhile, and how many log messages each has not been given +# since (see #process_exiting=). +# +# pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:7 +class SemanticLogger::Appenders < ::Concurrent::Array + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:19 + def initialize(logger = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:27 + def add(**args, &); end + + # Flush and close every appender, then remove those closed. An appender that fails is reported, + # and the others are still closed. + # + # A stack overflow is raised at once, as #log raises it, since the thread must not carry on: on + # macOS a second stack overflow on the same thread crashes Ruby. The appenders already closed are + # still removed. The one that overflowed the stack, and those after it, not yet closed, stay + # listed, as one whose close fails does. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:122 + def close; end + + # Whether any of the existing appenders already output to the console? + # I.e. Writes to stdout or stderr. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:48 + def console_output?; end + + # The console streams (:stdout and/or :stderr) already being written to by the existing appenders. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:42 + def console_streams; end + + # Flush every appender. An appender that fails is reported, and the others are still flushed. + # + # While the process exits, an appender that is skipped (see #process_exiting=) is first reported, + # with the number of log messages it has not been given since it was last reported, then flushed + # too, so that it delivers the messages it already accepted, such as those that the producer of a + # :kafka appender holds. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:103 + def flush; end + + # Returns [true|false] whether the thread is the worker thread of one of the appenders while that + # appender's queue is full, or a flush or close of it is waiting (see QueueProcessor#holding_up?): + # the thread that writes to every appender may then be waiting for it, to make room or to run that + # request. Takes no lock, as #worker_thread? takes none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:203 + def holding_up?(thread = T.unsafe(nil)); end + + # Write the log message to every appender that should log it. An appender that fails is + # reported, and the others still write the message. + # + # While the process exits, an appender without a queue of its own is skipped once its + # destination has failed, and the message counted as not given to it (see #process_exiting=). + # + # The values of the sensitive keys are first replaced, once, so that no appender writes them + # (see SemanticLogger.sensitive_keys=). + # + # A stack overflow is not a failure of the appender but of the thread, which must not overflow + # again: on macOS a second stack overflow on the same thread crashes Ruby. It is raised to the + # processor running this thread instead, and the message goes to no further appenders. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:79 + def log(log); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:17 + def logger; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:17 + def logger=(_arg0); end + + # Tell each appender added with async: true or in batches whether the process is exiting: true + # before the flush at exit, and false once it has returned (see QueueProcessor#process_exiting=). + # Each one's queue processor is told straight away, rather than through the queue of the thread + # that writes to every appender, which can be held up handing an entry to the full queue of an + # appender whose worker thread is backing off during an outage. Takes no lock, so that it can be + # called from any thread, or a signal trap. An appender that raises is reported, as for #flush, + # and the others are still told, so that the flush at exit still runs. + # + # The appenders without a queue of their own are written to here, one log message after another, + # by the thread that writes to every appender, so that during an outage the flush at exit would + # wait while each message queued ahead of it failed in turn, up to a timeout each against a + # server that does not answer. So while the process exits, once the destination of such an + # appender fails, other than for the content of a message (see Subscriber#message_error?), it is + # skipped until the process no longer exits: #log gives it no more messages, counting them, and + # #flush reports them, then still flushes it, so that it delivers what it already accepted. The + # other appenders are still given every message. + # + # It applies only in the process that exits, not in a child process forked meanwhile. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:174 + def process_exiting=(exiting); end + + # After a fork, replace the queue and worker thread of each appender added with async: true or + # in batches with the child's own, on the calling thread (see QueueProcessor#renew_after_fork). + # Takes no lock, so that it can be called from a signal trap. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:187 + def renew_after_fork; end + + # After a fork, or a log rotation, reopen each appender. Called on the thread that writes to the + # appenders: the worker thread of the main Processor, or the calling thread with sync!. An + # appender added with async: true or in batches is asked to reopen, by its own worker thread + # (see Appender::Async#reopen). + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:144 + def reopen; end + + # Returns [Array] operational statistics for each appender. + # + # Appenders that run asynchronously (see SemanticLogger::Appender::Async#stats) report + # their queue size and processed/dropped/failed counts. Appenders that log inline on the + # processor thread report only their name with `async: false`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:57 + def stats; end + + # Returns [true|false] whether the thread is the worker thread of one of the appenders: one added + # with async: true or in batches, which writes to it (see QueueProcessor#worker_thread?). The thread + # that writes to every appender may be waiting for it, so it must not wait for that thread. Takes + # no lock, so that it can be called from a signal trap. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:195 + def worker_thread?(thread = T.unsafe(nil)); end + + private + + # Whether this process is exiting (see #process_exiting=), rather than a child process forked while + # it was. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:211 + def exiting?; end + + # Report the log messages that a skipped appender has not been given since it was last reported. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:230 + def report_skipped(appender, skipped); end + + # While the process exits, skip an appender without a queue of its own once writing to it failed + # because of its destination (see #process_exiting=). An appender with a queue of its own is told + # that the process is exiting, and handles it itself. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:221 + def skip_while_exiting(appender, exception); end + + # Returns [Hash] the appenders skipped while the process exits, by appender, or none while it does + # not. The process can stop exiting while the thread that writes to every appender fails to write + # to one, so one skipped then is left out until the process exits again, which starts afresh. + # + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:216 + def skipped_appenders; end +end + +# No appender is skipped while the process is not exiting. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:14 +SemanticLogger::Appenders::NONE_SKIPPED = T.let(T.unsafe(nil), Hash) + +# An appender skipped while the process exits: the error with which its destination failed, and +# the number of log messages it has not been given since it was last reported. +# +# pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 +class SemanticLogger::Appenders::Skipped < ::Struct + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def discarded; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def discarded=(_); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def exception; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def exception=(_); end + + class << self + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def [](*_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def inspect; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def keyword_init?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def members; end + + # pkg:gem/semantic_logger#lib/semantic_logger/appenders.rb:10 + def new(*_arg0); end + end +end + +# Asks an application's backtrace cleaner, such as `Rails.backtrace_cleaner`, to clean a backtrace. +# +# A backtrace cleaner is any object that responds to `#clean`, as ActiveSupport::BacktraceCleaner +# does, or to `#call`, such as a Proc. It is given the backtrace as an Array of Strings, and +# returns the lines to log in its place: it can leave lines out, and shorten or rewrite them. +# +# Internal: Log caches the result for each of its exceptions; see Log#backtrace_of. +# +# pkg:gem/semantic_logger#lib/semantic_logger/backtrace_cleaning.rb:9 +module SemanticLogger::BacktraceCleaning + class << self + # Returns [Array] the backtrace as the cleaner cleans it, or nil when there is none. + # The Array and its lines are frozen copies, so that every appender can share them. + # + # Returns a copy of the supplied backtrace instead when the cleaner leaves out every line, so + # that the only clue to where an exception came from is never lost, for example an exception + # raised entirely within gems that a cleaner silences. Also when the cleaner does not return an + # Array of lines, or raises a StandardError, such as for an object that is not a cleaner, so + # that a cleaner cannot stop a log entry being written. The error is reported to the internal + # logger, since nothing else would show that the cleaner is broken. + # + # The cleaner is given a copy of the backtrace, which it may change, since the supplied one + # belongs to the exception, and other appenders, such as error services, also read it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/backtrace_cleaning.rb:36 + def clean(backtrace, cleaner); end + + # Returns [true|false] whether the object can clean a backtrace. + # + # pkg:gem/semantic_logger#lib/semantic_logger/backtrace_cleaning.rb:11 + def cleaner?(object); end + + # Returns the cleaner, for a setting that holds one. + # Raises ArgumentError when it cannot clean a backtrace (see .cleaner?), naming what the + # setting expects, since it can accept other values too. + # + # pkg:gem/semantic_logger#lib/semantic_logger/backtrace_cleaning.rb:18 + def validate!(cleaner, expected: T.unsafe(nil)); end + + private + + # Returns [Array] a frozen copy of the lines the cleaner keeps, or nil when it keeps + # none, does not return an Array of lines, or raises. + # + # pkg:gem/semantic_logger#lib/semantic_logger/backtrace_cleaning.rb:44 + def cleaned_lines(backtrace, cleaner); end + + # Returns [Array] a frozen copy of the lines, each a frozen copy too, which leaves the + # supplied lines, such as the exception's own, unchanged. A cleaner can return + # Thread::Backtrace::Location objects, or Strings of its own. + # + # pkg:gem/semantic_logger#lib/semantic_logger/backtrace_cleaning.rb:59 + def frozen_copy(lines); end + + # Reports an error raised by a cleaner to the internal logger, as text: given the exception + # itself, the internal logger's formatter would ask the same cleaner to clean its backtrace. + # + # pkg:gem/semantic_logger#lib/semantic_logger/backtrace_cleaning.rb:66 + def report(exception); end + end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/base.rb:8 +class SemanticLogger::Base + # Initializer for Abstract Class SemanticLogger::Base + # + # Parameters + # klass [String] + # Name of the class, module, or other identifier for which the log messages + # are being logged + # + # level [Symbol] + # Only allow log entries of this level or higher to be written to this appender + # For example if set to :warn, this appender would only log :warn and :fatal + # log messages when other appenders could be logging :info and lower + # + # filter [Regexp|Proc|Module] + # RegExp: Only include log messages where the class name matches the supplied + # regular expression. All other messages will be ignored + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false + # Module: A module that implements `.call`. For example: + # module ComplexFilter + # def self.call(log) + # (/\AExclude/ =~ log.message).nil? + # end + # end + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:306 + def initialize(klass, level = T.unsafe(nil), filter = T.unsafe(nil)); end + + # Log a thread backtrace + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:144 + def backtrace(thread: T.unsafe(nil), level: T.unsafe(nil), message: T.unsafe(nil), payload: T.unsafe(nil), metric: T.unsafe(nil), metric_amount: T.unsafe(nil)); end + + # Backward compatibility + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:141 + def benchmark(level, message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def benchmark_debug(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def benchmark_error(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def benchmark_fatal(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def benchmark_info(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def benchmark_trace(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def benchmark_warn(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def debug(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def debug?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def error(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def error?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:262 + def fast_tag(tag, &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def fatal(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def fatal?; end + + # Class name to be logged + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 + def filter; end + + # Class name to be logged + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 + def filter=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def info(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def info?; end + + # Tags permanently bound to this logger instance via `#tagged` (without a block). + # Empty for a regular (non-child) logger. + # Only assigned to when building a child logger via `#tagged` (see #tagged_child). + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:237 + def instance_named_tags; end + + # Tags permanently bound to this logger instance via `#tagged` (without a block). + # Empty for a regular (non-child) logger. + # Only assigned to when building a child logger via `#tagged` (see #tagged_child). + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:237 + def instance_tags; end + + # Returns the level set by an enclosing `#with_level` block on the current fiber, + # otherwise the level set for this instance, otherwise its fallback level (see #fallback_level). + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:33 + def level; end + + # Set the logging level for this logger + # + # Note: This level is only for this particular instance. It does not override + # the log level in any logging instance or the default log level + # SemanticLogger.default_level + # + # Must be one of the values in SemanticLogger::LEVELS, or nil to use this instance's fallback + # level (see #fallback_level). + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:20 + def level=(level); end + + # Write log data to underlying data storage + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:267 + def log(_log_); end + + # Dynamically supply the log level with every measurement call + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:131 + def measure(level, message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def measure_debug(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def measure_error(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def measure_fatal(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def measure_info(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def measure_trace(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def measure_warn(message, params = T.unsafe(nil), &block); end + + # Class name to be logged + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 + def name; end + + # Class name to be logged + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:10 + def name=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:231 + def named_tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:252 + def pop_tags(quantity = T.unsafe(nil)); end + + # Returns the list of tags pushed after flattening them out and removing blanks + # + # Note: + # - This method is slow since it needs to flatten the tags and remove empty elements + # to support Rails 4. + # - For better performance with clean tags, use `SemanticLogger.push_tags` + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:245 + def push_tags(*tags); end + + # Whether this log entry meets the criteria to be logged by this appender. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:272 + def should_log?(log); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:257 + def silence(new_level = T.unsafe(nil), &); end + + # Add the tags or named tags to the list of tags to log for this thread whilst the supplied block is active. + # + # Returns result of block. + # + # Tagged example: + # SemanticLogger.tagged(12345, 'jack') do + # logger.debug('Hello World') + # end + # + # Named Tags (Hash) example: + # SemanticLogger.tagged(tracking_number: 12345) do + # logger.debug('Hello World') + # end + # + # Notes: + # - Named tags are the recommended approach since the tag consists of a name value pair this is more useful + # than just a string value in the logs, or centralized logging system. + # - This method is slow when using multiple text tags since it needs to flatten the tags and + # remove empty elements to support Rails 4. + # - It is recommended to keep tags as a list without any empty values, or contain any child arrays. + # However, this api will convert: + # `logger.tagged([['first', nil], nil, ['more'], 'other'])` + # to: + # `logger.tagged('first', 'more', 'other')` + # - For better performance with clean tags, see `SemanticLogger.tagged`. + # + # Child logger: + # - When called *without* a block, returns a new logger instance that permanently + # carries the supplied tags ("instance tags"). Those tags are added to every log + # entry emitted by the returned logger, and _only_ that logger, even across threads. + # Unlike the block form they are not pushed onto the thread, so other loggers are + # unaffected. This is the recommended way to bind a logger to an object's identity: + # logger = SemanticLogger['Cart'].tagged(cart_id: cart.id) + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:204 + def tagged(*tags); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:227 + def tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def trace(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def trace?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def warn(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:98 + def warn?; end + + # Change the log level of this instance while the block runs, on the current fiber only. + # + # Other threads and fibers that share this instance keep logging at its own level. + # The level set with `#level=` is left untouched, so an instance that follows the + # global default level keeps following it after the block. Blocks can be nested. + # + # Matches Ruby's `Logger#with_level`, which Sidekiq calls to apply a job's `log_level`. + # Accepts the same levels as `#level=`. Returns the result of the block. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:48 + def with_level(level, &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:224 + def with_tags(*tags); end + + protected + + # Tags permanently bound to this logger instance via `#tagged` (without a block). + # Empty for a regular (non-child) logger. + # Only assigned to when building a child logger via `#tagged` (see #tagged_child). + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:279 + def instance_named_tags=(_arg0); end + + # Tags permanently bound to this logger instance via `#tagged` (without a block). + # Empty for a regular (non-child) logger. + # Only assigned to when building a child logger via `#tagged` (see #tagged_child). + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:279 + def instance_tags=(_arg0); end + + private + + # Merge the result of a logging block into the log entry. + # + # Zero-arity blocks (e.g. `logger.info { "msg" }` or a zero-arity lambda) are called without + # arguments. Lambdas enforce their arity, so yielding the log to a zero-arity lambda would + # raise ArgumentError. Blocks that accept an argument still receive the log so they can read + # or mutate it. + # + # A String result is joined to the message with Utils.join_texts, so that texts in incompatible + # encodings, such as a UTF-8 message and a binary block result, cannot make the log call raise. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:483 + def apply_block_result(log, &block); end + + # Merge this logger's instance tags into the supplied Log entry. + # + # Composition (mirrors the per-logger merge rule proposed in PR #301): + # - Positional: thread tags first, then this logger's instance tags appended. + # - Named: instance named tags merged on top of the thread named tags, so on a + # key conflict the logger's own identity wins (it is the more specific value). + # Only this logger's entries are affected; the thread context is left untouched. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:405 + def apply_instance_tags(log); end + + # Level to use when no level has been set for this instance: the global default level. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:338 + def fallback_level; end + + # Level index to use when no level has been set for this instance. Unlike + # `#fallback_level`, it honors `SemanticLogger.silence`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:344 + def fallback_level_index; end + + # Whether to log the supplied message based on the current filter if any + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:354 + def filtered?(log); end + + # Return the level index for fast comparisons, resolved in the same order as `#level`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:333 + def level_index; end + + # Log message at the specified level + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:439 + def log_internal(level, index, message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # Measure the supplied block and log the message + # + # The options can hold untrusted data, so an option with a value that is not valid for it is + # ignored (see Log.argument?) and its default is used instead. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:497 + def measure_internal(level, index, message, params); end + + # Returns the value of the measure option that is also a log argument, or nil when it is not + # supplied or its value is not valid for that argument. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:555 + def measure_option(params, key); end + + # Returns the level to silence other log messages to within a measure block, or nil when none + # is supplied or it is not a valid level. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:562 + def measure_silence_level(params); end + + # Ensure minimum log level is met + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:388 + def meets_log_level?(log); end + + # Whether the name matches the Regexp filter. A name that is not valid in its encoding, or is + # not ASCII-compatible, which matching raises for, is matched converted to valid UTF-8 (see + # Utils.encode_utf8_string), since a log call must not raise. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:363 + def name_matches_filter?(name); end + + # Build a new Log entry, layering this logger's instance tags on top of the + # context of the thread, by default the current one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:394 + def new_log(level, index = T.unsafe(nil), thread = T.unsafe(nil)); end + + # Returns a copy of this logger that permanently carries the supplied tags. + # Positional (string) and named (Hash) tags may be mixed; they are merged on + # top of any instance tags this logger already carries. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:418 + def tagged_child(tags); end + + # Whether the Regexp filter matches the name, which is valid UTF-8. A Regexp fixed to another + # encoding, such as one that holds characters outside ASCII written in a source file in + # a binary Regexp, otherwise converted, with "?" for a character the encoding does not have. A + # name that it still cannot match, such as for an encoding with no converter from UTF-8, does + # not match. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:375 + def utf8_name_matches_filter?(name); end + + # Level index set for this instance by an enclosing `#with_level` block on the current fiber. + # + # pkg:gem/semantic_logger#lib/semantic_logger/base.rb:349 + def with_level_index; end +end + +# Where a log entry was logged: the path and line of the code that made the log call, and the +# label of its frame, usually the method, such as "Order#submit". +# +# Log#assign sets it when the entry's level is at or above SemanticLogger.call_site_level. When the +# log call supplies a backtrace, the call site is its first line. Otherwise it is the first frame of +# the calling thread's stack outside Semantic Logger and SemanticLogger.call_site_skip_paths, which +# costs far less than capturing a backtrace, since only the frames up to it are read. +# +# A call site is frozen and holds only frozen Strings and an Integer, so that a log entry logged in +# another Ractor can be sent to the main one. +# +# Attributes: +# path: [String] +# The file, as in a backtrace, such as "/app/models/order.rb". +# line: [Integer] +# The line number in the file. +# label: [String|nil] +# The label of the frame, as in a backtrace. On Ruby 3.4 and later it includes the class, such +# as "Order#submit" or "Order.find_open", on Ruby 3.2 and 3.3 only the method, such as "submit". +# A block's label starts with "block in", and code outside a method has a label such as +# "
" or "". +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 +class SemanticLogger::CallSite < ::Data + # Returns [Array] the file name and line number of the call site. With short_name + # the file name has no directory, such as "order.rb". + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:225 + def file_name_and_line(short_name: T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 + def label; end + + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 + def line; end + + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 + def path; end + + # Returns [String] the call site as Ruby 3.4 and later write it in a backtrace, such as + # "/app/models/order.rb:42:in 'Order#submit'". + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:231 + def to_s; end + + # Whether the path is a String, the line an Integer, and the label a String or nil, as the + # formatters need. A call site that Semantic Logger makes always is; one that a log call supplies + # is checked, and otherwise logged as part of the payload, like any other value that is not valid + # for its argument. + # + # Like .supplied?, calls no method of the values, which can be any objects. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:219 + def well_formed?; end + + class << self + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 + def [](*_arg0); end + + # Returns [CallSite|nil] the first frame of the calling thread's stack outside Semantic Logger, Ruby's + # own methods, and SemanticLogger.call_site_skip_paths, and other than the frame of a method such + # as public_send that called the logger for it. nil when every frame is skipped. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:120 + def capture; end + + # Returns [CallSite] the call site, or the call site of a Thread::Backtrace::Location. A call site + # whose Strings are frozen is returned as it is; otherwise its Strings are copied, frozen and + # deduplicated, since the same few paths and labels are logged again and again. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:93 + def from(call_site); end + + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 + def inspect; end + + # Returns [CallSite|nil] where a log entry was logged, from what the log call supplied: + # call_site: [CallSite|Thread::Backtrace::Location|false|nil] + # The call site, or the frame it is made from. false: the entry has no call site. + # backtrace: [Array|nil] + # Without a call site, its first line is the call site. + # Without either (or with an empty backtrace), the first frame of the calling thread's stack + # outside Semantic Logger (see .capture). + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:83 + def locate(call_site: T.unsafe(nil), backtrace: T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 + def members; end + + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:23 + def new(*_arg0); end + + # Returns [CallSite|nil] the call site in a line of a backtrace, such as + # "app.rb:12:in 'Order#submit'". nil when the line is not a String with a path and line number, + # or is not text that Ruby can match, such as invalid UTF-8. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:146 + def parse(line); end + + # Whether the value can be supplied as a log entry's call site (see .locate). A value that parsed + # data, such as JSON, can hold is not, other than false, so that untrusted data cannot set the + # location of an entry. Never calls a method of the value, which can be any object in a payload. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:111 + def supplied?(value); end + + private + + # Whether the frame is that of a method such as public_send, called by the frame after it, which + # has the same path and line. Then the frame after it made the log call. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:200 + def dispatch?(location, label, caller_location); end + + # Returns [String] a frozen, deduplicated copy of the String, or the String when it is already one. + # A subclass of String is copied to a String first, since JRuby freezes it in place instead. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:103 + def frozen_copy(string); end + + # Whether a frame in the file at this path is skipped when capturing a call site. + # + # The frames of log calls come from a few files, Semantic Logger's own and the application's, so + # the answer is remembered in the cache for each path, which is faster than matching the path + # again. Without a cache, the path is matched each time. + # + # In a signal trap, the answer for a path not yet in the cache is not remembered, since writing to + # the cache locks a Mutex on CRuby, which Ruby does not allow there. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:169 + def skip?(path, skip_paths, cache); end + + # Returns [Concurrent::Map] whether each path is skipped, for these skip paths. A new one when the + # skip paths have changed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:190 + def skip_cache(skip_paths); end + + # pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:206 + def skip_path?(path, skip_paths); end + end +end + +# Labels of Ruby's methods that call a method for their caller, such as +# `logger.public_send(level, message)`, and add a frame of their own with the caller's path and +# line. +# +# CRuby 3.4 and later include the class in the label, which tells these methods apart from an +# application's own methods of the same name. JRuby, and CRuby before 3.4, do not, so there an +# application's own `call` method is also skipped when it was called from the same line of the +# same file, such as by recursion or a one-line definition. The path and line stay the same; only +# the label becomes the caller's. JRuby labels the frame "block in public_send" when it is called +# in a block. "block in call" is left out, since it is also the label of a block in an +# application's own `call` method. +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:47 +SemanticLogger::CallSite::DISPATCH_LABELS = T.let(T.unsafe(nil), Array) + +# Paths of the frames of Ruby's own methods written in Ruby, such as "", which are +# never the code that logged the entry. Which methods these are depends on the version of Ruby. +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:33 +SemanticLogger::CallSite::INTERNAL_PATH = T.let(T.unsafe(nil), String) + +# The line number and the start of the label in a backtrace line, such as ":12:in 'Order#submit'", +# or as Ruby 3.3 and earlier write it, ":12:in `submit'". Without a leading `.*`, so that matching an +# untrusted line takes linear time on every Ruby, including JRuby, which has no backtracking limits. +# A line number has at most 10 digits, since a longer one, which only a forged line has, would be +# slow to convert to an Integer and back. +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:61 +SemanticLogger::CallSite::LINE_AND_LABEL = T.let(T.unsafe(nil), Regexp) + +# A line break, which only a forged backtrace line holds. +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:69 +SemanticLogger::CallSite::LINE_BREAK = T.let(T.unsafe(nil), String) + +# The most paths whose answer .skip? remembers. +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:185 +SemanticLogger::CallSite::MAX_CACHED_PATHS = T.let(T.unsafe(nil), Integer) + +# A label's closing quote. +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:73 +SemanticLogger::CallSite::QUOTE = T.let(T.unsafe(nil), String) + +# A backtrace line without a label, such as "app.rb:12". +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:65 +SemanticLogger::CallSite::UNLABELED_LINE = T.let(T.unsafe(nil), Regexp) + +# The number of frames read from the stack at a time. Semantic Logger's own frames, which are +# skipped, are usually fewer than this. +# +# pkg:gem/semantic_logger#lib/semantic_logger/call_site.rb:28 +SemanticLogger::CallSite::WINDOW = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:4 +module SemanticLogger::Concerns; end + +# pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:6 +module SemanticLogger::Concerns::Compatibility + # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:40 + def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:32 + def close; end + + # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:36 + def reopen(logdev = T.unsafe(nil)); end + + class << self + # For compatibility with Ruby Logger only. + # + # pkg:gem/semantic_logger#lib/semantic_logger/concerns/compatibility.rb:10 + def included(base); end + end +end + +# The logging context of a fiber: its tags, named tags, and silence level. +# +# An instance is a frozen snapshot of a fiber's context, returned by SemanticLogger.context, for +# SemanticLogger.with_context to apply in another thread or fiber. It has `tags` (an Array), +# `named_tags` (a Hash), and `silence` (the level Symbol set by SemanticLogger.silence, or nil). +# +# The class methods are internal. They manage the context of the current fiber, together with the +# `with_level` overrides of its loggers, which are not part of a snapshot: like Ruby's +# Logger#with_level they apply only to the fiber that set them. Only this class knows where that +# state is kept: in fiber-local variables (`Thread.current[]`), so that every fiber, including the +# fibers of a fiber scheduler such as Async, has its own. +# +# The stored lists are never changed in place. Each change stores a new frozen list, and the block +# forms restore the previous list when the block exits. Code that copies fiber-local variables into +# another thread, such as Rails' ActionController::Live, therefore hands over lists that Semantic +# Logger never changes for the other thread. The tags in them are the caller's own objects. +# +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 +class SemanticLogger::Context < ::Data + # Parameters + # tags: [Array] + # Positional tags. + # named_tags: [Hash] + # Named tags. + # silence: [Symbol|String|Integer] + # A level accepted by SemanticLogger.silence, or nil for none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:36 + def initialize(tags: T.unsafe(nil), named_tags: T.unsafe(nil), silence: T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 + def named_tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 + def silence; end + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 + def tags; end + + # Returns [Context] a copy with the supplied members changed, checked and frozen as by .new, + # which Data#with does not call on Ruby 3.2. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:49 + def with(**changes); end + + class << self + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 + def [](*_arg0); end + + # Returns [Context] a frozen snapshot of the current fiber's context. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:59 + def current; end + + # Runs the block with the tag added to the current fiber's tags. + # + # Like every block form below, it restores the previous value when the block exits, whatever + # the block did to it. Each is written out in full, since this is on the hot path. Each reads + # the previous value before its `begin`, so that an exception raised into the thread, such as + # by Timeout, can never restore a value that was not read yet. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:103 + def fast_tag(tag); end + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 + def inspect; end + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 + def members; end + + # Runs the block with the Hash of named tags added to the current fiber's named tags. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:137 + def named_tagged(hash); end + + # Returns [Hash] a new Hash of the named tags of the thread's current fiber. + # + # Each named tags block pushes its Hash onto a list; a later Hash wins on a key that is in both. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:93 + def named_tags(thread = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:18 + def new(*_arg0); end + + # Removes the last `quantity` Hashes of named tags pushed onto the current fiber. + # Returns [Array] the Hashes removed, or nil when the fiber has no named tags. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:154 + def pop_named_tags(quantity); end + + # Removes the last `quantity` tags from the current fiber's tags. + # Returns [Array] the tags removed, or nil when the fiber has no tags. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:132 + def pop_tags(quantity); end + + # Adds the Hash of named tags to the current fiber's named tags, until it is popped. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:148 + def push_named_tags(hash); end + + # Adds the Array of tags to the current fiber's tags, until they are popped. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:126 + def push_tags(tags); end + + # Runs the block with the supplied level index as the current fiber's silence level. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:165 + def silence(index); end + + # Returns [Integer|nil] the level index set by an enclosing `silence` block on the current + # fiber, or nil when there is none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:160 + def silence_index; end + + # Runs the block with the Array of tags added to the current fiber's tags. Takes ownership of + # the Array, which it may freeze, so the caller must not keep it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:115 + def tagged(tags); end + + # Returns [Array] a new Array of the tags of the thread's current fiber. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:85 + def tags(thread = T.unsafe(nil)); end + + # Runs the block with the supplied context as the current fiber's context, in place of the + # fiber's own tags, named tags, and silence level, which are restored when the block exits. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:70 + def use(context); end + + # Runs the block with the supplied level index for the logger on the current fiber. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:182 + def with_level(logger, index); end + + # Returns [Integer|nil] the level index set for the logger by an enclosing `with_level` block + # on the current fiber, or nil when there is none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:177 + def with_level_index(logger); end + + private + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:207 + def current_named_tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:203 + def current_tags; end + + # Returns [Hash] a new Hash of the list of named tags Hashes merged, a later one winning. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:197 + def merge(list); end + + # Pops from a copy of the list under the key, as Array#pop does, and stores the copy. + # + # pkg:gem/semantic_logger#lib/semantic_logger/context.rb:212 + def pop(key, quantity); end + end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:25 +SemanticLogger::Context::EMPTY = T.let(T.unsafe(nil), Array) + +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:26 +SemanticLogger::Context::EMPTY_HASH = T.let(T.unsafe(nil), Hash) + +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:22 +SemanticLogger::Context::NAMED_TAGS_KEY = T.let(T.unsafe(nil), Symbol) + +# A context with no tags, named tags, or silence level. +# +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:54 +SemanticLogger::Context::NONE = T.let(T.unsafe(nil), SemanticLogger::Context) + +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:23 +SemanticLogger::Context::SILENCE_KEY = T.let(T.unsafe(nil), Symbol) + +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:21 +SemanticLogger::Context::TAGS_KEY = T.let(T.unsafe(nil), Symbol) + +# pkg:gem/semantic_logger#lib/semantic_logger/context.rb:24 +SemanticLogger::Context::WITH_LEVEL_KEY = T.let(T.unsafe(nil), Symbol) + +# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/warning.rb:4 +module SemanticLogger::CoreExt; end + +# Reopen all appenders in the child process after a fork. +# +# Prepended onto `Process.singleton_class` when Semantic Logger is loaded. +# Enabled by default; opt out with `SemanticLogger.reopen_on_fork = false`. +# +# `Process._fork` (Ruby 3.1+) is the method that every fork of the Ruby process +# routes through (`Kernel#fork`, `Process.fork`, and `IO.popen("-")`), so +# overriding it covers them all with one hook. `Kernel#system`, backticks, +# `spawn`, and `IO.popen` with a command do not call it: they run another +# program, which does not inherit Semantic Logger. +# +# It can also run in a signal trap, such as one that forks, where Ruby does +# not allow a Mutex to be locked: pausing the thread that receives the entries +# of other Ractors locks none, and neither does reopening in the child. In +# synchronous mode, a thread that the trap starts reopens the appenders that +# have no thread of their own (see SyncProcessor#reopen). +# +# Note: both `_fork` and `daemon` must be overridden to reliably restart the +# appender thread, since `Process.daemon` does not route through `_fork` +# (https://bugs.ruby-lang.org/issues/18911). Do not collapse this down to only +# `_fork`. +# +# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:24 +module SemanticLogger::CoreExt::Process + # `_fork` runs in both the parent and the child. It returns 0 in the child + # and the child's pid in the parent, so only reopen in the child. Reopening + # in the parent would needlessly recreate its queue and worker thread, + # risking the loss of messages still on the queue. + # + # pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:36 + def _fork; end + + # `Process.daemon` does not route through `_fork`, so reopen explicitly. Once + # it returns, the caller is running as the daemon (child) process. + # + # pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:44 + def daemon(*, **, &); end + + class << self + # Runs the block, which forks, with Semantic Logger ready for the fork: on Ruby 4.0 and later, + # while the thread that receives log entries from other Ractors is paused (see + # RactorReceiver.pause). + # + # pkg:gem/semantic_logger#lib/semantic_logger/core_ext/process.rb:28 + def pause_for_fork(&); end + end +end + +# Drops the json gem's warning about a binary String when Semantic Logger serializes log data. +# +# json 2.8.0 through 3.0.x write a binary String that holds valid UTF-8 outside ASCII as +# UTF-8, but warn "JSON.generate: UTF-8 string passed as BINARY, this will raise an encoding +# error in json 3.0" for each one, every time, at the default verbosity. Log data often holds +# such Strings: response bodies, Base64-decoded text, socket reads. The JSON is right: json 3.1 +# raises instead, and Utils.to_json then writes the same String as the same UTF-8 (see +# Utils.json_safe). So for log data the warning only reports what Semantic Logger handles. +# +# Finding the binary Strings before serializing would mean walking every log entry, which +# takes longer than serializing it, and marking each serialization would slow every entry +# too. Instead, when the warning is raised, Utils is asked whether it comes from serializing +# log data (see Utils.serializing_log_data?). Only a warning pays for that. +# +# Prepended to `Warning` when Semantic Logger is loaded on CRuby with json 2.8.0 through 3.0.x +# (see NEEDED), so that it sees the warning before a `Warning.warn` that the application +# defines on `Warning`, extends into it, or prepends to it before loading Semantic Logger. A +# module prepended afterwards, such as a test helper that raises on warnings, sees it first. +# Any other warning, and this one from anywhere else, such as the application's own JSON, is +# passed on unchanged. +# +# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/warning.rb:25 +module SemanticLogger::CoreExt::Warning + # Called by Ruby for each warning. Drops the json gem's binary String warning when it comes + # from Semantic Logger serializing log data, noting it for .unless_binary_string_warned; + # passes on every other warning. + # + # The category is passed on only to a #warn that accepts it, as Ruby itself does, so that a + # `Warning.warn(message)` of the application's own keeps working. + # + # pkg:gem/semantic_logger#lib/semantic_logger/core_ext/warning.rb:60 + def warn(message, *, **); end + + class << self + # Returns the block's result, or nil when the json gem warned about a binary String while + # it ran, for a caller that hands the data on to be serialized elsewhere and so has to repair + # it (see Utils.json_ready). + # + # pkg:gem/semantic_logger#lib/semantic_logger/core_ext/warning.rb:43 + def unless_binary_string_warned; end + end +end + +# Part of the warning, which json 2.8.0 through 3.0.x prefix with "JSON.generate: ". +# +# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/warning.rb:27 +SemanticLogger::CoreExt::Warning::BINARY_STRING = T.let(T.unsafe(nil), String) + +# Whether this json gem warns about a binary String: the C extension of json 2.8.0 through +# 3.0.x. JRuby's json, and json 3.1 and later, raise instead. +# +# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/warning.rb:31 +SemanticLogger::CoreExt::Warning::NEEDED = T.let(T.unsafe(nil), FalseClass) + +# Key of the fiber-local state of .unless_binary_string_warned: :watching while it runs, and +# :warned once the warning was dropped meanwhile. +# +# pkg:gem/semantic_logger#lib/semantic_logger/core_ext/warning.rb:38 +SemanticLogger::CoreExt::Warning::STATE = T.let(T.unsafe(nil), Symbol) + +# Custom logger that maps all calls to debug to trace calls +# This is useful for existing gems / libraries that log too much to debug +# when most of the debug logging should be at the trace level +# +# pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:5 +class SemanticLogger::DebugAsTraceLogger < ::SemanticLogger::Logger + # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:9 + def benchmark_debug(message, params = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:6 + def debug(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:7 + def debug?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/debug_as_trace_logger.rb:8 + def measure_debug(message, params = T.unsafe(nil), &block); end +end + +# Reports the use of a deprecated method or option as a Ruby deprecation warning, see `Kernel#warn`, so that Ruby +# decides whether and where it is reported, as it does for its own deprecations, rather than a setting of Semantic +# Logger: +# - Only while deprecation warnings are on, see `Warning[:deprecated]`. They are off by default, so production stays +# quiet, and on in tests run by Minitest or test-unit, or with `ruby -W:deprecated` or `RUBYOPT=-W:deprecated`. +# - Written to `$stderr`, unless the application routes them elsewhere, such as to its log, or raises them in its +# tests, by overriding `Warning.warn`. +# +# Each warning names the line of the application that used what is deprecated, rather than a line of Semantic +# Logger, of Ruby itself, or of a gem that Semantic Logger called with a block, see .application_location. +# +# Copied from IOStreams::Deprecation, so that both libraries report deprecations the same way. +# +# pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:16 +module SemanticLogger::Deprecation + class << self + # Reports that the application used something deprecated, unless deprecation warnings are off, with the message, + # which says what is deprecated and what to use instead, after "SemanticLogger: ", at the line of the application + # that used it, see .application_location, in the same form as `Kernel#warn` names the line of its caller, such as + # `config/initializers/logging.rb:12: warning: SemanticLogger: old is deprecated, use new instead`, or without a + # line when the call stack has none outside this library. + # + # Returns nil. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:56 + def warn(message); end + + # Returns [true|false] whether the message, as `Kernel#warn` passes it to `Warning.warn`, is a warning reported by + # .warn, so that an application, or its tests, can tell the deprecation warnings of Semantic Logger from the others. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:68 + def warning?(message); end + + private + + # Returns [Thread::Backtrace::Location|nil] the line of the application that used this library, or nil when the + # call stack has none outside this library. It is the first line of the call stack outside this library, other + # than: + # - A line of Ruby itself, see .ruby?, which runs on behalf of its caller, such as `Kernel#tap`, as Ruby names the + # caller of its own core methods. + # - A line of a gem that this library called with a block, which has a line of this library further out in the + # call stack. A line of a gem that called this library, such as one of Rails Semantic Logger, is the one + # returned, since it is the gem that used it. + # + # The call stack is walked outward from the caller, until the line of the application is found, rather than + # creating all of it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:83 + def application_location; end + + # Returns [true|false] whether the line of the call stack is in a file of a gem, in one of the directories of the + # installed gems. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:117 + def gem?(location, gem_dirs); end + + # Returns [true|false] whether the file of the line of the call stack is in one of the directories, by the path + # that it was loaded from, or its absolute path, which differs when the path holds a link. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:124 + def in_dirs?(location, dirs); end + + # Returns [Array] the directories of the installed gems, which Bundler can change once it is loaded. None + # in a Ractor other than the main one, see RactorSupport.other_ractor?, which cannot read the paths of RubyGems, so + # that a line of a gem is taken there as the line of the application. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:132 + def installed_gem_dirs; end + + # Returns [true|false] whether the line of the call stack is in a file of this library. Code run with `eval` has + # only the file name that it was given. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:101 + def library?(location); end + + # Returns [true|false] whether the line of the call stack is in the code of Ruby itself: a core method, see + # RUBY_PATHS, including one of JRuby, written in Java, or a file of the standard library of Ruby. + # + # pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:109 + def ruby?(location); end + end +end + +# The directory of the files of this library, whose lines are skipped when finding the line that used it. +# +# pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:18 +SemanticLogger::Deprecation::LIB_DIR = T.let(T.unsafe(nil), String) + +# The file that loads this library, whose lines are skipped too. Only the files of this library are skipped, rather +# than every file of the directory that holds them, which can hold other libraries, such as `site_ruby`, or the +# `lib` directory of an application that it is copied into. +# +# pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:24 +SemanticLogger::Deprecation::LIB_FILE = T.let(T.unsafe(nil), String) + +# The text that each warning starts with, after the location of the line that used what is deprecated. +# +# pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:28 +SemanticLogger::Deprecation::PREFIX = T.let(T.unsafe(nil), String) + +# The directory of the standard library of Ruby. +# +# pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:46 +SemanticLogger::Deprecation::RUBY_LIB_DIRS = T.let(T.unsafe(nil), Array) + +# The start of the paths of the code of Ruby itself, rather than of a file of it: the core methods that CRuby +# writes in Ruby, such as `Kernel#tap`, and the files of JRuby itself, when it is loaded from its jar. Only those +# of JRuby's own home and its own Ruby code in the jar, such as the block that `java_import` calls, since an +# application packaged in a jar, such as with Warbler, is loaded from it too. Shareable, so that a Ractor other +# than the main one can report a deprecation. +# +# pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:40 +SemanticLogger::Deprecation::RUBY_PATHS = T.let(T.unsafe(nil), Array) + +# A warning reported by .warn, as `Kernel#warn` passes it to `Warning.warn`, see .warning?. +# +# pkg:gem/semantic_logger#lib/semantic_logger/deprecation.rb:32 +SemanticLogger::Deprecation::WARNING = T.let(T.unsafe(nil), Regexp) + +# Separates the detail that Ruby's Exception#detailed_message adds to an exception's message, +# such as did_you_mean suggestions or error_highlight's source snippet, from the message itself. +# +# Internal: Log caches the result for each of its exceptions; see Log#exception_details. +# +# pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:6 +module SemanticLogger::ExceptionDetails + class << self + # Returns [String] the detail that #detailed_message adds to the exception's message, without + # the class name that Ruby also adds, or nil when there is none or it cannot be separated. + # + # Never raises, so that an exception's own #detailed_message cannot stop a log entry being + # written, nor its #message, which Ruby's #detailed_message calls: as Utils.exception_message, + # that includes a ScriptError, such as the NotImplementedError of an abstract #message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:17 + def extract(exception, source: T.unsafe(nil)); end + + private + + # Whether error_highlight adds a source snippet to this exception's #detailed_message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:46 + def error_highlighted?(exception); end + + # Returns [String] the exception's #detailed_message, with or without error_highlight's + # source snippet, or nil when the snippet cannot be left out. + # + # pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:33 + def full_detailed_message(exception, source); end + end +end + +# Ruby's own Exception#detailed_message: the message, decorated with the class name. +# +# pkg:gem/semantic_logger#lib/semantic_logger/exception_details.rb:8 +SemanticLogger::ExceptionDetails::DETAILED_MESSAGE = T.let(T.unsafe(nil), UnboundMethod) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters.rb:2 +module SemanticLogger::Formatters + class << self + # Return formatter that responds to call. + # + # Supports formatter supplied as: + # - Symbol + # - Hash ( Symbol => { options }) + # - Instance of any of SemanticLogger::Formatters + # - Proc + # - Any object that responds to :call + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters.rb:29 + def factory(formatter); end + end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:4 +class SemanticLogger::Formatters::Base + # Parameters + # time_format: [String|Symbol|nil] + # See Time#strftime for the format of this string. + # :iso_8601 Outputs an ISO8601 Formatted timestamp. + # :ms Output in miliseconds since epoch. + # :notime Returns an empty string for time ( no time is output ). + # Default: '%Y-%m-%d %H:%M:%S.%N' + # log_host: [Boolean] + # Whether or not to include hostname in logs + # Default: true + # log_application: [Boolean] + # Whether or not to include application name in logs + # Default: true + # precision: [Integer] + # How many fractional digits to log times with. + # Default: PRECISION (6, except on older JRuby, where 3) + # escape_control_chars: [Boolean] + # Replace control characters (newlines, the ANSI escape, etc., and the Unicode + # characters that control how text is shown, such as U+2028 and U+202E) in + # untrusted log data (logger name, thread name, message, payload, tags, + # named tags, and the message and backtrace lines of the exception and + # of each exception that caused it) with a printable escaped form, e.g. "\n". + # This prevents log forging and terminal escape-sequence injection + # when logging data that may contain attacker-controlled content. + # Note: Has no effect on structured formatters such as :json, which + # already escape control characters via JSON encoding, except that + # :loki and :open_telemetry, which write the exception's stack trace + # as text, escape its backtrace lines and the messages of its causes. + # Default: false (preserve newlines and ANSI colors in text output) + # log_exception_details: [true|false|:with_source] + # Whether to log the detail that Ruby's Exception#detailed_message adds to an + # exception's message, such as did_you_mean suggestions ("Did you mean? upcase") or + # the detail an exception class supplies by overriding #detailed_message. + # :with_source also logs error_highlight's snippet of the failing source line. It is + # about 100 times slower, since it re-parses that source file, and it copies source + # code into the log. + # On Ruby 3.2 a NameError or NoMethodError builds its message from receiver.inspect each + # time it is asked, and logging the details asks for it twice more, so turn this off when + # inspecting the receivers of logged exceptions is slow. + # Default: true for the Default, Color, and Pattern text formatters, false otherwise. + # backtrace_cleaner: [true|false|Object] + # Cleans the backtrace of the logged exception, and of each exception that caused it, + # before it is written, leaving out or shortening lines. Only this formatter's output + # changes: the exceptions are not. + # true: Use the application's cleaner, SemanticLogger.backtrace_cleaner, when one is set. + # false: Write the full backtrace. + # Or a cleaner of this formatter's own, which responds to `#clean` or `#call` (see + # SemanticLogger.backtrace_cleaner=). + # Default: true for the text formatters (Default and those built on it) and the Json + # formatters, false otherwise. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:96 + def initialize(time_format: T.unsafe(nil), log_host: T.unsafe(nil), log_application: T.unsafe(nil), log_environment: T.unsafe(nil), precision: T.unsafe(nil), escape_control_chars: T.unsafe(nil), log_exception_details: T.unsafe(nil), backtrace_cleaner: T.unsafe(nil)); end + + # Returns [true|false|Object] the `backtrace_cleaner` option. See #initialize. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:127 + def backtrace_cleaner; end + + # Sets the `backtrace_cleaner` option. See #initialize. + # Raises ArgumentError for any other value, so that a mistake surfaces here rather than on + # every log entry. + # + # Compared by identity, since a cleaner, such as a test double, need not define #== or #nil?. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:134 + def backtrace_cleaner=(cleaner); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def escape_control_chars; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def escape_control_chars=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_application; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_application=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_environment; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_environment=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_exception_details; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_exception_details=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_host; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def log_host=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def logger; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def logger=(_arg0); end + + # Process ID + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:158 + def pid; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def precision; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:5 + def precision=(_arg0); end + + # Date & time + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:153 + def time; end + + # Returns [String|Symbol] the `time_format` option. See #initialize. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:115 + def time_format; end + + # Sets the `time_format` option. See #initialize. + # + # A format String is converted once, here, as #joinable_text converts the formatter's own + # text: a format with characters outside ASCII in another encoding, such as ISO-8859-1, could + # not otherwise be joined with the entry's other text. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:122 + def time_format=(time_format); end + + private + + # Returns the backtrace cleaner to use for this log entry, or nil when backtraces are written + # in full. + # + # The application's cleaner is looked up for each entry, rather than when this formatter is + # built, so that it can be set after the appenders are added. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:229 + def active_backtrace_cleaner; end + + # Whether this formatter uses the application's backtrace cleaner unless told otherwise. + # See #initialize. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:220 + def default_backtrace_cleaner; end + + # Whether this formatter logs exception details unless told otherwise. See #initialize. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:214 + def default_log_exception_details; end + + # When `escape_control_chars` is enabled, return a copy of the supplied + # value with any control characters replaced by a printable escaped form + # so that untrusted log data cannot forge log entries or inject terminal + # escape sequences. + # + # Note: This escapes (preserves) control characters, and is opt-in. It is + # distinct from Log#cleansed_message, which unconditionally *strips* ANSI + # colorization from the message for structured (JSON/Loki) output. + # + # A string with invalid byte sequences, for example an exception message that quotes + # untrusted binary input, or in another encoding, is first converted to valid UTF-8 + # (dropping the invalid bytes), since matching against it would raise and the log entry + # would be lost. + # + # Otherwise the value is returned unchanged, unless it is a String that cannot be joined with + # UTF-8 text: one that holds bytes outside ASCII in another encoding, such as a binary + # response body or ISO-8859-1 text, or that is not ASCII-compatible, such as UTF-16. Joining + # it with the entry's other text, such as an accented logger name, would raise and lose the + # entry, so it is converted to valid UTF-8 (see Utils.encode_utf8_string), and this + # formatter's output is UTF-8. A String tagged UTF-8 that holds invalid bytes joins with + # UTF-8 text, so it is still written as it is. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:185 + def escape_control_characters(value); end + + # Returns [String] the backtrace of the logged exception, followed by each exception + # that caused it, as laid out by Log#backtrace_to_s, and cleaned by the backtrace cleaner + # (see #initialize). + # + # When `escape_control_chars` is enabled, the message of each cause and each backtrace + # line is passed through #escape_control_characters, the same as the message of the + # logged exception: causes are often parser or validation errors that quote untrusted + # input, and a backtrace can be set from untrusted data. + # + # Otherwise they are written as they are, unless the text cannot be joined with UTF-8 text, + # such as when a cause's message is ISO-8859-1 text: then each is converted as + # #escape_control_characters converts the other fields. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:256 + def exception_backtrace; end + + # Returns [String] the detail Ruby adds to the message of the supplied exception (see + # Log#exception_details), or nil when there is none or this formatter does not log it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:238 + def exception_details_for(exception); end + + # Return the Time as a formatted string + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:277 + def format_time(time); end + + # Returns [String] the backtrace as Log#backtrace_to_s writes it, or nil when that text + # cannot be joined with UTF-8 text (see #escape_control_characters). + # + # The text is checked once, rather than each of what is usually dozens of lines, which + # would double the time it takes to format an exception. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:271 + def joinable_backtrace(cleaner); end + + # Returns the value as text that can be joined with this formatter's UTF-8 output: a String + # that holds bytes outside ASCII in another encoding converted to UTF-8 (see + # Utils.encode_utf8_string), and anything else as it is, including a UTF-8 String that holds + # invalid bytes. For the formatter's own text, such as its time format, which is not escaped. + # #escape_control_characters applies the same rule to the entry's fields. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:207 + def joinable_text(value); end + + class << self + # Return default time format string + # + # Parameters + # precision: [Integer] + # How many fractional digits to log times with. + # Default: PRECISION (6, except on older JRuby, where 3) + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:148 + def build_time_format(precision = T.unsafe(nil)); end + end +end + +# Matches C0 control characters (including newlines and the ANSI escape) and DEL. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:22 +SemanticLogger::Formatters::Base::CONTROL_CHARS = T.let(T.unsafe(nil), Regexp) + +# Printable escapes for the most common control characters. Any other ASCII +# control character is escaped to its hexadecimal `\xHH` form by +# #escape_control_characters, and a Unicode one (see UNICODE_CONTROL_CHARS) +# to its `\uXXXX` form. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:12 +SemanticLogger::Formatters::Base::CONTROL_CHAR_ESCAPES = T.let(T.unsafe(nil), Hash) + +# Time precision varies by Ruby interpreter +# JRuby 9.1.8.0 supports microseconds +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:34 +SemanticLogger::Formatters::Base::PRECISION = T.let(T.unsafe(nil), Integer) + +# Matches the characters of CONTROL_CHARS, and the Unicode characters that control how text +# is shown: the C1 control characters (U+0080 to U+009F, including the next line U+0085), +# which some terminals act on, the line and paragraph separators (U+2028, U+2029), at which +# editors, browsers, and some log viewers start a new line, and the bidirectional controls +# (U+202A to U+202E, U+2066 to U+2069), which can make logged text read in a different order +# than it was written. Escaped in the `\uXXXX` form. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/base.rb:30 +SemanticLogger::Formatters::Base::UNICODE_CONTROL_CHARS = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:14 +class SemanticLogger::Formatters::Color < ::SemanticLogger::Formatters::Default + # Adds color to the default log formatter + # + # Example: + # # Use a colorized output logger. + # SemanticLogger.add_appender(io: $stdout, formatter: :color) + # + # Example: + # # Use a colorized output logger changing the color for info to yellow. + # SemanticLogger.add_appender(io: $stdout, formatter: {color: {color_map: {info: SemanticLogger::AnsiColors::YELLOW}}}) + # + # Example: + # # Override the Awesome Print options to output hashes over multiple lines: + # SemanticLogger.add_appender(io: $stdout, formatter: {color: {ap: {multiline: true}}}) + # + # # Calling the appender added above: + # SemanticLogger['Test'].info('hi', {a: 1, b: 2}) + # => true + # => 2019-02-12 11:47:50.794339 I [35832:70112015269920] Test -- hi -- { + # :a => 1, + # :b => 2 + # } + # + # Parameters: + # ap: [Hash] + # Any valid Amazing Print option for rendering data. + # These options can also be changed be creating a `~/.aprc` file. + # See: https://github.com/amazing-print/amazing_print + # + # Note: The option :multiline is set to false if not supplied. + # Note: Has no effect if Awesome Print is not installed. + # Note: With `escape_control_chars: true` the payload is always rendered plain + # (without colors) and on a single line, then escaped. + # + # color_map: [Hash | SemanticLogger::Formatters::Color::ColorMap] + # ColorMaps each of the log levels to a color + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:79 + def initialize(ap: T.unsafe(nil), color_map: T.unsafe(nil), **args); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:138 + def call(log, logger); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 + def color; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 + def color=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 + def color_map; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:15 + def color_map=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:108 + def duration; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:130 + def exception; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:85 + def level; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:112 + def name; end + + # Named Tags + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:97 + def named_tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:116 + def payload; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:89 + def tags; end + + private + + # Returns [Hash] the Amazing Print options to render the payload with. + # + # When `escape_control_chars` is enabled the payload is rendered plain, on one line: + # the colors and line breaks Amazing Print adds cannot be told apart from control + # characters in the data (for example an object whose #inspect returns them), and + # escaping them all leaves no colors or line breaks to keep. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:151 + def ai_options; end +end + +# Supply a custom color map for every log level +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:18 +class SemanticLogger::Formatters::Color::ColorMap + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:21 + def initialize(trace: T.unsafe(nil), debug: T.unsafe(nil), info: T.unsafe(nil), warn: T.unsafe(nil), error: T.unsafe(nil), fatal: T.unsafe(nil), bold: T.unsafe(nil), clear: T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:39 + def [](level); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def bold; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def bold=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def clear; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def clear=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def debug; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def debug=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def error; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def error=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def fatal; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def fatal=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def info; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def info=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def trace; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def trace=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def warn; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/color.rb:19 + def warn=(_arg0); end +end + +# Default non-colored text log output +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:4 +class SemanticLogger::Formatters::Default < ::SemanticLogger::Formatters::Base + # Default text log format + # Generates logs of the form: + # 2011-07-19 14:36:15.660235 D [1149:ScriptThreadProcess] Rails -- Hello World + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:106 + def call(log, logger); end + + # Duration + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:67 + def duration; end + + # Exception + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:90 + def exception; end + + # The detail Ruby adds to the exception's message, such as did_you_mean suggestions. + # See Base#initialize for the `log_exception_details` option. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:99 + def exception_details; end + + # Ruby file name and line number that logged the message, followed by the method when the + # entry has a call site (see SemanticLogger.call_site_level), such as "order.rb:42 Order#submit". + # + # The file name is escaped like the other fields, since it comes from the first line of the + # backtrace, which a log call can supply from untrusted data. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:24 + def file_name_and_line; end + + # Log level + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:9 + def level; end + + # Log message + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:77 + def message; end + + # The method that logged the message, such as "Order#submit", when the entry has a call site. + # Escaped like the file name, which it comes from. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:34 + def method_name; end + + # Class / app name + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:72 + def name; end + + # Named Tags + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:55 + def named_tags; end + + # Payload + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:82 + def payload; end + + # Returns [String] the available process info + # Example: + # [18934:thread_name test_logging.rb:51] + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:41 + def process_info; end + + # Tags + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:48 + def tags; end + + # Name of the thread that logged the message, shortened before it is escaped, so that an + # escape is never cut in two. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:15 + def thread_name; end + + private + + # Text output is read by people, who are best served by the frames of their own code. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:134 + def default_backtrace_cleaner; end + + # Text output is read by people, who benefit most from exception details. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:129 + def default_log_exception_details; end + + # Returns [String] the exception details and backtrace that follow the exception line, each + # starting on a new line. Empty when there are neither, such as for an exception that was + # never raised, so that no blank line follows the exception. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:124 + def exception_detail_lines; end + + # Returns [String] the name of the thread, shortened to 30 characters. A name that holds bytes + # outside ASCII in another encoding, such as a binary name that holds UTF-8, is converted + # first (see #joinable_text), so that it is shortened by characters, rather than by bytes, + # which would split a character in two. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/default.rb:119 + def shortened_thread_name; end +end + +# Formatter conforming to the Elastic Common Schema (ECS). +# +# Emits log events using the nested field names defined by ECS so that they +# integrate cleanly with Filebeat and the Elastic stack (Elasticsearch, +# Kibana) without requiring an ingest pipeline to rename fields. +# +# Usage: +# SemanticLogger.add_appender(io: $stdout, formatter: :ecs) +# +# # Route the payload, metric, and other SemanticLogger-specific data into +# # a custom top-level namespace (default "semantic_logger"): +# SemanticLogger.add_appender(io: $stdout, formatter: {ecs: {namespace: "my_app"}}) +# +# # Or merge the payload directly into ECS `labels` instead of a namespace: +# SemanticLogger.add_appender(io: $stdout, formatter: {ecs: {namespace: nil}}) +# +# == Field mapping (SemanticLogger -> ECS 8.x) +# time -> @timestamp (ISO-8601) +# level -> log.level +# name -> log.logger +# file_name / line -> log.origin.file.name / log.origin.file.line +# method -> log.origin.function +# message -> message +# thread_name -> process.thread.name +# pid -> process.pid +# host -> host.hostname +# application -> service.name +# environment -> service.environment +# exception -> error.type / error.message / error.stack_trace +# duration -> event.duration (nanoseconds, as required by ECS) +# tags -> tags (ECS top-level array) +# named_tags -> labels.* (scalar key/value pairs) +# payload -> .* (or labels.* when namespace is nil) +# metric/metric_amount -> .metric / .metric_amount +# dimensions -> .dimensions +# +# == Reference +# * https://www.elastic.co/docs/reference/ecs +# * https://www.elastic.co/docs/reference/ecs/ecs-custom-fields-in-ecs +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:43 +class SemanticLogger::Formatters::Ecs < ::SemanticLogger::Formatters::Raw + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:55 + def initialize(namespace: T.unsafe(nil), time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end + + # Returns a batch of log events as a single JSON array. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:68 + def batch(logs, logger); end + + # Returns the log event as a single line of ECS-formatted JSON, so it can + # be written to stdout / a file and shipped by Filebeat or Elastic Agent. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:63 + def call(log, logger); end + + # namespace: [String|Symbol|nil] + # Top-level field set used to hold SemanticLogger-specific data that has + # no native ECS home (payload, metric, metric_amount, dimensions). A proper-noun + # namespace is guaranteed never to collide with a current or future ECS + # field. Set to nil to merge the payload into ECS `labels` instead. + # Default: "semantic_logger" + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:53 + def namespace; end + + private + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:127 + def add_error(result, hash); end + + # ECS event.duration is measured in nanoseconds. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:121 + def add_event(result, hash); end + + # Place SemanticLogger-specific data (payload, metric, dimensions) that has no native + # ECS home into the configured namespace, plus named_tags into labels. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:139 + def add_extras(result, hash); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:112 + def add_origin(result, hash); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:105 + def add_service(result, hash); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:88 + def base(hash); end + + # Remap the flat hash built by Raw#call into the nested ECS field layout. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:75 + def ecs_hash(hash); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:99 + def process(hash); end +end + +# ECS version this formatter targets. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/ecs.rb:45 +SemanticLogger::Formatters::Ecs::ECS_VERSION = T.let(T.unsafe(nil), String) + +# Fluentd is similar to SemanticLogger::Formatters::Json but with log levels that are recognized +# by kubernetes fluentd. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:7 +class SemanticLogger::Formatters::Fluentd < ::SemanticLogger::Formatters::Json + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:10 + def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), need_process_info: T.unsafe(nil), log_host: T.unsafe(nil), **args); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:32 + def file_name_and_line; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:15 + def level; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:8 + def need_process_info; end + + # Ignore process fields: pid, thread, file and line by default. + # These are rarely useful under Fluentd (e.g. containerized processes + # usually have pid 1), so they are only included when explicitly requested + # via `need_process_info: true`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:24 + def pid; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/fluentd.rb:28 + def thread_name; end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:4 +class SemanticLogger::Formatters::Json < ::SemanticLogger::Formatters::Raw + # Default JSON time format is ISO8601 + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:6 + def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end + + # Returns a batch of log messages as a single JSON array. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:16 + def batch(logs, logger); end + + # Returns log messages in JSON format + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:11 + def call(log, logger); end + + private + + # Cleans backtraces with the application's cleaner, as the text formatters do. Error services + # receive the exception itself rather than this output, and the formatters written for a + # particular service, such as Ecs, are not built on this one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/json.rb:25 + def default_backtrace_cleaner; end +end + +# Produces logfmt formatted messages +# +# The following fields are extracted from the raw log and included in the formatted message: +# :timestamp, :level, :name, :message, :duration, :tags, :named_tags +# +# E.g. +# timestamp="2020-07-20T08:32:05.375276Z" level=info name="DefaultTest" base="breakfast" +# spaces="second breakfast" double_quotes="\"elevensies\"" single_quotes="'lunch'" tag="success" +# +# All timestamps are ISO8601 formatteed +# All user supplied values are escaped and surrounded by double quotes to avoid ambiguious message delimeters +# `tags` are treated as keys with boolean values. +# In every key (tags, named tags, payload), spaces, control and format characters, `=`, and `"` +# are replaced with `_`, so that untrusted data cannot inject fields or lines, or disguise a key. +# `tags`, `named_tags`, and `payload` are flattened into the top level fields. A key named like +# one of the entry's own fields (the time key, `level`, `name`, `message`, `duration`, +# `duration_ms`, `tag`) or an exception field is prefixed with its source, as in `payload.level`, +# so that logged data cannot replace those fields. So is a key that starts with `tags.`, +# `named_tags.`, or `payload.`, so that it cannot forge another source's field. Other keys that +# are the same once encoded, such as `:user` and `"user"`, or `"a b"` and `"a=b"`, are written +# once, with the value from the later source: `payload` values take precedence over +# `named_tags`, and `named_tags` over `tags`. +# An exception is emitted as `exception_name`, `exception_message`, `stack_trace`, and `cause`, +# and with `log_exception_details` also `exception_details`. +# +# Futher Reading https://brandur.org/logfmt +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:31 +class SemanticLogger::Formatters::Logfmt < ::SemanticLogger::Formatters::Raw + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:72 + def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:83 + def call(log, logger); end + + # Also writes and reserves the new time key in place of the old one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:78 + def time_key=(time_key); end + + private + + # Adds a field from logged data, under the name returned by #field_name. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:130 + def add_field(prefix, key, value); end + + # Returns [String] the logfmt name of a key from logged data: the key encoded by #logfmt_key, + # prefixed with its source, as in "payload.level", when it names one of the entry's own fields + # or starts with a source's prefix, so that untrusted data cannot replace or forge that field, + # or a field from another source. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:139 + def field_name(prefix, key); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:155 + def flatten_log; end + + # Integers, true, false, and nil have a single JSON form, so they skip the cost of `to_json`. + # Strings, the most common values, are checked first. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:166 + def format_value(value); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:122 + def handle_exception; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:109 + def handle_payload; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:104 + def handle_tags; end + + # Returns [String] the key as valid UTF-8, with every character that would break the logfmt + # structure replaced by an underscore. Keys come from tags, named tags, and payloads, which + # can hold untrusted data; unescaped, they could inject fields or forge an entire line. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:201 + def logfmt_key(key); end + + # Names the entry's own fields from the time key, and reserves those names and the + # exception's, so that logged data cannot use them. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:184 + def name_entry_fields; end + + # Whether the name is already a valid logfmt key, made of ASCII characters that are all safe. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:194 + def plain_name?(name); end + + # @parsed maps the logfmt name of each field to its value. Logged data is added after the + # entry's own fields, and a field with the same name as an earlier one replaces its value, so + # the payload takes precedence over named tags, and named tags over tags. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:94 + def raw_to_logfmt; end + + # Remembers the name of a Symbol key that is not reserved, while there is room. The cache is + # replaced rather than updated, since a formatter can be shared by several threads. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:150 + def remember_symbol(symbol, name); end +end + +# The entry's own fields in the Raw hash, written in this order after the time key. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:33 +SemanticLogger::Formatters::Logfmt::ENTRY_FIELDS = T.let(T.unsafe(nil), Array) + +# The exception's fields in the Raw hash, mapped to their logfmt names, so that the exception's +# name and message do not replace the entry's own. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:40 +SemanticLogger::Formatters::Logfmt::EXCEPTION_FIELDS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:53 +SemanticLogger::Formatters::Logfmt::NAMED_TAGS_PREFIX = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:54 +SemanticLogger::Formatters::Logfmt::PAYLOAD_PREFIX = T.let(T.unsafe(nil), String) + +# The most Symbol keys to remember the names of, so that untrusted keys cannot grow the cache +# without bound. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:70 +SemanticLogger::Formatters::Logfmt::PLAIN_SYMBOL_CACHE_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:55 +SemanticLogger::Formatters::Logfmt::SOURCE_PREFIXES = T.let(T.unsafe(nil), Array) + +# Prefixes that mark a key from logged data with its source, when the key alone would name +# one of the entry's own fields, or look like a key marked this way. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:52 +SemanticLogger::Formatters::Logfmt::TAGS_PREFIX = T.let(T.unsafe(nil), String) + +# The field that tells an entry with an exception from one without. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:36 +SemanticLogger::Formatters::Logfmt::TAG_FIELD = T.let(T.unsafe(nil), String) + +# The ASCII subset of UNSAFE_KEY_CHARS, which is much faster to match against the ASCII keys +# that make up nearly every log event. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:66 +SemanticLogger::Formatters::Logfmt::UNSAFE_ASCII_KEY_CHARS = T.let(T.unsafe(nil), Regexp) + +# Characters that cannot appear in a logfmt key: spaces and control characters (including +# NEL), which would end the key or the line, the `=` and `"` delimiters, LINE SEPARATOR and +# PARAGRAPH SEPARATOR, which some readers treat as newlines, and the invisible format +# characters, such as ZERO WIDTH SPACE and RIGHT-TO-LEFT OVERRIDE, which would let a key pass +# for another one, such as "level" followed by a ZERO WIDTH SPACE for "level". +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/logfmt.rb:62 +SemanticLogger::Formatters::Logfmt::UNSAFE_KEY_CHARS = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:3 +class SemanticLogger::Formatters::Loki < ::SemanticLogger::Formatters::Base + # Parameters + # structured_metadata: [Array] + # The labels to write to the structured metadata instead, as Strings: `:pid`, the process + # id, `:thread`, the thread name, both, or neither. Loki advises against labels like these, + # whose values are many and change: each process, and each of its threads, adds a stream, + # which Loki indexes and stores apart. As structured metadata, a query can still filter on + # them, as in `{application="shop"} | thread="worker-1"`. Their names are then among this + # formatter's own: a payload key of that name is written with PAYLOAD_PREFIX, as a key + # named like one of its other fields is, and a named tag or context key of that name is + # written as a label with a number, as in `thread_2`, since Loki would show the structured + # metadata as `thread_extracted` beside a label of its name. + # Structured metadata needs a Loki that accepts it, with schema v13 and + # `allow_structured_metadata`, which is on by default since Loki 3.0. Any other Loki + # rejects each entry that has structured metadata, which with `:pid` is every entry. + # Default: neither, so that both are labels, with a deprecation warning, since Semantic + # Logger v6 writes both to the structured metadata by default. Supply [] to keep both as + # labels without it. + # + # max_label_names_per_series: [Integer] + # The most labels that Loki accepts for a stream. Loki rejects the whole push, with every + # entry in it, for a stream with more, so a label past it, in the order they are written + # (see #build_stream), is written to the structured metadata instead. + # Default: 15, as Loki's `max_label_names_per_series` + # max_label_name_length: [Integer] + # The longest label name, in bytes, that Loki accepts. A label with a longer name is + # written to the structured metadata instead. + # Default: 1024, as Loki's `max_label_name_length` + # max_label_value_length: [Integer] + # The longest label value, in bytes, that Loki accepts. A label with a longer value, such as + # many tags, is written to the structured metadata instead. + # Default: 2048, as Loki's `max_label_value_length` + # + # Set each limit, an Integer of 1 or more, to the limit of the same name in the + # `limits_config` of a Loki tenant that raises it. + # + # See Formatters::Base for the other options. + # + # The instance variables that are not options are named for Loki, as in @loki_pid_label, so + # that they are not names that a subclass may already use for its own. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:105 + def initialize(structured_metadata: T.unsafe(nil), max_label_names_per_series: T.unsafe(nil), max_label_name_length: T.unsafe(nil), max_label_value_length: T.unsafe(nil), **args); end + + # Returns [String] a JSON batch of logs + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:167 + def batch(logs, logger); end + + # Returns [String] a single JSON log + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:159 + def call(log, logger); end + + # The most labels that Loki accepts for a stream, its `max_label_names_per_series`, the + # longest label name, its `max_label_name_length`, and the longest label value, its + # `max_label_value_length`, in bytes, unless a Loki tenant's `limits_config` raises them. See + # #initialize. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:60 + def max_label_name_length; end + + # The most labels that Loki accepts for a stream, its `max_label_names_per_series`, the + # longest label name, its `max_label_name_length`, and the longest label value, its + # `max_label_value_length`, in bytes, unless a Loki tenant's `limits_config` raises them. See + # #initialize. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:60 + def max_label_names_per_series; end + + # The most labels that Loki accepts for a stream, its `max_label_names_per_series`, the + # longest label name, its `max_label_name_length`, and the longest label value, its + # `max_label_value_length`, in bytes, unless a Loki tenant's `limits_config` raises them. See + # #initialize. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:60 + def max_label_value_length; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:7 + def payload_value; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:7 + def payload_value=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:7 + def stream; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:7 + def stream=(_arg0); end + + # The labels that are written to the structured metadata instead (see #initialize): a frozen + # Array of :pid, :thread, both, or neither. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:64 + def structured_metadata; end + + private + + # Adds each of the payload's keys named like this formatter's own, or without an ASCII letter + # or digit, with PAYLOAD_PREFIX, under the name Loki stores it as (see #loki_name), such as + # `payload_metric_value` for `metric.value`, and `payload_` for an empty key or `-`, and with + # the prefix again while another key has that name once Loki has stored it. Loki keeps only + # one value of the names that it stores alike, so this keeps the value of each of these keys. + # Other payload keys that Loki stores alike, such as `a.b` and `a_b`, still keep only one. + # + # A key that is exactly one of this formatter's own names, OWN_KEYS and those that + # structured_metadata names, is named first, so that `payload_metric_value` holds the + # payload's `metric_value`, whatever the order of the keys, and `metric.value` is prefixed + # again. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:460 + def add_prefixed(metadata, prefixed); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:252 + def application; end + + # The labels are written in this order: this formatter's own (pid, application, environment, + # host, level, thread, and tags, without those that structured_metadata names), each named + # tag, and each value of the context, under their own names, and then each named tag and + # context key whose name another label has, or that Loki does not accept, or that + # structured_metadata names, under another name, or not at all (see Labels#add). So every + # label written under its own name keeps it. Their names are Strings, so that a named tag or + # context key, whether a Symbol or a String, is found among them by name, as Loki finds it. + # The labels past Loki's limits are then taken out and written to the structured metadata + # (see #finish_loki_stream). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:225 + def build_stream; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:279 + def context; end + + # Whether the stream that #build_stream returned has the current stream's labels, a Hash, + # which a subclass's own stream may not, such as one under String keys. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:202 + def current_labels?(built); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:389 + def duration; end + + # Returns [Hash|nil] the structured metadata of the entry of the stream that #build_stream + # returned, the third of its values: payload_value, unless a subclass wrote a copy of it, as + # in `payload_value.merge(...)`, or nil when it wrote none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:210 + def entry_metadata(built); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:256 + def environment; end + + # The stack trace is one line per frame, followed by each exception that caused it, as the + # text formatters write it. + # + # The exception is named as Utils.exception_name names it, as every formatter does: as Ruby + # names its class, without asking the class, such as `#` for an anonymous class, + # which has no name. Its message is read with Utils.exception_message, so that a #message that + # raises, or does not return a String, cannot lose the entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:411 + def exception; end + + # Finishes the current stream: finishes its labels (see Labels#finish), which writes the + # named tags and context keys whose names are taken, reserved, or replaced, and takes out the + # labels past Loki's limits; then writes the process id and the thread name to the structured + # metadata, the supplied Hash, when structured_metadata names them (see + # #write_pid_and_thread), and after them, the labels taken out (see #write_moved_labels). + # + # When a subclass's own #build_stream writes no structured metadata, so that there is none + # (see #loki_stream), there is nowhere to write them, so the labels past the limits, and the + # process id and thread name, are left out, rather than having Loki reject the push. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:314 + def finish_loki_stream(metadata = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:362 + def format_time(log); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:248 + def host; end + + # Returns [Integer] the supplied limit (see #initialize). + # Raises ArgumentError for any value other than an Integer of 1 or more, so that a mistake + # surfaces here rather than on every log entry. A limit of 0 would leave every stream without a + # label, which Loki stores as the one stream `service_name="unknown_service"`, or rejects when + # it does not add `service_name`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:542 + def label_limit(option, value); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:260 + def level; end + + # Returns [Labels] the labels of the current stream, to which the named tags and the context + # are added, created for it unless they are already its labels. So a subclass whose own + # #build_stream does not create them, as in v5.2, still adds the named tags and the context. + # Each label value is converted by #loki_value, so a subclass that overrides it converts the + # labels' values too. This formatter's own methods write every label under a String, while a + # subclass's may write one under a Symbol, as v5.2 did, so only a subclass's labels are told + # that they may have a Symbol name (see Labels#initialize). + # + # This method and its instance variables are named for Loki, so that they are not names that + # a subclass may already use for its own, such as #labels or @labels. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:296 + def loki_labels; end + + # Returns [String] the name that Loki stores structured metadata of the supplied name under + # (see .loki_name). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:483 + def loki_name(name); end + + # Returns [Hash] the stream of the current log entry, which #build_stream builds. + # + # A subclass that overrides #build_stream without calling super, as one written for v5.2 + # may, does not finish the stream's labels, so they are finished here (see + # #finish_loki_stream) when the stream it returns has the current stream's labels. So it + # still writes each named tag and context key whose name is taken, reserved, or replaced, + # writes the process id and the thread name to the structured metadata when + # structured_metadata names them, and moves the labels past Loki's limits. The labels are + # finished again when a subclass added one after its #build_stream called super (see + # Labels#finished?), such as one under a Symbol whose name another label has. The structured + # metadata written is that of the entry it returns (see #entry_metadata). A formatter of + # this class itself finishes them in #build_stream, and so skips this. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:192 + def loki_stream; end + + # Returns [String] the value as Loki accepts it, as both the labels (see #loki_labels) and + # the structured metadata write it. + # + # A structure is written once, as JSON, depth-limited and repaired by Utils.to_json. + # Encoding each nested level into a String that the next level encodes again doubled the + # escaping at every level, so a request parameter 30 levels deep produced gigabytes. A + # structure's #to_s is its #inspect, which would also expose the instance variables of any + # object it holds. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:505 + def loki_value(value); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:358 + def message; end + + # Returns [Hash] each name of the structured metadata, as Loki stores it (see #loki_name), + # with its value when one key alone has that name, such as `a.b` for `a_b`, or else with nil, + # which no value is the same as (see #write_moved_labels): of the keys that it stores alike, + # Loki keeps the value of one whose name it changed, such as `a.b` over `a_b`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:345 + def metadata_names(metadata); end + + # Every value is a String, since structured metadata only holds Strings: Loki rejects the + # whole push, with every entry in it, when one holds a number or null. The dimensions are a + # single value, as JSON. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:381 + def metric; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:272 + def named_tags; end + + # Returns [String] the number as LogQL reads it, to compare it or `unwrap` it: an Integer as + # it is, and any other number as a Float, which is how LogQL holds it. A Rational's own text, + # such as `3/2`, would make every LogQL query that unwraps it fail, and a BigDecimal's, such + # as `0.25e1`, is not how anyone writes a number. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:400 + def number_text(number); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:366 + def payload; end + + # Returns [Hash] the payload as structured metadata, with String keys and values, since Loki + # only accepts Strings. + # + # A key that Loki would store as one of this formatter's own names (see #prefixed_key?), or + # that it would reject (see LETTER_OR_DIGIT), is written with PAYLOAD_PREFIX, after the other + # keys (see #add_prefixed). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:434 + def payload_metadata(hash); end + + # Whether the payload key is written with PAYLOAD_PREFIX: Loki would store it as one of this + # formatter's own names, OWN_KEYS and those that structured_metadata names (see .own_name), + # or it has no ASCII letter or digit (see LETTER_OR_DIGIT). + # + # A name with characters outside ASCII is matched as Utils.to_json writes it: in UTF-8, + # without invalid bytes, which matching it as it is could raise for. So a key of invalid + # bytes alone is prefixed, since it is written as an empty name. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:492 + def prefixed_key?(name); end + + # Returns [String] the name with PAYLOAD_PREFIX, as Loki stores it. + # + # Joining the prefix with the name as Loki stores it gives the name Loki stores the joined + # name as: a name like one of this formatter's own starts with a letter, and one without a + # letter or digit is stored as an empty name or as `_`, which Loki would write as one + # underscore with the prefix's, so that underscore is left out. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:477 + def prefixed_name(name); end + + # Returns [Array] the labels to write to the structured metadata (see #initialize): + # none when the option is not supplied, with a deprecation warning, since v6 writes both + # there by default. + # Raises ArgumentError for anything but a list of STRUCTURED_METADATA, so that a mistake + # surfaces here rather than as a label left where it was. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:520 + def structured_metadata_option(labels); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:268 + def tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:264 + def thread; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:354 + def time; end + + # Adds the labels past Loki's limits (see #finish_loki_stream) to the structured metadata, + # after the others, each under its name as Loki stores it, such as `a_b` for the label `a__b` + # (see #loki_name), and with PAYLOAD_PREFIX when a payload key with that name would have it, + # as for `duration` or `_` (see #prefixed_key?). When the structured metadata already has + # that name, as Loki stores it, the label is written with a number after it, as a label is + # (see .free_name), rather than with the prefix again, as a payload key is (see + # #add_prefixed), or not at all when the only key that Loki stores under that name has the + # same value (see #metadata_names). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:330 + def write_moved_labels(moved, metadata); end + + # Writes the process id and the thread name to the structured metadata, the supplied Hash, as + # Strings, when structured_metadata names them (see #initialize). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:423 + def write_pid_and_thread(metadata); end + + class << self + # Returns [String|nil] the name under which to write a value, among names, a Hash of the + # names already written and their values: the name itself when it is free; when another value + # has it, the first name with a number after it that is free, as in `request_id_2`, so that + # both values are kept, since Loki keeps one value of a name; or nil when the block returns + # true for the value of that name, or of a numbered name before it, as the same value, so + # that it is written once. Both the labels (see Labels) and the structured metadata (see + # #write_moved_labels) are named so. + # + # The number is added to the stem, which is the name unless given. For structured metadata + # it is the name without a trailing underscore, so that `payload_` is numbered `payload_2`, + # as Loki would store `payload__2`. A name in reserved, which a value outside names has, is + # never free, nor the same, such as the label `thread` while the thread is structured + # metadata (see Labels). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:132 + def free_name(names, name, stem = T.unsafe(nil), reserved: T.unsafe(nil)); end + + # Returns [String] the name that Loki stores structured metadata of the supplied name under: + # in UTF-8 without invalid bytes, as Utils.to_json writes it, with each run of characters + # other than ASCII letters and digits replaced with one underscore, and `key_` before a name + # that starts with a digit. + # + # The `key_` cannot change which name a prefixed key gets: that name starts with + # PAYLOAD_PREFIX, and only the other keys it is checked against can start with a digit. It is + # there so that this returns the name Loki stores for any name, not only for the names it is + # used for here. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:153 + def loki_name(name); end + + # Returns [Regexp] a pattern that matches a name that Loki stores as one of the supplied + # names: each underscore of a name stands for a LOKI_SEPARATOR. Matching it allocates + # nothing, unlike comparing #loki_name with each name, and nearly every payload key is + # checked against it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:36 + def own_name(names); end + end +end + +# A name that starts with a digit, which Loki stores with `key_` before it. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:54 +SemanticLogger::Formatters::Loki::LEADING_DIGIT = T.let(T.unsafe(nil), Regexp) + +# Matches a name that holds an ASCII letter or digit. Loki rejects the whole push for a +# structured metadata name without one, such as an empty name, `-`, or `_`, since it would +# store it as an empty name or as `_`. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:46 +SemanticLogger::Formatters::Loki::LETTER_OR_DIGIT = T.let(T.unsafe(nil), Regexp) + +# A run of characters other than ASCII letters and digits, which Loki replaces with one +# underscore in the name of structured metadata. So Loki stores `metric.value`, +# `metric__value`, and `metric` followed by a zero width space and `value` all as +# `metric_value`. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:30 +SemanticLogger::Formatters::Loki::LOKI_SEPARATOR = T.let(T.unsafe(nil), Regexp) + +# The labels of the stream of one log entry, as Loki accepts them: Loki rejects the whole +# push, with every entry in it, for a label name it does not accept, or past one of its +# limits, and keeps only one value of a label name. +# +# It knows the labels written so far, a Hash of their names, as Strings, and their values, to +# which the formatter has written its own labels first (see Loki#build_stream), whether a +# name may still be a Symbol, the names that the formatter writes to the structured metadata +# instead of as labels, the labels still to be written under another name, Loki's limits, +# and how many labels there were when it finished them. It writes each name as a String (see +# #string_names), adds the named tags and the context to the labels (see #add), and then +# writes those that need another name and takes out those past Loki's limits (see #finish), +# which the formatter writes to the structured metadata instead. It names them by the +# formatter's rules (see Loki.loki_name and Loki.free_name), and converts their values with +# the converter the formatter gives it. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:18 +class SemanticLogger::Formatters::Loki::Labels + # Parameters + # labels: [Hash] + # The labels written so far, which this adds to, and takes the labels past Loki's + # limits from. + # loki_value: [#call] + # Returns a value as Loki stores it, a String: the formatter's #loki_value, which a + # subclass of the formatter may override. + # max_names, max_name_length, max_value_length: [Integer] + # Loki's limits, see Loki#initialize. + # reserved: [Array] + # The names that the formatter writes to the structured metadata instead of as labels, + # such as `thread` (see Loki#initialize). A label of that name is written under another + # name, since Loki would show the structured metadata as `thread_extracted` beside it. + # symbols: [true|false] + # Whether a label may have a name that is not a String, such as a Symbol that a + # subclass of the formatter written for v5.2 writes its own label under, as v5.2 did. + # The names are then written as Strings (see #string_names) before the first label is + # added, and as the labels are finished. + # Default: false, as the formatter's own methods write every label under a String. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:51 + def initialize(labels, loki_value, max_names, max_name_length, max_value_length, reserved:, symbols: T.unsafe(nil)); end + + # Adds the label of a named tag or a value of the context, with its value as Loki stores it + # (see #initialize), unless the value is nil, which Loki would store as the text "null". + # + # Loki rejects the whole push for a label name it does not accept (see LABEL_NAME), so such + # a name is replaced (see #label_name_for). Loki keeps one value of a label name, so a label + # whose name another label already has is written once when that label has the same value, + # as Loki stores it, and otherwise under another name, as is a label of a reserved name. + # These are written after the others, by #finish, so that the name they get is not one that + # a later label has as its own. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:87 + def add(key, value); end + + # Writes the labels whose names are taken, reserved, or were replaced (see #add), after the + # others, so that a label written under its own name keeps it (see #write_renamed), and + # then takes out the labels past Loki's limits (see #limit). A label written under a + # Symbol since, as by a subclass of the formatter, is first written under a String (see + # #string_names). + # + # It can finish them again, after more labels were added (see #finished?). + # + # Returns [Array|nil] the labels taken out, each its name and its + # value as Loki stores it, or nil when there are none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:112 + def finish; end + + # Whether #finish has written and limited these labels, and no label was added since, as a + # subclass of the formatter may add one after its #build_stream called super, even under + # the name of another label, such as `:level` beside `"level"`. A label whose value was + # replaced since is not seen. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:74 + def finished?; end + + # Whether these are the labels of the supplied Hash: the same Hash, not an equal one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:66 + def of?(labels); end + + private + + # Whether the value is empty, which Loki leaves out. A value that is neither a String nor a + # Symbol, such as the `pid` Integer or the tags, is never written as an empty value. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:238 + def empty_value?(value); end + + # Whether Loki accepts the length of each label's name and value (see #label_fits?). A + # label with an empty value fits, whatever the length of its name, since Loki leaves it out. + # + # Every entry is checked, so an ASCII String, as most values are, is checked here, without + # another method call. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:225 + def fit?; end + + # Whether Loki accepts the length of the label's name, a String, and of its value, as Loki + # stores it, in bytes, in UTF-8 without invalid bytes, as Utils.to_json writes them. + # + # The `level` Symbol and the `pid` Integer of every entry are read as text without + # converting them, which first checks whether a value is a structure, and the tags of + # nearly every entry that has them are not written as JSON only to measure them (see + # #short_strings?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:249 + def label_fits?(name, value); end + + # Whether Loki accepts the name as a label name. A name with characters outside ASCII never + # is, and matching it could raise, when it holds invalid UTF-8. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:182 + def label_name?(name); end + + # Returns [String] a name that Loki accepts for a label whose name it does not: the name + # under which Loki stores structured metadata of that name (see Loki.loki_name), such as + # `request_id` for `request-id`, and `key_1st` for `1st`, or EMPTY_LABEL_NAME for an empty + # name. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:190 + def label_name_for(name); end + + # Takes out each label for which Loki would reject the whole push, with every entry in it, + # so that the push is accepted, and the value is kept in the structured metadata: a label + # whose name is longer than max_name_length, or whose value, as Loki stores it, is longer + # than max_value_length, and each label past max_names, in the order they are written (see + # Loki#build_stream). + # + # As Loki 3.7.10 does, a label with an empty value, which Loki leaves out, is neither + # checked nor counted, and SERVICE_NAME is not counted. + # + # Returns [Array|nil] the labels taken out, each its name as a String + # and its value as Loki stores it, or nil when there are none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:206 + def limit; end + + # Whether a label's value, as Loki stores it, is the supplied value. A value that is not a + # String, such as the `level` Symbol or the `pid` Integer of the formatter's own labels, is + # compared as Loki stores it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:176 + def same_value?(held, value); end + + # Whether the value is an Array of Strings, such as the tags, whose JSON cannot be longer + # than max_value_length: JSON writes each byte of a String as at most 6 bytes, as for a + # control character, such as `\u0001`, with 2 quotes around it and a comma after it, all + # within brackets. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:268 + def short_strings?(value); end + + # Writes each label whose name is not a String under its name as a String, in place and in + # the same order, such as the `:host` of a subclass's own #host, or the `{pid: pid}` of + # v5.2's #build_stream. Otherwise #add would not find its name among the labels, and would + # write a named tag of that name beside it, so the JSON would have the name twice, which + # json 3 refuses to write. When a label written before it has that name, it is written + # after the others, as a named tag whose name is taken is (see #write_renamed), with a + # number unless it has the same value. So #add, #write_renamed, #limit, and #fit? find + # every label by its name as a String. + # + # It runs before the first named tag or context key is added, so that the labels are + # numbered in the order they are written in, and again as they are finished, for a label + # written since. Nearly every stream has String names alone, which Hash#any? checks without + # allocating. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:135 + def string_names; end + + # Writes the labels whose names are taken, reserved, or were replaced (see #add) in two + # passes: first each whose name is free, and then each of the rest, under the name that + # Loki.free_name gives it, which is never a reserved name, or not at all when the label of + # that name, or of a numbered name before it, has the same value (see #same_value?). So the + # number a label gets is never the name that another of them is written under, such as + # `host_2` for a named tag `host-2`, whatever the order of their keys. Only Loki.free_name + # compares the values, so that the value of each label a label is compared with is + # converted once. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:159 + def write_renamed; end +end + +# The name of a label whose key is empty, with the prefix that Loki puts before a name that +# starts with a digit. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:26 +SemanticLogger::Formatters::Loki::Labels::EMPTY_LABEL_NAME = T.let(T.unsafe(nil), String) + +# Matches a label name that Loki accepts: an ASCII letter or an underscore, followed by +# ASCII letters, digits, and underscores. Loki rejects the whole push for any other, such +# as `request-id`, `1st`, or an empty name, with "couldn't parse labels". +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:22 +SemanticLogger::Formatters::Loki::Labels::LABEL_NAME = T.let(T.unsafe(nil), Regexp) + +# The label that Loki adds to a stream that does not have it, and does not count toward +# max_label_names_per_series, even when the stream has it. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki/labels.rb:30 +SemanticLogger::Formatters::Loki::Labels::SERVICE_NAME = T.let(T.unsafe(nil), String) + +# The names of the structured metadata that this formatter writes itself for the fields of an +# entry, to which the labels named by `structured_metadata:` are added (see #initialize). A +# payload key that Loki would store under one of this formatter's own names is written with +# PAYLOAD_PREFIX, as in `payload_duration`, whether or not the entry has that field, so that +# each name always holds this formatter's value. Loki keeps one value of a name: the last of +# a name written twice, but of names that it stores alike, such as `metric.value` and +# `metric_value` (see .own_name), the one it had to change. So the payload's value would +# otherwise be lost, or replace this formatter's. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:17 +SemanticLogger::Formatters::Loki::OWN_KEYS = T.let(T.unsafe(nil), Array) + +# Matches a name that Loki stores as one of OWN_KEYS. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:41 +SemanticLogger::Formatters::Loki::OWN_NAME = T.let(T.unsafe(nil), Regexp) + +# The prefix of a payload key named like one of this formatter's own structured metadata +# names, or without a letter or digit. The :logfmt and :open_telemetry formatters write +# `payload.`, which Loki would store as `payload_`. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:51 +SemanticLogger::Formatters::Loki::PAYLOAD_PREFIX = T.let(T.unsafe(nil), String) + +# The labels that `structured_metadata:` can write to the structured metadata instead (see +# #initialize). +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/loki.rb:24 +SemanticLogger::Formatters::Loki::STRUCTURED_METADATA = T.let(T.unsafe(nil), Array) + +# Only output one line for each log entry. +# +# Notes: +# * Line breaks are stripped from every text field: the name, thread name, file name, tags, +# named tags, message, payload and exception message. They are new lines and carriage +# returns, and the Unicode next line (U+0085), line separator (U+2028), and paragraph +# separator (U+2029), at which editors, browsers, and some log viewers also start a new line. +# With `escape_control_chars: true` they are escaped instead, the Unicode ones in the +# `\uXXXX` form, and so are the other control characters, as the other text formatters +# escape them: the ASCII ones, and the Unicode ones that control how text is shown, such as +# the bidirectional controls (see Base::UNICODE_CONTROL_CHARS). +# * Exceptions only include the class and message, the stack trace is not shown. +# * Exception details, when enabled, are joined onto the same line. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:16 +class SemanticLogger::Formatters::OneLine < ::SemanticLogger::Formatters::Default + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:75 + def exception; end + + # The exception details, with each line trimmed and joined by a space. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:84 + def exception_details; end + + # A log call can supply the backtrace that the file name and method come from. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:53 + def file_name_and_line; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:66 + def message; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:61 + def method_name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:48 + def name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:40 + def named_tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:70 + def payload; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:34 + def tags; end + + # Shortened before its line breaks are removed or escaped, as the other text formatters do + # (see Default#shortened_thread_name), so that an escape is never cut in two. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:30 + def thread_name; end + + private + + # Off by default, so that existing one line output does not change. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:94 + def default_log_exception_details; end + + # Returns [String] the value without line breaks, so that the entry stays on one line. + # With `escape_control_chars: true`, #escape_control_characters has already escaped them, the + # Unicode ones as in "\u2028". + # + # A String with invalid bytes, such as a request parameter decoded from "%FF", or in another + # encoding, such as a binary request body, is converted to valid UTF-8 first, since deleting + # from it, or joining it with UTF-8 text, would raise and lose the entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:105 + def one_line(value); end +end + +# A line break, with the white space around it, between two lines of exception details. A +# carriage return before a line feed is part of that white space. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:26 +SemanticLogger::Formatters::OneLine::DETAILS_LINE_BREAK = T.let(T.unsafe(nil), Regexp) + +# Every line break, as a String#delete character set. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:22 +SemanticLogger::Formatters::OneLine::LINE_BREAKS = T.let(T.unsafe(nil), String) + +# The line breaks that Unicode adds to the line feed and carriage return: next line, line +# separator, and paragraph separator. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/one_line.rb:19 +SemanticLogger::Formatters::OneLine::UNICODE_LINE_BREAKS = T.let(T.unsafe(nil), String) + +# Maps a log entry to an OpenTelemetry log record. +# +# Returns the keyword arguments for the OpenTelemetry Logs API's `Logger#on_emit`, other than +# the context, which the appender captures: +# severity_text: the level, such as "info" +# severity_number: the OpenTelemetry severity number of the level +# timestamp: the time the entry was logged +# body: the message, or nil when the entry has none +# attributes: the named tags and the payload, then the entry's own fields +# +# Each named tag and payload key is an attribute of its own, the payload taking precedence +# over a named tag of the same name. The entry's own fields use the attribute names of the +# OpenTelemetry semantic conventions where there is one, and are otherwise prefixed with +# "semantic_logger.", so that they do not collide with the application's keys: +# exception.type, exception.message, exception.stacktrace (with each exception that caused it) +# code.file.path, code.line.number (where the entry was logged, when it has a call site or +# captured a backtrace), code.function.name (when it has a call site) +# thread.name, process.pid +# semantic_logger.name, semantic_logger.tags, semantic_logger.duration_ms, +# semantic_logger.metric, semantic_logger.metric_amount +# semantic_logger.dimensions., one for each dimension of a metric +# A named tag or payload key named like one of these is prefixed with its source, as in +# "payload.exception.type", so that logged data cannot replace or forge the entry's own fields. +# +# The host, application, and environment are not attributes: they describe the process, which +# OpenTelemetry reports in the resource of every export. The process id is, since the resource +# holds the id of the process that configured OpenTelemetry, not of a forked child. +# +# An attribute value is a String, Integer, Float, true, or false, or an Array of them of one +# type, since the OpenTelemetry SDK reports any other value as an error, which, when that error +# is logged to this appender with the same named tags, repeats until the stack overflows. See +# #coerce_value. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:35 +class SemanticLogger::Formatters::OpenTelemetry < ::SemanticLogger::Formatters::Base + # Returns [Hash] the named tags and the payload, then the entry's own fields. + # + # A payload that is not a Hash, such as a String parsed from a request body, is submitted as a + # single "payload" attribute. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:91 + def attributes; end + + # Returns [String] the message, or nil when the entry has none, such as a metric only entry, + # or an exception logged without a message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:83 + def body; end + + # Returns [Hash] the keyword arguments for `Logger#on_emit`. + # + # Unlike the JSON formatters there is no single `.to_json` boundary here: + # the record is handed to the OTLP exporter, which requires valid UTF-8. Cleanse + # the whole structure so binary / non UTF-8 strings cannot break the export. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:66 + def call(log, logger); end + + private + + # Adds the value as an attribute, unless it is nil. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:170 + def add(attributes, name, value); end + + # Where the entry was logged: its call site, or else the first line of the backtrace it captured. + # Not the logged exception's backtrace, whose location is in its stacktrace. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:139 + def add_code(attributes); end + + # Each dimension of a metric is an attribute of its own, so that it can be queried. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:129 + def add_dimensions(attributes); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:114 + def add_entry(attributes); end + + # The logged exception, with the backtrace of each exception that caused it in its stacktrace. + # With `log_exception_details`, the message is followed by the detail Ruby adds to it, on a + # line of its own, as in Exception#detailed_message. + # + # The type is the class as Utils.exception_name names it, as every formatter does: as Ruby names + # it, without asking the class, such as `#` for an anonymous class. The + # message is read with Utils.exception_message, so that a #message that raises, or does not + # return a String, cannot lose the entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:157 + def add_exception(attributes); end + + # Adds each key and value of a named tags or payload Hash, prefixing a key named like one of + # the entry's own attributes with its source. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:106 + def add_logged(attributes, prefix, hash); end + + # A primitive as-is, and anything else as a String: a structure (such as a Hash, Struct, or + # Set) as JSON, depth-limited and repaired by Utils.to_json, rather than its #to_s, which is + # its #inspect and would expose the instance variables of any object it holds. A subclass of + # String, such as ActiveSupport::SafeBuffer, is copied to a String, which is all the SDK accepts. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:199 + def coerce_element(v); end + + # An attribute value: a primitive, or an Array of primitives of one type. The elements of an + # Array that mixes types, such as [1, "two"], are all written as Strings. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:176 + def coerce_value(v); end + + # Whether the coerced values are all Strings, all booleans, or all numbers. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:184 + def one_type?(values); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:210 + def plain_string(string); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:214 + def severity_number(severity); end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:40 +SemanticLogger::Formatters::OpenTelemetry::CODE_FILE_PATH = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:42 +SemanticLogger::Formatters::OpenTelemetry::CODE_FUNCTION_NAME = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:41 +SemanticLogger::Formatters::OpenTelemetry::CODE_LINE_NUMBER = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:50 +SemanticLogger::Formatters::OpenTelemetry::DIMENSIONS_PREFIX = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:47 +SemanticLogger::Formatters::OpenTelemetry::DURATION_MS = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:52 +SemanticLogger::Formatters::OpenTelemetry::ENTRY_ATTRIBUTES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:38 +SemanticLogger::Formatters::OpenTelemetry::EXCEPTION_MESSAGE = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:39 +SemanticLogger::Formatters::OpenTelemetry::EXCEPTION_STACKTRACE = T.let(T.unsafe(nil), String) + +# The entry's own attributes. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:37 +SemanticLogger::Formatters::OpenTelemetry::EXCEPTION_TYPE = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:48 +SemanticLogger::Formatters::OpenTelemetry::METRIC = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:49 +SemanticLogger::Formatters::OpenTelemetry::METRIC_AMOUNT = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:45 +SemanticLogger::Formatters::OpenTelemetry::NAME = T.let(T.unsafe(nil), String) + +# Prefixes for a named tag or payload key named like one of the entry's own attributes. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:58 +SemanticLogger::Formatters::OpenTelemetry::NAMED_TAGS_PREFIX = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:59 +SemanticLogger::Formatters::OpenTelemetry::PAYLOAD_PREFIX = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:44 +SemanticLogger::Formatters::OpenTelemetry::PROCESS_PID = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:46 +SemanticLogger::Formatters::OpenTelemetry::TAGS = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/open_telemetry.rb:43 +SemanticLogger::Formatters::OpenTelemetry::THREAD_NAME = T.let(T.unsafe(nil), String) + +# Formats log messages using a configurable pattern string, so a custom +# log line layout can be specified directly in the configuration without +# having to write a new formatter class. +# +# Pattern placeholders use the form `%{directive}`, where `directive` is the +# name of any of the formatting methods (inherited from Default, or defined +# below). Named tags support a parameterized form: `%{named_tags:request_id}` +# returns the value of a single named tag. Use `%%{...}` to emit a literal +# `%{...}` without interpolation. +# +# Example: +# SemanticLogger.add_appender( +# io: $stdout, +# formatter: { +# pattern: { pattern: "%{time} %{level} %{name} -- %{message}" } +# } +# ) +# +# Available directives: +# time Formatted timestamp. Optionally accepts a strftime +# format, e.g. time:%Y-%m-%dT%H:%M:%S.%6N. +# level Full level name, e.g. "debug". +# level_short Single character level, e.g. "D". +# name Logger / class name. +# message Log message. +# payload Payload rendered as a string. +# exception_class Class of the logged exception, e.g. "RuntimeError". +# exception_message Message of the logged exception. +# exception_details Detail Ruby adds to the exception's message, such as +# did_you_mean suggestions (see the log_exception_details option). +# backtrace Backtrace of the logged exception. +# duration Human readable duration, e.g. "1.2ms". +# duration_ms Duration in milliseconds (numeric). +# thread_name Name of the thread that logged the message. +# pid Process id. +# file_name Ruby file name that logged the message, e.g. "app.rb". +# line Line number within the Ruby file, e.g. 42. +# method Method that logged the message, e.g. "Order#submit", when +# the entry has a call site (see SemanticLogger.call_site_level). +# tags Tags, comma separated. +# named_tags All named tags, or one tag with named_tags:key. +# host Host name. +# application Application name. +# environment Environment name. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:49 +class SemanticLogger::Formatters::Pattern < ::SemanticLogger::Formatters::Default + # Parameters: + # pattern: [String] + # The pattern string used to format every log entry. + # Default: DEFAULT_PATTERN + # + # Plus all the options supported by SemanticLogger::Formatters::Base. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:97 + def initialize(pattern: T.unsafe(nil), **args); end + + # Application name. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:203 + def application; end + + # Backtrace of the logged exception. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:146 + def backtrace; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:212 + def call(log, logger); end + + # Human readable duration (without the Default formatter's surrounding parentheses). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:151 + def duration; end + + # Duration in milliseconds. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:156 + def duration_ms; end + + # Environment name. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:208 + def environment; end + + # Class of the logged exception, e.g. "RuntimeError". + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:136 + def exception_class; end + + # Message of the logged exception. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:141 + def exception_message; end + + # Name of the Ruby file that logged the message, e.g. "app.rb". Escaped like the other + # fields, since a log call can supply the backtrace it comes from. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:162 + def file_name; end + + # Host name. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:198 + def host; end + + # Full level name, e.g. "debug" (Default formatter uses the short "D"). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:116 + def level; end + + # Single character level, e.g. "D". + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:121 + def level_short; end + + # Line number within the Ruby file that logged the message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:167 + def line; end + + # Log message (without the "-- " prefix the Default formatter adds). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:126 + def message; end + + # With a key: the value of a single named tag, e.g. %{named_tags:request_id}. + # Without a key: all named tags rendered as "key: value, ...". + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:180 + def named_tags(key = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:50 + def pattern; end + + # Raw payload rendered as a string. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:131 + def payload; end + + # Tags joined by a comma (without the Default formatter's surrounding brackets). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:172 + def tags; end + + # Formatted timestamp. With a strftime format argument, e.g. + # %{time:%Y-%m-%dT%H:%M:%S.%6N}, the time is formatted with that string. + # Without an argument it uses the formatter's configured time_format. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:109 + def time(format = T.unsafe(nil)); end + + private + + # Returns [String] the pattern to compile, which raises when the pattern is not valid text, as + # one that is not valid UTF-8 always has, rather than writing a different pattern. Binary is + # the exception, since a binary pattern has always been accepted. + # + # * UTF-8, or another ASCII-compatible encoding that says which characters its bytes are, such + # as ISO-8859-1: as it is, so that a %{named_tags:...} key in it still names the + # application's own key in that encoding (see #joinable_token). + # * US-ASCII with bytes outside ASCII, such as a pattern read from a file or the environment + # where no locale is set: read as the UTF-8 it usually holds, as the fields are. + # * Binary: read as UTF-8 too, with any byte that is not UTF-8 replaced by U+FFFD, so that the + # pattern keeps its shape: a dropped byte could join a "%" to a "{". + # * Any other encoding, such as UTF-16: converted to UTF-8. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:235 + def compilable(pattern); end + + # Parse the pattern string into an array of tokens: frozen literal strings + # and Token structs for each %{directive} placeholder. %%{...} is an escape + # that produces a literal %{...}. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:266 + def compile(string); end + + # Returns the compiled token with its text in UTF-8, so that a pattern with characters outside + # ASCII in, say, ISO-8859-1 can be joined with the entry's fields: a literal, or the format of + # %{time:...}. The key of %{named_tags:...} is left as written, so that it still names the + # application's own key. + # + # Converted strictly, since this runs once, when the formatter is built: a character with no + # UTF-8 equivalent, or an encoding that cannot be converted, raises rather than being dropped. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:251 + def joinable_token(token); end + + # Returns [String] the pattern's own text in UTF-8, frozen (see #joinable_token). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:259 + def utf8_pattern_text(text); end +end + +# Approximates the Default formatter's output. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:53 +SemanticLogger::Formatters::Pattern::DEFAULT_PATTERN = T.let(T.unsafe(nil), String) + +# The directives that may appear in a pattern. The value is whether the +# directive accepts a parameter, e.g. %{named_tags:request_id}. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:57 +SemanticLogger::Formatters::Pattern::DIRECTIVES = T.let(T.unsafe(nil), Hash) + +# The formatter method of each directive not named like it: a method named `method` would +# replace Object#method. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:84 +SemanticLogger::Formatters::Pattern::DIRECTIVE_METHODS = T.let(T.unsafe(nil), Hash) + +# A single interpolated directive within a compiled pattern. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 +class SemanticLogger::Formatters::Pattern::Token < ::Struct + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def arguments; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def arguments=(_); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def method_name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def method_name=(_); end + + class << self + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def [](*_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def inspect; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def keyword_init?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def members; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/pattern.rb:88 + def new(*_arg0); end + end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:4 +class SemanticLogger::Formatters::Raw < ::SemanticLogger::Formatters::Base + # By default Raw formatter does not reformat the time + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:9 + def initialize(time_format: T.unsafe(nil), time_key: T.unsafe(nil), **args); end + + # Application name + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:20 + def application; end + + # Returns log messages in Hash format + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:125 + def call(log, logger); end + + # Duration + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:73 + def duration; end + + # Environment + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:25 + def environment; end + + # Exception, with the stack trace of each exception cleaned by the backtrace cleaner (see + # Base#initialize). + # + # Each exception is named as Utils.exception_name names it, as every formatter does: as Ruby + # names its class, without asking the class, such as `#` for an anonymous class, + # which has no name. Its message is read with Utils.exception_message, so that a #message + # that raises, or does not return a String, cannot lose the entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:102 + def exception; end + + # Ruby file name and line number that logged the message, and the method when the entry has a + # call site (see SemanticLogger.call_site_level). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:52 + def file_name_and_line; end + + # Fields are added by populating this hash. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 + def hash; end + + # Fields are added by populating this hash. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 + def hash=(_arg0); end + + # Host name + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:15 + def host; end + + # Log level + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:35 + def level; end + + # Log message + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:86 + def message; end + + # Metric, its amount, and its dimensions + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:118 + def metric; end + + # Class / app name + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:81 + def name; end + + # Named Tags + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:68 + def named_tags; end + + # Payload + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:91 + def payload; end + + # Process ID + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:41 + def pid; end + + # Tags + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:63 + def tags; end + + # Name of the thread that logged the message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:46 + def thread_name; end + + # Date & time + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:30 + def time; end + + # Fields are added by populating this hash. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 + def time_key; end + + # Fields are added by populating this hash. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:6 + def time_key=(_arg0); end + + private + + # Returns [String] the lines of a stack trace, such as the Hash's `stack_trace`, as one text, one + # per line, for a subclass that writes it as text, joined as Log#backtrace_to_s joins its lines + # (see Utils.join_lines). Lines that cannot be joined, such as a UTF-16 line, or a binary line + # next to a UTF-8 one, in a backtrace that the application set, are converted to valid UTF-8, + # rather than losing the entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:167 + def stack_trace(lines); end + + # Returns [Array] the backtrace to write for the exception. + # + # A cleaned backtrace is frozen and shared with the other appenders (see Log#backtrace_of), + # so the Hash gets a copy that a subclass can change, as it could change the exception's own + # backtrace before cleaning. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/raw.rb:157 + def stack_trace_of(exception, cleaner); end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:4 +class SemanticLogger::Formatters::Signalfx < ::SemanticLogger::Formatters::Base + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:11 + def initialize(token:, dimensions: T.unsafe(nil), gauge_name: T.unsafe(nil), counter_name: T.unsafe(nil), time_format: T.unsafe(nil), **args); end + + # Returns [Hash] a batch of log messages. + # Signalfx has a minimum resolution of 1 second. + # Metrics of the same type, time (second), and dimensions can be aggregated together. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:117 + def batch(logs, logger); end + + # Returns [Hash] log message in Signalfx format. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:86 + def call(log, logger); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def counter_name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def counter_name=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def dimensions; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def dimensions=(_arg0); end + + # Dimensions for this metric: those of the log entry that are not blank, or when it has none, the + # named tags listed in the dimensions option whose values are not blank (see #blank_value?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:67 + def format_dimensions; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def gauge_name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def gauge_name=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def hash; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def hash=(_arg0); end + + # The log entry to format. Also keeps the dimensions of its metric that are sent (see + # #present_dimensions), which formatting the entry asks for several times. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:153 + def log=(log); end + + # Create SignalFx friendly metric. + # Strip leading '/' + # Convert remaining '/' to '.' + # A name that is not valid UTF-8, such as one with invalid bytes or in UTF-16, which matching + # it raises for, is converted to valid UTF-8 first (see Utils.encode_utf8_string). + # + # A metric with dimensions that are not blank (see #present_dimensions) is sent under its own name. + # Any other is sent as the gauge or the counter, with the class and action taken from its name. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:33 + def metric; end + + # Date & time + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:55 + def time; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def token; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:9 + def token=(_arg0); end + + # Value of this metric + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:61 + def value; end + + private + + # Sum counters with the same time (second), name, and dimensions. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:191 + def add_counter(counters, metric); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:186 + def add_gauge(gauges, metric); end + + # Returns [true|false] whether the text of a dimension value is blank: empty, as for nil, or only + # whitespace, which includes Unicode whitespace such as a no-break space, but not NUL. The text is + # converted to valid UTF-8 first (see Utils.encode_utf8_string): matching raises for UTF-8 text + # with invalid bytes, or text that is not ASCII-compatible, such as UTF-16, and would not find the + # Unicode whitespace in text in an encoding such as binary or Shift_JIS. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:184 + def blank_value?(text); end + + # Find Metrics with the same timestamp, metric name, and dimensions. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:197 + def find_match(list, metric); end + + # The dimensions of the entry's metric that are sent, or nil when there are none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:161 + def metric_dimensions; end + + # Returns [Hash] the dimensions of the entry's metric, as Log#dimensions? tells, with each value as + # text, leaving out those that are blank (see #blank_value?). Returns nil when there are none, or only + # blank ones, such as `{state: ""}`, so that the metric is sent as a metric without dimensions is: + # as the gauge or the counter, with the class and action taken from its name. Log#dimensions? + # counts such dimensions, which the formatters that write the entry's data write as they are. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:168 + def present_dimensions; end +end + +# Text of a dimension value that is blank (see #blank_value?). +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/signalfx.rb:6 +SemanticLogger::Formatters::Signalfx::BLANK_VALUE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:3 +class SemanticLogger::Formatters::Syslog < ::SemanticLogger::Formatters::Default + include ::SemanticLogger::Formatters::SyslogHeader + + # Create a Syslog Log Formatter + # + # Parameters: + # facility: [Integer] + # One of the ::Syslog::LOG_* facility constants, for example ::Syslog::LOG_LOCAL0. + # Default: LOG_USER + # + # level_map: [Hash | SemanticLogger::Formatters::Syslog::LevelMap] + # Supply a custom map of SemanticLogger levels to syslog levels. + # + # escape_control_chars: [Boolean] + # Replace control characters (newlines, the ANSI escape, etc.) in + # untrusted log data with a printable escaped form so that they cannot + # forge or split syslog records. + # Default: true (unlike other formatters, since syslog frames records + # with a separator) + # + # max_size: [Integer] + # Maximum size of each syslog packet, in bytes. + # Default: DEFAULT_MAX_SIZE (1024) + # + # Example: + # # Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING. + # SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE}) + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:134 + def initialize(facility: T.unsafe(nil), level_map: T.unsafe(nil), max_size: T.unsafe(nil), escape_control_chars: T.unsafe(nil), **args); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:165 + def call(log, logger); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:7 + def facility; end + + # Set the facility to one of the ::Syslog::LOG_* facility constants. + # Raises ArgumentError for any other value, so that a mistake surfaces here rather than on + # every log entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:150 + def facility=(facility); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:7 + def level_map; end + + # Set the map of log levels to syslog severities, as a LevelMap or a Hash of overrides. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:156 + def level_map=(level_map); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:6 + def max_size; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:6 + def max_size=(_arg0); end + + # Time is part of the syslog packet and is not included in the formatted message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:161 + def time; end + + private + + # Create Syslog Packet + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:176 + def create_syslog_packet(message); end + + # Off by default, so that existing syslog records do not change. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:188 + def default_log_exception_details; end + + class << self + # Returns [Integer] the facility number (0 to 23) that the syslog protocol sends, for a facility + # given as documented: one of the `::Syslog::LOG_*` facility constants, such as + # `::Syslog::LOG_LOCAL0`. syslog(3) defines each of those as the facility number shifted left + # by 3 bits, so `::Syslog::LOG_USER` is 8 and its facility number is 1. + # + # Raises ArgumentError for any other value, including a bare facility number. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:53 + def facility_number(facility); end + + # Load the syslog_protocol gem, which builds the packets for remote syslog. + # Called when a syslog formatter is created, so the gem is only needed by applications + # that log to a remote syslog server. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:102 + def require_syslog_protocol; end + end +end + +# Default maximum size of a syslog packet, in bytes, as for the syslog appender. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:42 +SemanticLogger::Formatters::Syslog::DEFAULT_MAX_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:24 +SemanticLogger::Formatters::Syslog::LOG_AUTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:30 +SemanticLogger::Formatters::Syslog::LOG_AUTHPRIV = T.let(T.unsafe(nil), Integer) + +# Syslog severities and facilities, with the same values as the matching `::Syslog` constants. +# The `syslog` gem is only needed to log to a local syslog daemon, and since Ruby 3.4 it is a +# bundled gem, so remote syslog must not depend on it for these values. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:12 +SemanticLogger::Formatters::Syslog::LOG_CRIT = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:29 +SemanticLogger::Formatters::Syslog::LOG_CRON = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:23 +SemanticLogger::Formatters::Syslog::LOG_DAEMON = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:17 +SemanticLogger::Formatters::Syslog::LOG_DEBUG = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:13 +SemanticLogger::Formatters::Syslog::LOG_ERR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:31 +SemanticLogger::Formatters::Syslog::LOG_FTP = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:16 +SemanticLogger::Formatters::Syslog::LOG_INFO = T.let(T.unsafe(nil), Integer) + +# Syslog facilities, as syslog(3) defines them: the facility number shifted left by 3 bits. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:20 +SemanticLogger::Formatters::Syslog::LOG_KERN = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:32 +SemanticLogger::Formatters::Syslog::LOG_LOCAL0 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:33 +SemanticLogger::Formatters::Syslog::LOG_LOCAL1 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:34 +SemanticLogger::Formatters::Syslog::LOG_LOCAL2 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:35 +SemanticLogger::Formatters::Syslog::LOG_LOCAL3 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:36 +SemanticLogger::Formatters::Syslog::LOG_LOCAL4 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:37 +SemanticLogger::Formatters::Syslog::LOG_LOCAL5 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:38 +SemanticLogger::Formatters::Syslog::LOG_LOCAL6 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:39 +SemanticLogger::Formatters::Syslog::LOG_LOCAL7 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:26 +SemanticLogger::Formatters::Syslog::LOG_LPR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:22 +SemanticLogger::Formatters::Syslog::LOG_MAIL = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:27 +SemanticLogger::Formatters::Syslog::LOG_NEWS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:15 +SemanticLogger::Formatters::Syslog::LOG_NOTICE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:25 +SemanticLogger::Formatters::Syslog::LOG_SYSLOG = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:21 +SemanticLogger::Formatters::Syslog::LOG_USER = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:28 +SemanticLogger::Formatters::Syslog::LOG_UUCP = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:14 +SemanticLogger::Formatters::Syslog::LOG_WARNING = T.let(T.unsafe(nil), Integer) + +# Default level map for every log level +# +# :fatal => ::Syslog::LOG_CRIT - "A critical condition has occurred" +# :error => ::Syslog::LOG_ERR - "An error occurred" +# :warning =>::Syslog::LOG_WARNING - "Warning of a possible problem" +# :info => ::Syslog::LOG_NOTICE - "A normal but significant condition occurred" +# :debug => ::Syslog::LOG_INFO - "Informational message" +# :trace => ::Syslog::LOG_DEBUG - "Debugging information" +# +# The following levels are not used by default. +# ::Syslog::LOG_EMERG - "System is unusable" +# ::Syslog::LOG_ALERT - "Action needs to be taken immediately" +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:75 +class SemanticLogger::Formatters::Syslog::LevelMap + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:84 + def initialize(trace: T.unsafe(nil), debug: T.unsafe(nil), info: T.unsafe(nil), warn: T.unsafe(nil), error: T.unsafe(nil), fatal: T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:94 + def [](level); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def debug; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def debug=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def error; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def error=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def fatal; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def fatal=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def info; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def info=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def trace; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def trace=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def warn; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:76 + def warn=(_arg0); end + + class << self + # Returns [LevelMap] the supplied level map, or a new one with a Hash of overrides applied, + # for example `{warn: LOG_NOTICE}`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:80 + def build(level_map); end + end +end + +# The highest facility the syslog protocol can encode. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog.rb:45 +SemanticLogger::Formatters::Syslog::MAX_FACILITY = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:3 +class SemanticLogger::Formatters::SyslogCee < ::SemanticLogger::Formatters::Raw + include ::SemanticLogger::Formatters::SyslogHeader + + # CEE JSON Syslog format + # Untested prototype code. Based on documentation only. + # If this works for you, please let us know by opening an issue. + # + # Parameters: + # facility: [Integer] + # One of the ::Syslog::LOG_* facility constants, for example ::Syslog::LOG_LOCAL0. + # Default: SemanticLogger::Formatters::Syslog::LOG_USER + # + # level_map: [Hash | SemanticLogger::Formatters::Syslog::LevelMap] + # Supply a custom map of SemanticLogger levels to syslog levels. + # + # max_size: [Integer] + # Maximum size of each syslog packet, in bytes. + # Default: SemanticLogger::Formatters::Syslog::DEFAULT_MAX_SIZE (1024) + # + # Any other options are those of SemanticLogger::Formatters::Raw, such as `log_host` or + # `log_exception_details`. Its time options (`time_format`, `time_key`, and `precision`) + # have no effect, since the time is in the header of the syslog packet. + # + # Example: + # # Log via udp to a remote syslog server on host: `server1` and port `8514`, using the CEE format. + # SemanticLogger.add_appender(appender: :syslog, formatter: :syslog_cee, url: 'udp://server1:8514') + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:32 + def initialize(facility: T.unsafe(nil), level_map: T.unsafe(nil), max_size: T.unsafe(nil), **args); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:59 + def call(log, logger); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:7 + def facility; end + + # Set the facility to one of the ::Syslog::LOG_* facility constants. + # Raises ArgumentError for any other value, so that a mistake surfaces here rather than on + # every log entry. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:45 + def facility=(facility); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:7 + def level_map; end + + # Set the map of log levels to syslog severities, as a LevelMap or a Hash of overrides. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:51 + def level_map=(level_map); end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:6 + def max_size; end + + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:6 + def max_size=(_arg0); end + + # Time is part of the syslog packet and is not included in the formatted message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:56 + def time; end + + private + + # Create Syslog Packet + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_cee.rb:67 + def create_syslog_packet(message); end +end + +# The host name and the application name (the TAG) that the formatters building a remote syslog +# packet (Syslog and SyslogCee) write in its header. +# +# The syslog_protocol gem, following RFC 3164, allows only printable ASCII characters other than +# the space (33 to 126) in either, and up to 32 in the TAG, and raises for any other, which made +# the formatter lose every entry, such as for an application named "Café", or with a name over +# 32 characters. So the other characters are left out, as the spaces always were from the TAG, +# and the TAG is cut to 32 characters. When no character is left, "localhost" or +# "SemanticLogger" is written instead. +# +# Each is worked out once, and again only when the host or application name changes. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_header.rb:14 +module SemanticLogger::Formatters::SyslogHeader + private + + # Returns [String] the field cleaned (see SyslogHeader), frozen, from the cache when the text + # is the one it was worked out from, or holds the same characters, such as an appender's own + # name that was changed in place, which the cache keeps a frozen copy of. Any other object, + # other than a Symbol, is read as its #to_s first, so that one changed in place is noticed too. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_header.rb:36 + def syslog_header_field(field, text, fallback, max_size = T.unsafe(nil)); end + + # Returns [String] the host name as the syslog header holds it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_header.rb:27 + def syslog_hostname(host); end + + # Returns [String] the application name as the TAG of the syslog header holds it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_header.rb:30 + def syslog_tag(application); end +end + +# Written in place of a host name with no character left. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_header.rb:19 +SemanticLogger::Formatters::SyslogHeader::DEFAULT_HOSTNAME = T.let(T.unsafe(nil), String) + +# Written in place of an application name with no character left. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_header.rb:22 +SemanticLogger::Formatters::SyslogHeader::DEFAULT_TAG = T.let(T.unsafe(nil), String) + +# The most characters that the TAG of a syslog header can hold. +# +# pkg:gem/semantic_logger#lib/semantic_logger/formatters/syslog_header.rb:16 +SemanticLogger::Formatters::SyslogHeader::MAX_TAG_SIZE = T.let(T.unsafe(nil), Integer) + +# Logging levels in order of most detailed to most severe +# +# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:5 +SemanticLogger::LEVELS = T.let(T.unsafe(nil), Array) + +# pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:4 +module SemanticLogger::Levels + class << self + # Internal method to return the log level as an internal index + # Also supports mapping the ::Logger levels to SemanticLogger levels + # + # pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:17 + def index(level); end + + # Returns the symbolic level for the supplied level index + # + # pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:41 + def level(level_index); end + + # Returns [true|false] whether the supplied value is a level that #index accepts. + # Never raises, so it can be used to check values that come from untrusted data. + # + # pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:34 + def valid?(level); end + end +end + +# Logging levels in order of most detailed to most severe +# +# pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:6 +SemanticLogger::Levels::LEVELS = T.let(T.unsafe(nil), Array) + +# Map the built-in `Logger` levels to SemanticLogger levels. +# +# pkg:gem/semantic_logger#lib/semantic_logger/levels.rb:9 +SemanticLogger::Levels::MAPPED_LEVELS = T.let(T.unsafe(nil), Array) + +# Log +# +# Class to hold all log entry information +# +# level +# Log level of the supplied log call +# :trace, :debug, :info, :warn, :error, :fatal +# +# thread_name +# Name of the thread in which the logging call was called, +# or its object id when the thread has no name +# +# name +# Class name supplied to the logging instance +# +# message +# Text message to be logged +# +# payload +# Optional Hash or Ruby Exception object to be logged +# +# time +# The time at which the log entry was created +# +# duration +# The time taken to complete a measure call +# +# tags +# Any tags active on the thread when the log call was made +# +# level_index +# Internal index of the log level +# +# exception +# Ruby Exception object to log +# +# metric [Object] +# Object supplied when measure_x was called +# +# backtrace [Array] +# The backtrace captured at source when the log level >= SemanticLogger.backtrace_level +# +# call_site [CallSite] +# Where the entry was logged: the path, line, and label (usually the method) of the code that +# made the log call, when the log level >= SemanticLogger.call_site_level. The one the log call +# supplies as `call_site:`, or nil for `call_site: false`, or else the first line of a backtrace +# it supplies. nil below that level. +# +# metric_amount [Numeric] +# Used for numeric or counter metrics. +# For example, the number of inquiries or, the amount purchased etc. +# +# context [Hash] +# Named contexts that were captured when the log entry was created. +# +# captures [Hash] +# Objects that an appender captured on the logging thread for its own use when the log entry +# was created, such as the OpenTelemetry context. Only a formatter built for that appender writes +# them, as the NewRelicLogs formatter writes the linking metadata its appender captures. +# +# The payload, named tags, context, and dimensions have the values of sensitive keys replaced +# before the entry is written to any appender, when SemanticLogger.sensitive_keys is set (see +# #redact). +# +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:65 +class SemanticLogger::Log + # Parameters + # thread: [Thread] + # The thread whose name, tags, and named tags the entry has. + # Default: Thread.current + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:111 + def initialize(name, level, index = T.unsafe(nil), thread = T.unsafe(nil)); end + + # Assign named arguments to this log entry, supplying defaults where applicable + # + # Returns [true|false] whether this log entry should be logged + # + # Example: + # logger.info(name: 'value') + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:127 + def assign(message: T.unsafe(nil), payload: T.unsafe(nil), min_duration: T.unsafe(nil), exception: T.unsafe(nil), metric: T.unsafe(nil), metric_amount: T.unsafe(nil), duration: T.unsafe(nil), backtrace: T.unsafe(nil), call_site: T.unsafe(nil), log_exception: T.unsafe(nil), on_exception_level: T.unsafe(nil), dimensions: T.unsafe(nil)); end + + # Assign the Hash returned by a logging block, after #assign has applied the log call. + # + # A block can return untrusted data, such as a parsed request body, so its keys are classified + # by #extract_arguments, as for a Hash passed after the message. A log argument is only assigned + # when this entry does not have it yet (an exception must also be an Exception), and otherwise + # goes to the payload like any other key. Whatever the key order, the log call's values win, + # then the block's top-level keys, then those of its :payload. No supplied Hash is modified. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:206 + def assign_hash(hash); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def backtrace; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def backtrace=(_arg0); end + + # Returns [Array] the backtrace of the supplied exception, or nil when it has none. + # + # Parameters + # exception: [Exception] + # This entry's exception, or one of its causes (see #each_exception). + # cleaner: [Object|nil] + # A backtrace cleaner, such as `Rails.backtrace_cleaner`, that responds to `#clean` or + # `#call`. The backtrace is returned as it cleans it (see BacktraceCleaning.clean), and the + # exception's own backtrace is left unchanged. Any other value, such as the `true` of the + # formatter option, is reported to the internal logger as a broken cleaner, and the full + # backtrace is returned. + # Default: nil (the exception's own backtrace) + # + # A cleaned backtrace is frozen, as are its lines, and cached on this entry, since every + # appender's formatter may ask for it. Nothing is cached while the exception has no backtrace: + # one that was never raised can be given one later, as the Bugsnag appender does. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:358 + def backtrace_of(exception, cleaner: T.unsafe(nil)); end + + # Returns [String] the exception backtrace including all of the child / caused by exceptions + # + # When a cleaner is supplied, each backtrace is cleaned by it first (see #backtrace_of). + # + # When a block is supplied, each cause's message and each backtrace line is passed + # to it, in the order they are written, and the value it returns is written in its + # place. This lets a caller, for example a formatter, transform that text while this + # method keeps the layout. + # + # Lines are separated by a line break, with none added before the first or after the + # last, even when an exception in the chain has no backtrace, so that a caller can put + # the text on the line after its own. + # + # Never raises because of what it writes: each cause is named as Utils.exception_name names it, + # as Ruby names its class, without asking the class, such as `#` for an anonymous + # class, which has no name; its message is read as Utils.exception_message reads it, so + # that a #message that raises, or does not return a String, cannot make it raise, nor pass the + # block anything but a String; and the lines are joined as Utils.join_lines joins them, whatever + # their encodings. + # + # Example: + # log.backtrace_to_s { |text| text.gsub("\n", "\\n") } + # log.backtrace_to_s(cleaner: Rails.backtrace_cleaner) + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:387 + def backtrace_to_s(cleaner: T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def call_site; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def call_site=(_arg0); end + + # Keeps the value, captured on the logging thread, for the appender that uses it. Unlike the + # context, formatters do not write it, unless one is built for that appender and reads its key. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:500 + def capture(key, value); end + + # Returns the value captured with the key, or nil when there is none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:503 + def captured(key); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def captures; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def captures=(_arg0); end + + # Strip the standard Rails colorizing from the logged message. + # + # Note: This unconditionally *strips* ANSI colorization, and is used to keep + # terminal escape codes out of structured (JSON/Loki) output. It is distinct + # from Formatters::Base#escape_control_characters, which instead *escapes* + # (preserves) control characters and is opt-in for the text formatters. + # + # A message tagged UTF-8 can hold invalid bytes, for example a request parameter that Rack + # decoded from "%FF", or be in another encoding, such as a binary request body. Stripping or + # matching such a String raises, so it is converted to valid UTF-8 first, dropping the + # invalid bytes, as the JSON formatters do. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:468 + def cleansed_message; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def context; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def context=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def dimensions; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def dimensions=(_arg0); end + + # Returns [true|false] whether the log entry has a metric with dimensions: a Hash that is not empty. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:487 + def dimensions?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def duration; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def duration=(_arg0); end + + # Returns [String] the duration in human readable form + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:416 + def duration_human; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:408 + def duration_to_s; end + + # Call the block for exception and any nested exception + # + # Parameters + # first: [Exception|nil] + # The exception to start from, for one that this entry does not keep, such as the one that + # log_exception: :partial writes into the message. + # Default: this entry's exception + # + # Yields each exception with its depth: 0 for the first one, 1 for the exception that caused it, + # and so on. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:302 + def each_exception(first = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def exception; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def exception=(_arg0); end + + # Returns [String] the detail that Ruby's Exception#detailed_message adds to the message of the + # supplied exception, without the class name that Ruby also adds. Since Ruby 3.2 this is where + # did_you_mean suggestions ("Did you mean? upcase") and the detail an exception class supplies + # by overriding #detailed_message appear, rather than in #message. + # Returns nil when there is no detail. + # + # Parameters + # exception: [Exception] + # This entry's exception, or one of its causes (see #each_exception). + # source: [true|false] + # Whether to include error_highlight's snippet of the failing source line, for example + # "user_name.upcas" with "^^^^^^" under the unknown method. It re-parses that source + # file on every call, so it is about 100 times slower, and it copies source code into + # the log. + # Default: false + # + # The result is cached on this entry, since every appender's formatter may ask for it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:338 + def exception_details(exception, source: T.unsafe(nil)); end + + # Extract the arguments from a Hash Payload + # + # The hash can hold untrusted data, so this never fails because of its content: keys that are + # not log attributes, or that hold a value that is not valid for it (see .argument?), are kept + # in the payload. A log attribute key with a nil value counts as not supplied, so #assign uses + # its default. When the hash supplies an explicit :payload, any other keys are merged into it, + # and win over its values of the same name, since the explicit payload is where untrusted data + # goes (see docs/security.md). + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:262 + def extract_arguments(payload, message = T.unsafe(nil)); end + + # Extract the file name and line number from the first line of the supplied backtrace. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:445 + def extract_file_and_line(stack, short_name = T.unsafe(nil)); end + + # Returns [String, Integer] the file name and line number where the entry was logged: from the call + # site, or else the first line of the backtrace, or of the exception's backtrace. + # nil when there are none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:452 + def file_name_and_line(short_name = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def level; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def level=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def level_index; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def level_index=(_arg0); end + + # Returns [String] single character upper case log level + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:434 + def level_to_s; end + + # Replaces the values of this entry that cannot be copied to another Ractor, such as a Proc in its + # payload (see RactorCopy). Returns self. Experimental, Ruby 4.0 and later only. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:526 + def make_copyable; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def message; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def message=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def metric; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def metric=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def metric_amount; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def metric_amount=(_arg0); end + + # A metric only event has a metric but no message or exception. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:522 + def metric_only?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def name=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def named_tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def named_tags=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def payload; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def payload=(_arg0); end + + # Returns [true|false] whether the log entry has a payload + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:484 + def payload?; end + + # Return the payload in text form + # Returns nil if payload is missing or empty + # + # Rendered with #inspect, or with the block when given (for example Amazing Print). A payload + # nested too deeply for either is first cut off at Utils::MAX_JSON_SAFE_DEPTH, rather than + # raising SystemStackError (see Utils.safe_inspect). + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:481 + def payload_to_s(&); end + + # DEPRECATED + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:437 + def process_info(thread_name_length = T.unsafe(nil)); end + + # Replaces this entry's payload, named tags, context, and metric dimensions, the fields that + # hold keyed data, with copies in which the value of every sensitive key is replaced (see + # Redactor#redact). Returns self. + # + # The values replaced are left as they are, since they can be the application's own, or be + # shared with other entries, as named tags are. A field with no sensitive key is kept as it is. + # + # Called once, before the entry is written to any appender (see SemanticLogger.sensitive_keys=). + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:513 + def redact(redactor); end + + # Lazy initializes the context hash and assigns a key value pair. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:496 + def set_context(key, value); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def tags; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def tags=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def thread_name; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def thread_name=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def time; end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:102 + def time=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:489 + def to_h(host = T.unsafe(nil), application = T.unsafe(nil), environment = T.unsafe(nil)); end + + private + + # Whether a log argument from the Hash returned by a logging block, already checked by + # .argument?, is assigned to its attribute: only when this entry does not have it yet. As in + # #extract_arguments, an empty message counts as none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:613 + def block_attribute?(key, value); end + + # Returns the value cached on this entry for the key, after caching the value the block returns + # when there is none yet. Used for values derived from the entry that every appender's formatter + # may ask for. + # + # Keys hold objects by their #__id__, so that no exception's or cleaner's own #eql? or #hash is + # called: an exception class can define them by value, which would cache two of its exceptions + # together, and a cleaner, such as a test double, need not define them. + # + # The cache is replaced rather than changed, since appenders on other threads may be reading it. + # Appenders that ask at the same moment can each compute the value, so the block must not rely + # on being called only once. + # Once the entry is handed to the appenders the cache only grows, so the entry found by #key? is + # still there when it is read. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:580 + def cached(key); end + + # Returns [true|false] whether this entry gives a metric a negative amount, which is deprecated (see + # .negative_metric_amount_deprecated): whether it has a metric and a metric amount that is a real + # number below zero. Also for a measure_* entry, since SignalFx adds its amount to a counter too. + # Without a metric no metric subscriber receives the amount. Costs a nil check when there is no + # metric. Never raises, since Base#backtrace passes its metric_amount to #assign without checking it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:542 + def counted_negative_amount?; end + + # Returns the kept payload with the keys of the added one that it does not have, so that a kept + # value is never replaced. A String and a Symbol key of the same name, such as "account_id" from + # JSON.parse and :account_id, count as the same key, since the formatters write both under that + # name. A payload that is not a Hash is kept as its :payload key, but the kept payload is + # returned unchanged when there is nothing to add. Neither payload is modified. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:549 + def merge_payload(kept, added); end + + # Returns [String] the exception's message, without raising, so that log_exception: :partial + # never replaces the exception being logged with one that its #message raises (see + # Utils.exception_message). + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:593 + def message_of(exception); end + + # Returns [String] the value as text in valid UTF-8 (see Utils.encode_utf8_string). + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:588 + def utf8(value); end + + # Returns [String] this entry's message, as log_exception: :partial writes it, followed by the + # class of an exception that caused the logged one, then its message (see #with_cause_message). + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:602 + def with_cause(cause); end + + # Returns [String] the text followed by the message of an exception that caused the logged one, + # or the text alone when it already holds that message: as when the message is empty, is the + # class name that the text ends with (when the exception was raised without a message), or was + # copied by the exception that wraps it into its own. Compared as UTF-8, so that it never raises. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:608 + def with_cause_message(text, added); end + + # Returns [String] this entry's message, as log_exception: :partial writes it, followed by the + # label, the class of the exception, named as Utils.exception_name names it, and any more texts, + # joined once. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:598 + def with_class(label, exception, *more); end + + class << self + # Returns [true|false] whether the value can be used as the log argument named by the key. + # + # Never raises, so it can check values from untrusted data before they are passed to #assign. + # A nil value is never an argument, since it means the argument was not supplied. Arguments + # without a validator in ARGUMENT_VALIDATORS (such as :message, :metric, or :exception, which + # #assign logs as an ArgumentError when it is not an Exception) accept any other value. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:247 + def argument?(key, value); end + + # Reports, once per process, that a log call gave a negative metric amount, which is deprecated: + # a metric counts upward, and v6 drops a negative amount. The entry is still logged with it. + # + # Only once, so that a negative amount in a loop does not report a warning for each log call, and + # only once deprecation warnings are on, so that turning them on later still reports it. Not from + # a Ractor other than the main one, which cannot record that it was reported. Two threads that + # report at the same moment can each report it, which costs a second warning at worst. Remove in + # v6, where the metrics API drops a negative amount instead. + # + # Internal: called by #assign and #assign_hash only (@api private). + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:229 + def negative_metric_amount_deprecated; end + + # Returns [String] the name that identifies the thread in a log entry: the thread's own name, + # or its object id when it has none, which Ruby never reuses within a process. + # + # pkg:gem/semantic_logger#lib/semantic_logger/log.rb:100 + def thread_name_for(thread); end + end +end + +# Checks that a value is valid for its argument, for the arguments that do not accept any value. +# Any other value would make #assign, or the formatters, raise. +# +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:80 +SemanticLogger::Log::ARGUMENT_VALIDATORS = T.let(T.unsafe(nil), Hash) + +# Log attributes that a Hash returned by a logging block can set (see #assign_hash). Its other +# keys go to the payload, so that it cannot set fields such as :level, :name, or :time. +# +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:197 +SemanticLogger::Log::ASSIGNABLE_KEYS = T.let(T.unsafe(nil), Array) + +# Hash#key?, which unlike HashWithIndifferentAccess#key? only matches the exact Symbol key. +# +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:95 +SemanticLogger::Log::HASH_KEY = T.let(T.unsafe(nil), UnboundMethod) + +# Values accepted for the :log_exception argument. +# +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:71 +SemanticLogger::Log::LOG_EXCEPTION_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:291 +SemanticLogger::Log::MAX_EXCEPTIONS_TO_UNWRAP = T.let(T.unsafe(nil), Integer) + +# Keys passed in without a payload that will be extracted and the remainder passed into the payload. +# +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:67 +SemanticLogger::Log::NON_PAYLOAD_KEYS = T.let(T.unsafe(nil), Array) + +# A finite real number, which #assign can compare with another one. +# +# pkg:gem/semantic_logger#lib/semantic_logger/log.rb:75 +SemanticLogger::Log::REAL_NUMBER = T.let(T.unsafe(nil), Proc) + +# pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:27 +module SemanticLogger::Loggable + class << self + # pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:28 + def included(base); end + + # Returns [SemanticLogger::Logger] the logger for an object that uses a module that includes Loggable. + # + # A class or module that extended the module has a logger named after itself. An instance uses its + # class's class level logger when it has one, otherwise one named after its class. + # + # pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:93 + def logger_for(object); end + + # Returns [Hash] the class level loggers of the current Ractor, when it is not the main one. + # + # A Ractor other than the main one cannot set, or use, the class level logger of the main Ractor, + # which the class holds, so it has a logger of its own for each class (experimental, Ruby 4.0 and + # later). + # + # pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:111 + def ractor_loggers; end + + # Returns [true|false] whether the logger of the supplied object is held in the current Ractor + # rather than by the object: a class or module, which a Ractor other than the main one cannot change. + # + # pkg:gem/semantic_logger#lib/semantic_logger/loggable.rb:102 + def ractor_owned?(object); end + end +end + +# Logger stores the class name to be used for all log messages so that every +# log message written by this instance will include the class name +# +# pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:4 +class SemanticLogger::Logger < ::SemanticLogger::Base + include ::SemanticLogger::Concerns::Compatibility + + # Returns a Logger instance + # + # Return the logger for a specific class, supports class specific log levels + # logger = SemanticLogger::Logger.new(self) + # OR + # logger = SemanticLogger::Logger.new('MyClass') + # + # Parameters: + # klass + # A class, module or a string with the application/class name + # to be used in the logger + # + # level + # The initial log level to start with for this logger instance + # Default: SemanticLogger.default_level + # + # filter [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied + # regular expression. All other messages will be ignored + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:82 + def initialize(klass, level = T.unsafe(nil), filter = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def <<(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def datetime_format; end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def datetime_format=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def formatter; end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def formatter=(_arg0); end + + # Place log request on the queue for the Appender thread to write to each + # appender in the order that they were registered + # + # Subscribers are called inline before handing off to the queue so that + # they can capture additional context information as needed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:91 + def log(log, message = T.unsafe(nil), progname = T.unsafe(nil), &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def progname; end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def progname=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def sev_threshold; end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def sev_threshold=(level); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def silence_logger(new_level = T.unsafe(nil), &); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def unknown(message = T.unsafe(nil), payload = T.unsafe(nil), exception = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:5 + def unknown?; end + + class << self + # Calls the on_log subscribers, or in a Ractor other than the main one, the shareable ones. + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:105 + def call_subscribers(log); end + + # Removes every on_log subscriber. + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:36 + def clear_subscribers; end + + # Returns the processor that writes log entries to the appenders, or in a Ractor other than the + # main one, the RactorProcessor that sends them to the main Ractor. + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:43 + def processor; end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:7 + def subscribe(object = T.unsafe(nil), &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:26 + def subscribers; end + + # Switch to the synchronous processor + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:50 + def sync!; end + + # Running without the background logging thread? + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:57 + def sync?; end + + # Removes the on_log subscriber. + # + # pkg:gem/semantic_logger#lib/semantic_logger/logger.rb:30 + def unsubscribe(subscriber); end + end +end + +# @formatter:off +# +# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:859 +module SemanticLogger::Metric; end + +# pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:10 +class SemanticLogger::Metric::Signalfx < ::SemanticLogger::Appender::Http + # Create SignalFx metrics appender. + # + # Parameters: + # token: [String] + # Access Token to use for sending metrics. + # Obtain the Signalfx token via the Signalfx Web UI under `Organization` -> `Access Tokens`. + # + # dimensions: [Array] + # Dimensions to forward to signalfx when they are present, and not blank, in the named tags of + # any log message whose metric has no dimensions of its own. A metric logged with `dimensions:` + # is sent with those instead, so add the named tags it needs to them. + # By default `application`, `host`, and, when it is set, `environment` are always included as + # dimensions in all forwarded metrics. + # Each value of a dimension makes a new metric time series, so list only named tags whose + # values are bounded, never a user or request id (see docs/metrics.md). + # Example: [:region, :plan] + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true. + # The Proc must return true or false. + # + # host: [String] + # Name of this host to send as a dimension. + # Default: SemanticLogger.host + # + # application: [String] + # Name of this application to send as a dimension. + # Default: SemanticLogger.application + # + # url: [String] + # Override the SignalFx service url. The metrics are posted to `v2/datapoint` under its path. + # Default: https://ingest.signalfx.com + # + # Notes: + # + # When sending a metric to Signalfx, it is necessary to send both a `gauge` and a `counter` when a + # duration is included in the metric, otherwise it is not possible to chart counts of the metric. + # Unfortunately this doubles the number of metrics, but it is the way Signalfx works. + # Using a `count` of a `gauge` in a chart will significantly under-count the number of occurrences. + # + # If dimensions are added to the metric, then the metric will be sent as-is and + # the above logic will _not_ be applied. A dimension whose value is blank (nil, or text that is + # empty or only whitespace) is left out, and dimensions that are empty, such as `{}`, or all + # blank, such as `{state: ""}`, count as none. + # + # Example, Counter metric: + # logger.info(metric: 'Filters.count', dimensions: {plan: 'premium'}) + # + # Example, Counter metric with a count other than 1: + # logger.info(metric: 'Filters.count', metric_amount: 23, dimensions: {plan: 'premium'}) + # + # When a duration is supplied and no dimensions are supplied: + # logger.info(metric: 'Common/User/authorize', duration: 1.4) + # + # Then it is translated into the following 2 log entries under the covers: + # logger.info(metric: 'Application.average', metric_amount: 1.4, + # dimensions: {class: 'Common::User', action: 'authorize'}) + # logger.info(metric: 'Application.counter', metric_amount: 1, + # dimensions: {class: 'Common::User', action: 'authorize'}) + # + # Similarly with a measure block which automatically supplies the duration: + # logger.measure_info(metric: 'Common/User/authorize') do + # sleep 1 + # end + # + # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:81 + def initialize(token:, dimensions: T.unsafe(nil), url: T.unsafe(nil), formatter: T.unsafe(nil), **args, &); end + + # Logs in batches + # + # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:104 + def batch(logs); end + + # The #batch above formats the whole batch with #format_batch, so it answers as + # Appender::Http#batch_refusal does for its own #batch: only while it is the one in use. + # + # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:112 + def batch_refusal; end + + # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:11 + def full_path; end + + # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:97 + def log(log); end + + # Only forward log entries that contain metrics. + # + # pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:117 + def should_log?(log); end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/metric/signalfx.rb:13 +SemanticLogger::Metric::Signalfx::END_POINT = T.let(T.unsafe(nil), String) + +# Thread that submits and processes log requests +# +# pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:7 +class SemanticLogger::Processor < ::SemanticLogger::Appender::Async + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:33 + def initialize(max_queue_size: T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:31 + def appenders; end + + # Flush and close the appenders, then remove them (see Appenders#close). + # + # Returns false at once on the worker thread of an appender added with async: true or in batches, + # as #flush does. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:132 + def close; end + + # Returns [true|false] whether the calling thread must not wait for a thread that uses this + # processor, since that thread may be waiting for it: the calling thread is the worker thread of + # an appender added with async: true or in batches, for which the worker thread of this processor + # waits, to flush or close it, or for room on its full queue. A message that such a thread logs + # while the queue of this processor is full is dropped, rather than wait for room, only while + # this processor's worker thread can be waiting for it: while that appender's own queue is full, + # or a flush or close of it is waiting (see QueueProcessor#holding_up?). + # + # Otherwise false: holding no lock while it queues an entry, this processor never has another + # thread wait for the calling thread to return from a call to it, even on its own worker thread. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:148 + def current_thread_inside?; end + + # Write the log messages already queued to the appenders, then flush them (see + # QueueProcessor#flush). + # + # Returns false at once on the worker thread of an appender added with async: true or in batches, + # such as by that appender as it writes, rather than wait forever: the worker thread of this + # processor waits for that thread to flush the appender. Reported once to the internal logger. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:122 + def flush; end + + # Returns [Integer] the number of log messages waiting on the main pipeline queue. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:161 + def queue_size; end + + # Remove the appender from those that this processor writes to, and close it. Returns the result + # of closing it, or true when it hands the close over to the worker thread (see below). + # + # Before closing an appender that it removed, waits until the log messages already queued are + # written to the other appenders, and those flushed (see #flush), so that none is still being + # written to it when it is closed, such as a request on its connection that the worker thread is + # sending. + # + # First, when the appender is one of them, and the appenders are to be reopened (see #reopen) but + # the worker thread has not yet reopened them, such as in a forked child that has not logged + # since the fork, waits until it has (see QueueProcessor#await_reopen), so that the appender is + # reopened before it is removed. Its #close then closes only what it built in this process, + # rather than what it inherited from the parent, which over TLS would end the parent's connection + # too, for an appender whose #reopen forgets what the parent built, but whose #close does not. An + # appender added with async: true or in batches is asked to reopen by that reopen, and its own + # worker thread reopens it before it runs the close. + # + # Called on the worker thread itself, such as by an appender as it writes, it closes the appender + # at once, without waiting, since nothing else writes to it then. + # + # Called where it must not wait for the worker thread (see #current_thread_inside?), such as by an + # appender added with async: true or in batches as it writes, removing itself or another one, it + # hands the removal over to the worker thread without waiting (see QueueProcessor#hand_over), and + # returns true, before the appender is closed. Between writes, never while it writes to the + # appender, once it has written the log messages queued ahead, the worker thread closes the + # appender, then removes it (see #close_removed). An appender that removed itself is closed once + # its current write has returned, after the log messages queued for it. + # + # The appender stays in the list until it is closed, so that the thread of an appender that + # removed itself still counts as one that must not wait while it is being closed, and a close of + # every appender (see #close) that runs first closes it instead. A removal handed over is never + # what changes the list while the worker thread goes through it, writing a message or closing + # every appender, since the worker thread itself takes the appender off the list. Until then, + # #appenders still lists it. + # + # Called on any other thread for an appender whose removal was handed over and is not yet done, + # it leaves the close to that removal, so that the appender is not closed twice: it waits for the + # log messages queued ahead to be written (see #flush), which, with the removal queued ahead, takes + # it off the list, and returns true. Not in a forked child that has not reopened this processor, + # whose queue still holds none of those removals (see #removal_pending?): it closes the appender. + # + # Takes no lock, so that it can be called from a signal trap. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:107 + def remove(appender); end + + # Reopen the appenders, after a fork or within the same process, each on the thread that writes + # to it, between writes (see Appender::Async#reopen): the worker thread of this processor reopens + # the appenders (see Appenders#reopen). + # + # After a fork, the queue and worker thread of each appender added with async: true or in batches + # are first replaced on the calling thread, rather than once this processor's worker thread gets + # to the reopen, so that they are running when this returns, such as for SemanticLogger.stats. + # That worker thread still asks each of them to reopen its appender, ahead of the entries it + # hands them. Takes no lock, so that it can be called from a signal trap. + # + # In a forked child, the removals handed over to the worker thread that it had not yet done in the + # parent (see #remove) were on the parent's queue, which the child replaces. So they are handed + # over again, to the child's worker thread, after the reopen: each such appender, reopened first, + # then closes only what it built in the child. They count as pending (see #removal_pending?) just + # before that, so a #remove of one meanwhile returns true while it is still listed, briefly. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:57 + def reopen; end + + # Start the appender thread + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:153 + def start; end + + # Returns [Hash] operational statistics for the logging pipeline. + # + # queue_size: [Integer] Number of log messages waiting on the main pipeline queue. + # capped: [Boolean] Whether the main queue has a maximum size. + # max_queue_size: [Integer] Maximum queue size, or nil when uncapped. + # thread_active: [Boolean] Whether the main pipeline thread is running. + # processed: [Integer] Cumulative number of log messages processed since startup. + # dropped: [Integer] Cumulative number of log messages dropped at the main queue. + # appenders: [Array] Per-appender statistics, see Appenders#stats. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:174 + def stats; end + + private + + # Close the appender, then remove it from the list, on the worker thread, unless it is no longer + # listed: a close of every appender (see #close), or another removal, already closed it. Its + # removal is then no longer pending. + # + # Reports an error rather than raise it to the worker thread, as Appenders#close does, whatever + # its class, since one that is not a StandardError would stop the worker thread for good. Except + # a stack overflow, which the worker thread must not carry on after: on macOS a second one on the + # same thread crashes Ruby. It is raised, and a new worker thread carries on (see + # QueueProcessor#run_command). + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:221 + def close_removed(appender); end + + # In a forked child, hand over again the removals pending in the parent (see #reopen), for the + # appenders still listed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:204 + def hand_over_pending_removals; end + + # Hand the removal of the appender over to the worker thread (see #remove), recording it as + # pending until it is done. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:190 + def hand_over_removal(appender); end + + # Refuse to flush or close on the worker thread of an appender (see #flush), and report it the first + # time. Returns false. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:238 + def refuse_on_appender_thread(command); end + + # Whether the removal of the appender was handed over to the worker thread (see #remove), and is + # not yet done. Only in the process that handed it over, or a forked child once #reopen has handed + # it over again: until then, the queue of a forked child holds the parent's entries, which no + # worker thread of the child runs. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:200 + def removal_pending?(appender); end + + class << self + # Internal logger for SemanticLogger + # For example when an appender is not working etc.. + # By default logs to $stderr + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:22 + def logger; end + + # Allow the internal logger to be overridden from its default of $stderr + # Can be replaced with another Ruby logger or Rails logger, but never to + # SemanticLogger::Logger itself since it is for reporting problems + # while trying to log to the various appenders (raises ArgumentError) + # + # A Ruby or Rails logger is wrapped in an appender (see Appender.internal_logger), so .logger + # returns that appender. The appenders added from then on report to it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/processor.rb:15 + def logger=(logger); end + end +end + +# Internal class that processes log messages from a queue on a separate thread. +# +# Internal use only: it owns the worker thread and the in-memory queue that back the +# asynchronous appender proxy (SemanticLogger::Appender::Async). It is never returned to +# application code. +# +# Supports two processing modes, selected by the `batch:` option: +# * Streaming (batch: false): each log message is written to the appender as it is dequeued. +# * Batching (batch: true): log messages are grouped and written via the appender's #batch +# method, either once batch_size messages have accumulated, or +# batch_seconds have elapsed since the previous batch. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:2 +class SemanticLogger::QueueProcessor + # Parameters: + # appender: [SemanticLogger::Subscriber] + # The appender to forward log messages to from the worker thread. + # + # max_queue_size: [Integer] + # The maximum number of log messages to hold on the queue before blocking attempts to add to the queue. + # -1: The queue size is uncapped and will never block no matter how long the queue is. + # Default: 10,000 + # + # lag_threshold_s: [Float] + # Log a warning when a log message has been on the queue for longer than this period in seconds. + # Default: 30 + # + # lag_check_interval: [Integer] + # Number of messages to process before checking for slow logging. + # Default: 1,000 + # Note: Not applicable when batch: true. + # + # batch: [true|false] + # Process log messages in batches via the appender's #batch method. + # Default: false + # Note: The appender must implement #batch. + # + # batch_size: [Integer] + # Maximum number of messages to batch up before sending. + # Default: 300 + # Note: Only applicable when batch: true. + # + # batch_seconds: [Integer] + # Maximum number of seconds between sending batches. + # Default: 5 + # Note: Only applicable when batch: true. + # + # non_blocking: [true|false] + # Whether to drop log messages instead of blocking the calling thread when the queue is full. + # Only applies to a capped queue. + # Default: false + # + # dropped_message_report_seconds: [Integer] + # Log the count of messages dropped because the queue was full, with non_blocking or once + # the worker thread has stopped (see async_max_retries), to the internal logger at most once + # every this number of seconds. Also limits how often messages discarded because they could + # not be written are reported, after the first. + # Default: 30 + # + # async_max_retries: [Integer] + # Maximum number of consecutive times to restart the worker thread after it raises an + # exception while processing messages. Each restart first sleeps for `retry_count` seconds + # (1s, then 2s, ...) as a back-off, unless a flush or close is waiting (see #flush), or the + # process is exiting (see #process_exiting=). Once this many consecutive retries are + # exhausted the thread stops instead of restarting. The counter resets to zero whenever a + # message is processed successfully. A message or batch that the destination failed is + # written again after the back-off when the appender says that the write wrote none of it + # (see Subscriber#wrote_nothing?), up to HeldWrite::MAX_RESENDS times after the destination + # answered with a failure, and is otherwise discarded. + # -1: Retry indefinitely and never stop the thread (the pre-v5 behaviour). The back-off + # still applies, and still resets after any successful message. + # A worker thread started again by #reopen in the same process carries on with the count, so + # that one that had used all its retries stops again at its first failure, rather than hold + # up the threads logging to it with a back-off as long again while the destination is still + # unavailable; one that stopped before, such as after a fatal exception, has the retries it + # had left. Only the worker thread of a child process, after a fork, starts counting afresh. + # Default: 100 + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:96 + def initialize(appender:, max_queue_size: T.unsafe(nil), lag_check_interval: T.unsafe(nil), lag_threshold_s: T.unsafe(nil), batch: T.unsafe(nil), batch_size: T.unsafe(nil), batch_seconds: T.unsafe(nil), non_blocking: T.unsafe(nil), dropped_message_report_seconds: T.unsafe(nil), async_max_retries: T.unsafe(nil)); end + + # Returns [true|false] whether the worker thread is running. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:145 + def active?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:28 + def appender; end + + # Returns [Integer] the maximum number of consecutive retries after a failure (see #initialize). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:133 + def async_max_retries; end + + # Wait until the worker thread has reopened the appender, when a reopen has been asked for (see + # #reopen) and it has not yet finished it, such as in a forked child whose worker thread has not + # yet written anything. Returns at once when none is pending, so that it costs nothing otherwise. + # + # The worker thread reopens the appender before it takes anything off the queue, so a flush + # submitted now runs after the reopen, and returns once it has (see #flush). Like #flush, it + # returns without waiting when called on the worker thread itself, or once that thread has + # stopped. Takes no lock, as #flush takes none, so that it can be called from a signal trap. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:291 + def await_reopen; end + + # Returns [true|false] whether messages are processed in batches. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:178 + def batch?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def batch_seconds; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def batch_seconds=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def batch_size; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def batch_size=(_arg0); end + + # Returns [true|false] whether the queue has a capped size. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:164 + def capped?; end + + # Flush any outstanding messages and close the appender. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:220 + def close; end + + # Returns [Integer] the number of log messages dropped because the queue was full. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:171 + def dropped_count; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def dropped_message_report_seconds; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def dropped_message_report_seconds=(_arg0); end + + # Returns [Integer] the number of log messages discarded because they could not be written, + # whether their content or the destination was at fault (see Subscriber#message_error?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:175 + def failed_count; end + + # Flush all queued log entries to the appender. + # All queued log messages are written and then the appender is flushed. + # + # A flush or close does not wait out back-offs after the destination failed, nor each message + # ahead of it failing in turn: submitting it ends the back-off under way, and until it has run, a + # message or batch that the destination fails is discarded, rather than written again after a + # back-off, and so are the messages queued after that one, ahead of the flush or close, without + # being written (see Backoff#give_up?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:217 + def flush; end + + # Hand the block over to the worker thread, which runs it between writes, after the entries + # already queued, without waiting for it to run. The block reports its own errors: one that it + # raises is handled as a failure of the appender. + # + # Never waits, so that it can be called on a thread that the worker thread may itself be + # waiting for, such as the worker thread of an appender that it hands entries to, whose full + # queue it waits on. When the queue is full, a new thread adds the block to the queue, waiting for + # room, rather than the calling thread: once the calling thread returns, the worker thread can + # make room (see Inbox#push_aside). When the worker thread is not running, or has stopped (see + # #stopped?), or stops while that thread waits, a new thread runs the block instead, since nothing + # then writes to the appender. Takes no lock, so that it can be called from a signal trap. + # + # A batching worker thread is not woken up, since that would write a partial batch: it runs the + # block at its next batch, at most batch_seconds later. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:236 + def hand_over(&task); end + + # Returns [true|false] whether the thread is the worker thread while another thread may be waiting + # for it: the queue is full, so that a thread adding to it waits for it to make room, or a request, + # such as a flush or close, is waiting for it to run it (see Backoff#request_waiting?), whoever + # submitted it, so a message it logs that could wait may be dropped (see #waited_on?). Lock free. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:155 + def holding_up?(thread = T.unsafe(nil)); end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def lag_check_interval; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def lag_check_interval=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def lag_threshold_s; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def lag_threshold_s=(_arg0); end + + # Add a log message to the queue for processing. + # + # When non-blocking and the queue is full, the message is dropped instead of blocking the + # calling thread, and the count of dropped messages is reported periodically. + # + # Once the worker thread has stopped for good (see async_max_retries), nothing will empty the + # queue, so messages are also dropped instead of blocking the calling thread forever. That + # includes a message already waiting for room on the full queue when the worker thread stops. + # + # Nor does a thread that the worker thread may itself be waiting for wait for room on the full + # queue (see #waited_on?): the message is dropped instead. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:195 + def log(log); end + + # Internal logger used to report problems encountered while processing log messages. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:130 + def logger; end + + # Returns [Integer] the most entries the queue holds, or -1 for no limit. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:161 + def max_queue_size; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def non_blocking; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:26 + def non_blocking=(_arg0); end + + # Returns [true|false] whether messages are dropped instead of blocking when the queue is full. + # Only a capped queue can drop messages. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:168 + def non_blocking?; end + + # Tell the worker thread whether the process is exiting, before and after the flush at exit + # (see Backoff#exiting=). While it is, the worker thread acts as though a flush were waiting + # (see #flush), already before the flush at exit reaches this queue: it stops backing off and + # writing again what the destination failed, and once the destination fails, discards the + # messages queued ahead of the next request, such as the flush at exit, so that the process exits + # promptly during an outage. Takes no lock, so that it can be called from any thread, or a signal + # trap. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:245 + def process_exiting=(exiting); end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:28 + def processed_count; end + + # Returns [Queue|SizedQueue] the queue of log messages and requests waiting for the worker thread. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:158 + def queue; end + + # After a fork, the queue holds the entries that the parent process had queued, which the + # parent's worker thread writes, so the child starts again with an empty queue and a worker + # thread of its own, rather than write them a second time. Does nothing in the process that + # created the queue. Asks for no reopen of the appender: #reopen asks before it calls this. + # + # Called on the thread that reopens after the fork, which takes no lock (see #reopen). Called + # by Processor#reopen, through Appenders#renew_after_fork, before the appender is asked to + # reopen: the new worker thread has nothing to write until the processor's worker thread, which + # asks first, hands it entries. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:302 + def renew_after_fork; end + + # Reopen the appender, on the worker thread, and the queue and worker thread after a fork (see + # #renew_after_fork), or start the worker thread again within the same process once it has ended + # or stopped. + # + # The worker thread reopens the appender before it next takes messages off the queue, or writes + # again the ones it holds (see Reopener), so that it is never reopened while it is writing, and + # this returns before it has. After a fork, the reopen is asked for before the child's new worker + # thread starts, so that it reopens the appender before it writes anything. To wake up a + # streaming worker thread waiting for the next message, :reopen is added to the queue, without + # waiting for room: one that is not waiting has messages to write, and reopens the appender before + # them. A batching worker thread is not woken up, since that would write a partial batch, so + # nothing is added to its queue: it reopens the appender at its next batch, at most batch_seconds + # later, or when a flush or close wakes it up, before running them. + # + # Within the same process, such as after a log rotation, the queue and its entries are kept, and + # so is the worker thread while it runs (see #thread). It writes the queued entries in order, + # starting with one it has already taken off the queue, and no other thread writes to the + # appender meanwhile. A worker thread that has ended is replaced by one that carries on with the + # queued entries, and with the count of failures in a row (see async_max_retries). So is one that + # has stopped (see #stopped?), which may still be reporting that it stopped: it is given a moment + # to end first, so that its report comes before the new thread's. A worker thread that has + # stopped no longer writes to the appender, nor changes the state of this processor, so none that + # was replaced can change it once a new one has started. + # + # Also called from a signal trap, such as one that reopens the log files after a rotation, where + # Ruby does not allow a Mutex to be locked, so it takes none: it uses only Queue and Thread + # methods, which Ruby allows there. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:276 + def reopen; end + + # Returns [Integer] the number of consecutive failures, since a message was last processed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:136 + def retry_count; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:28 + def signal; end + + # Returns [true|false] whether the worker thread gave up after an error, so that queued + # messages are no longer being processed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:182 + def stopped?; end + + # Returns [Thread] the worker thread. + # + # Starts the worker thread if it is not currently running. It carries on with the count of + # failures in a row (see async_max_retries). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:142 + def thread; end + + # Returns [true|false] whether the thread is the worker thread, the one that writes to the + # appender. Takes no lock, so that it can be called from a signal trap. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:149 + def worker_thread?(thread = T.unsafe(nil)); end + + private + + # Report when the log message taken off the queue has waited longer than lag_threshold_s. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:687 + def check_lag(log); end + + # Discard the log messages held to be written again, if any, once they will not be. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:679 + def discard_held(exception); end + + # Add the request to the queue, counted as waiting until it has run or will not (see Request#done), + # so that the worker thread does not wait out back-offs meanwhile (see Backoff). Returns false + # when it could not be added. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:692 + def enqueue_request(request, submitted_to); end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:564 + def message_dropped; end + + # Whether the appender says the exception was caused by the content of a log message, rather + # than by the destination. An appender that cannot tell (it does not implement + # #message_error?) has every error treated as the destination's, so the thread backs off. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:639 + def message_error?(exception); end + + # Record log messages discarded because they could not be written, whether their content or + # the destination was at fault, if any, reported at most once every dropped_message_report_seconds + # after the first (see Reporter#failed). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:684 + def messages_failed(logs, exception); end + + # Name the worker thread after its appender, such as "SL File", short enough for tools that + # list threads, such as `top -H`, to tell the workers apart: Linux keeps only the first 15 bytes. + # The name is only a label, so when Ruby rejects it, for example for a class given a temporary + # name with a NUL byte, the thread carries on without one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:353 + def name_worker; end + + # Whether the appender says that the write that raised the exception sent nothing to the + # destination, such as when it could not connect, so that the destination has not answered it. + # An appender that cannot tell (it does not implement #not_sent?) has every failure counted + # towards HeldWrite::MAX_RESENDS. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:650 + def not_sent?(exception); end + + # Log messages that the destination kept from being written. They are held to be written again + # once the thread has backed off (see #process), when the appender says that the write wrote + # none of them, up to HeldWrite::MAX_RESENDS times after the destination answered with a failure + # (a write it never received, see #not_sent?, is not counted). Otherwise they are discarded and + # counted as failed, since writing them again could write some of them twice, or has failed every + # time. So they are while a flush or close is waiting, such as one taken off the queue with them + # (`hold: false`), which must not wait for them to be written again, or the process is exiting. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:659 + def not_written(logs, exception, hold: T.unsafe(nil)); end + + # Add the requests, in order, to the end of the queue, for the worker thread, without waiting for room + # (see Inbox#push_aside). Once no worker thread runs, those not added are abandoned (see Request#abandon). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:557 + def pass_on(requests); end + + # Separate thread for processing log messages. + # + # This thread is designed to never go down unless the main thread terminates or the appender is + # closed. A StandardError while processing restarts the processing, after a back-off, up to + # async_max_retries times. Any other exception, even one from the first report, stops this + # processor, which then drops new messages, rather than ending the thread and leaving the + # calling threads blocked on a full queue. + # + # A flush or close that is waiting (see #flush), or the process exiting (see #process_exiting=), + # does not wait out a back-off, so processing then restarts straight away, without counting a + # retry, and discards the messages queued ahead of the next request without writing them (see + # Backoff#give_up?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:371 + def process; end + + # Run a command after a batch could not be written, unless it has run already, such as a flush + # that raised. Returns false once a command (:close) stops processing, even when the command + # itself fails. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:527 + def process_message_after_failure(command); end + + # Streaming: write each log message to the appender as it is dequeued. + # + # Returns true when processing must carry on in a new thread (see #stack_overflowed). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:416 + def process_messages; end + + # Batching: group up log messages before writing them via the appender's #batch method. + # + # Once the destination failed while the worker thread was waited on (see Backoff#gave_up), the + # messages taken off the queue ahead of the first request, such as a flush, are discarded without + # being written, and those taken off the queue after it are written as a batch, as usual. + # + # Returns true when processing must carry on in a new thread (see #stack_overflowed). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:451 + def process_messages_in_batches; end + + # Once the worker thread stops on a close, release the requests still queued (see Request#abandon), + # which none would run until #reopen; log messages stay queued for it (see Inbox#take). Returns false. + # A log message that cannot be put back on the full queue is counted as dropped. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:562 + def release_requests; end + + # Reopen the appender, if asked to (see #reopen), before taking more messages off the queue, or + # writing again the ones held, so that it is never reopened while it is writing, and a stack + # overflow while it reopens is charged to none of them. Returns false once the stack has + # overflowed: this thread then takes nothing more off the queue, and a new one carries on (see + # #stack_overflowed), which writes them. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:571 + def reopen_appender; end + + # Write the log messages held after the destination failed (see #not_written) again, ahead of + # those still on the queue, as they were written: as a batch when batching. When that fails as + # well, they are held again, or discarded once the destination has answered them with a failure + # after they were written again HeldWrite::MAX_RESENDS times, and the error propagates to + # #process, which backs off before carrying on. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:671 + def resend_held; end + + # Start the worker thread again within the same process, unless it is running (see #reopen). + # + # A worker thread that has stopped (see #stopped?) may still be reporting that it stopped, so it + # is given a moment to end first. Then a new one is started, whether it has ended or not. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:342 + def restart_worker; end + + # Run a command taken off the queue on the appender, reporting one it does not know. Returns + # false once message processing must stop (:close). + # + # A command that overflows the stack, such as a task handed over (see #hand_over), has failed, + # even a close, and this thread takes nothing more off the queue: a new one carries on, as after + # a message that overflowed it (see #stack_overflowed). Nor does it run any more commands, since on + # macOS a second stack overflow on the same thread crashes Ruby: those taken off the queue with it, + # in the same batch, or after a batch that overflowed it, return true here without running, and + # are passed on to the new one (see #write_batch_then_run). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:545 + def run_command(request); end + + # Report to the internal logger, ignoring any error (see Reporter#log). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:411 + def safe_log(level, message, exception = T.unsafe(nil)); end + + # Start a new worker thread, as @thread. It carries on with the count of failures in a row, + # including one taking over from a thread that overflowed its stack (see #process). + # + # The new thread waits until it has been assigned to @thread before it takes anything off the + # queue. Otherwise it could overflow its stack and hand over to another new thread before then, + # and the thread that started it would then assign it, after it has ended, leaving the one it + # handed over to running unseen beside the next one that #thread starts. It waits on a Queue, + # whose #push Ruby allows in a signal trap (see #reopen). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:326 + def spawn_worker; end + + # Discard log messages whose writing overflowed the stack, for example a value nested too + # deeply for a custom formatter. Retrying cannot write them, as for #message_error?. + # + # This thread must not overflow its stack again: on macOS a second stack overflow on the same + # thread crashes Ruby. So nothing else is written on it, including the rest of a batch, which + # is discarded rather than split up further to find the message at fault. Once any commands + # taken off the queue with the messages have run, a new thread carries on (see #process). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:631 + def stack_overflowed(logs, exception); end + + # Submit a command to the worker thread and wait for the reply. + # + # Returns false, without submitting it, when called on the worker thread itself, such as by an + # appender that, as it writes, removes an appender, which flushes the processor first (see + # Processor#remove): the worker thread cannot run the command while it waits for + # the reply, so it would wait forever. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:705 + def submit_request(command); end + + # Returns [true|false] whether the calling thread is one that the worker thread may be waiting + # for: the worker thread of an appender written to by the appender of this processor, which is + # then the Appenders of the main Processor, while that appender's own queue is full, or a flush or + # close submitted to it, such as by the worker thread, waits for it (see Appenders#holding_up?). + # Otherwise the worker thread, if it waits at all, waits on another thread, which makes room. + # Asked only once a log message finds the queue full, then before each wait for room. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:408 + def waited_on?; end + + # Write the log messages to the appender as a batch. + # + # When the content of a message cannot be written (see #message_error?), the appender says what + # became of the batch (see BatchFailure): the messages the destination stored are counted as + # written, those at fault discarded, and the rest written again, as when an all or nothing batch + # is split in half to find the messages at fault, so that only those are discarded rather than + # every message in the batch, and none written twice. A stack overflow discards the batch, and the + # rest of the batch still to be written, without splitting it further (see #stack_overflowed). + # + # The parts still to be written are written in turn, in order, each one once the write before it + # has been rescued, rather than from within its rescue clause. So a destination that rejects one + # message after another, each time the first of the rest, neither deepens the stack nor chains + # each error to the one before it (Exception#cause). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:605 + def write_batch(logs); end + + # Write the log messages taken off the queue as a batch, then run the commands taken off the + # queue with them. Returns false once a command (:close) stops processing. + # + # When the batch cannot be written, for example because the destination is unavailable, the + # messages not yet written are held to be written again after the back-off, or discarded and + # counted as failed (see #not_written). The commands still run before the error propagates to + # #process to back off. Otherwise they would be lost, and a caller waiting on #flush or #close, such + # as the flush at exit, would wait forever. Since they are waiting, the messages are then discarded + # rather than held. A command behind a close is not run, but released (see Request#abandon). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:497 + def write_batch_then_run(logs, commands); end + + # Write one log message to the appender. + # + # A message whose content cannot be written (see #message_error?) is discarded and reported, + # and the thread carries on with the next message. Any other error, such as the destination + # being unavailable, propagates to #process, which backs off before writing the message again, + # or before carrying on with the next one, having discarded it (see #not_written). A stack + # overflow discards the message too (see #stack_overflowed). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:580 + def write_message(log); end + + # Whether the appender says that the write that raised the exception wrote none of the log + # messages it was given. An appender that cannot tell (it does not implement #wrote_nothing?) + # may have written some of them, so they are not written again. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:644 + def wrote_nothing?(exception); end + + class << self + # Create a new processor and start its worker thread. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:31 + def start(**args); end + end +end + +# Internal: how long the worker thread of a queue processor waits, after it could not write to +# the destination of its appender, before it writes again, and when it gives up instead. +# +# It knows how many times in a row writing has failed, how many times the worker thread may retry +# before it gives up (async_max_retries), how many requests, such as a flush or close, are +# waiting for the worker thread to run them, and whether the process is exiting. Each back-off +# waits a second longer than the one before, except while the worker thread is waited on, by a +# request or the exiting process, which must not wait out back-offs: then the worker thread does +# not wait at all, submitting a request or exiting ends the back-off under way, and once the +# destination fails, the worker thread gives up on the messages queued ahead of the next request +# (see #give_up?). +# +# Requests are submitted from other threads, and from a signal trap, where Ruby does not allow a +# Mutex to be locked, so it counts them, and waits, on Queues. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:17 +class SemanticLogger::QueueProcessor::Backoff + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:26 + def initialize(max_retries); end + + # Tell it whether the process is exiting: true before the flush at exit, and false once that + # flush has returned, since a test framework can run its tests in a later at_exit hook. While + # the process exits, the worker thread is waited on, as though a request were waiting, and the + # back-off under way ends. Once it no longer exits, the worker thread gives up no more, unless a + # request is still waiting (see #gave_up). Called from the exiting thread, which may be in a + # signal trap, so it takes no lock either. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:95 + def exiting=(exiting); end + + # Returns the exception with which the destination failed while the worker thread was waited + # on (see #give_up?), while the messages it takes off the queue are to be discarded: until a + # request has run, or the worker thread is no longer waited on. Otherwise nil. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:132 + def gave_up; end + + # Called once the destination failed. While the worker thread is waited on, it gives up on the + # messages queued ahead of the next request, such as a flush, and discards them without writing + # them (see #gave_up), since each could take as long to fail, such as the open_timeout of a + # server that does not answer. While the process exits, it does so as well before the flush at + # exit reaches the queue. Once a request has run (see #request_done), it writes the next + # message once more, even while the process exits, and gives up again if that fails. So + # returns true, having recorded the exception, for the worker thread to carry on straight + # away, without backing off or counting a retry. Otherwise returns false. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:122 + def give_up?(exception); end + + # Returns [Integer|String] the number of retries the worker thread makes at most, for a report. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:64 + def limit; end + + # Returns [Integer] the number of times the worker thread retries after a failure, before it + # gives up, or -1 to retry for ever. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:20 + def max_retries; end + + # Called once for each request submitted, once it has run or will not (see Request#done). The + # worker thread no longer gives up on the messages queued after it (see #give_up?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:84 + def request_done; end + + # Called before a request is added to the queue: it is waiting until #request_done, and ends the + # back-off under way. Never waits, since an interruption already queued ends it as well. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:77 + def request_submitted; end + + # Whether a request, such as a flush or close, is waiting for the worker thread to run it. The + # thread that submitted it may be the worker thread of the queue processor that writes to this + # one's appender, which then waits for this worker thread (see QueueProcessor#holding_up?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:112 + def request_waiting?; end + + # Start counting afresh, once writing succeeds. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:39 + def reset; end + + # Start afresh for a worker thread new to the process, after a fork: it has not failed yet, the + # requests counted as waiting were on the queue of the parent process, which the child + # replaces, and the child is not exiting, even when the parent was, such as when another thread + # forked while the parent flushed at exit. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:47 + def restart; end + + # Count a failure. Returns whether the worker thread retries after it, or false once it has + # retried max_retries times in a row. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:56 + def retry?; end + + # Returns [Integer] the number of failures in a row, which is also how many seconds the next + # back-off waits. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:24 + def retry_count; end + + # Waits retry_count seconds, unless the worker thread is waited on, or until it is. + # + # The interruptions from before are cleared before it checks whether it is waited on, so that a + # request submitted, or the process exiting, in between either is seen or interrupts the wait. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:70 + def wait; end + + # Whether the worker thread is waited on: a request, such as a flush or close, is waiting for + # it to run it, or the process is exiting. It then neither waits out back-offs nor writes again + # what the destination failed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/backoff.rb:107 + def waited_on?; end +end + +# Internal: what became of a batch of log messages whose write raised a message error (see +# Subscriber#message_error?), as the appender tells from the error, for the worker thread of a +# queue processor to carry on with: how many of them the destination stored, those to discard, +# and the parts of the batch to write again. +# +# When the appender says which message the destination rejected, having stored those before it +# (see Subscriber#rejected_entry), those before it were written, it is discarded, and those after +# it are written again as a batch. Otherwise, when the appender's #batch is all or nothing (see +# Subscriber#batch_all_or_nothing?), the batch is split in half, and each half written again, so +# that only the messages at fault are discarded, unless the error would fail any batch (see +# Subscriber#fails_any_batch?). Any other batch is discarded, since writing it again could write +# some of its messages twice. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:15 +class SemanticLogger::QueueProcessor::BatchFailure + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:25 + def initialize(appender, logs, exception); end + + # Returns [Array] the messages to discard. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:20 + def discarded; end + + # Returns [Array>] the parts of the batch to write again, in order. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:23 + def parts; end + + # Returns [Integer] how many of the messages, from the first, the destination stored. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:17 + def written; end + + private + + # The destination stored the messages before the one at position `rejected`, and rejected that + # one, along with every one after it when the error would fail any batch. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:47 + def after_rejected(logs, rejected); end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:43 + def appender; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:43 + def exception; end + + # An appender that does not implement #fails_any_batch? has every all or nothing batch split, + # as before it could say. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:64 + def fails_any_batch?; end + + # Returns [Integer|nil] the position in the batch of the message that the destination + # rejected, when the appender says so, or nil when it does not, or names no message in the + # batch. An appender that does not implement #rejected_entry cannot say. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/batch_failure.rb:57 + def rejected_entry(logs); end +end + +# Internal: the log messages, one or a batch, whose write the destination of the appender failed +# without storing any of them, held for the worker thread of a queue processor to write again +# once it has backed off, ahead of the messages on the queue. +# +# It knows the messages held, and how many times in a row they have been held again after the +# destination answered the write with a failure. It holds them again after such an answer at most +# MAX_RESENDS times, so that messages the destination fails every time, such as a request it +# answers with a 429 that never clears, are discarded rather than hold up the messages behind +# them until the worker thread gives up after async_max_retries. A write that never reached the +# destination, such as one that could not connect, is not counted: the destination has said +# nothing about these messages, so an outage loses none of them until the worker thread gives up. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/held_write.rb:14 +class SemanticLogger::QueueProcessor::HeldWrite + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/held_write.rb:21 + def initialize; end + + # Holds the messages to write again. `answered` says whether the destination answered the + # write that failed, rather than never received it, which counts towards MAX_RESENDS. Returns + # false, without holding them, when the destination answered and they have already been held + # again MAX_RESENDS times after it did. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/held_write.rb:30 + def hold(logs, answered:); end + + # Forgets the messages held, if any, and returns them, such as when the worker thread gives up + # on them, or after a fork, when the parent process writes them. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/held_write.rb:54 + def release; end + + # Yields the messages held, if any, for the block to write them again. Those the block holds + # again keep the count; any other messages held later start afresh. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/held_write.rb:42 + def resend; end +end + +# The most times the same messages are written again after the destination answered that it +# failed them. A constant rather than an option: it only limits how long one write that keeps +# failing holds up the queue, while async_max_retries already sets how long the worker thread +# keeps trying through an outage. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/held_write.rb:19 +SemanticLogger::QueueProcessor::HeldWrite::MAX_RESENDS = T.let(T.unsafe(nil), Integer) + +# Internal: the queue on which log messages, and requests such as a flush, wait for the worker +# thread of a queue processor to take them off. +# +# It knows the queue, whether its size is capped, and the process that created it, and adds to +# it, waiting for room on a full queue or not. After a fork, the child's copy of the queue holds +# the entries of the parent, which the parent's worker thread writes, so the child replaces it. +# +# Also used in a signal trap, where Ruby allows a Queue to wait, but not a Mutex to be locked. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:11 +class SemanticLogger::QueueProcessor::Inbox + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:22 + def initialize(max_queue_size); end + + # Returns [true|false] whether the queue has a capped size. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:28 + def capped?; end + + # Whether this is a child of the process that created the queue, whose copy of the queue then + # holds that process's entries. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:35 + def forked?; end + + # Returns [true|false] whether the queue is capped, and holds as many entries as it can. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:31 + def full?; end + + # Returns [Integer] the most entries the queue holds, or -1 for no limit. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:20 + def max_queue_size; end + + # Add to the `target` queue, the current one by default. Returns whether it was added. + # + # A queue that is not capped is never full, and its #push takes no timeout. On a full queue, + # without `wait`, returns false at once. With `wait`, waits for room while the block returns + # true, which it is asked as soon as the queue is found full, then every WAIT_CHECK_SECONDS, and + # returns false once it returns false, such as once the worker thread has stopped for good, + # since then nothing makes room. The block is not asked when the queue has room. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:50 + def push(item, target = T.unsafe(nil), wait:); end + + # Add the items, in order, without making the calling thread wait for room on a full queue, + # while the block returns true. Once the queue is full, one new thread adds the rest, in order, + # waiting for room while the block returns true. Once the block returns false, at once or while + # that thread waits, the items not yet added are passed to `otherwise` instead, on that thread. + # Returns true, without waiting. Takes no lock, so that it can be called from a signal trap. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:65 + def push_aside(items, otherwise, &adding); end + + # Returns [Queue|SizedQueue] the queue. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:17 + def queue; end + + # Closes the queue, and creates an empty one, which belongs to this process. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:38 + def recreate; end + + # Take the entries of the given class off the queue, and return them, in order. The others are added + # back, in order, behind any added meanwhile, without waiting for room; yields each one that a thread + # waiting for room took the place of, so that it is not lost unseen. Takes no lock. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:76 + def take(kind); end + + private + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:85 + def create; end +end + +# How often, in seconds, a thread waiting for room on the full queue asks whether to keep +# waiting (see #push), so that it does not wait for ever once nothing makes room. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/inbox.rb:14 +SemanticLogger::QueueProcessor::Inbox::WAIT_CHECK_SECONDS = T.let(T.unsafe(nil), Integer) + +# Internal: reopens the appender of a queue processor, on its worker thread, once asked. +# +# The worker thread asks it between writes, so the appender is never reopened while it is +# writing, such as a file being closed under a write, or a connection ended under a request. +# Nor is it reopened on the thread that asks, often a signal trap after a log rotation, where +# Ruby does not allow a Mutex to be locked, as connecting with a timeout does. +# +# It knows whether a reopen has been asked for, and reports a reopen that fails to the internal +# logger. Asked from any thread, and from a signal trap, so it records that on a Queue. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reopener.rb:12 +class SemanticLogger::QueueProcessor::Reopener + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reopener.rb:13 + def initialize(appender, reporter); end + + # Ask for the appender to be reopened before the worker thread writes again. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reopener.rb:21 + def ask; end + + # Returns [true|false] whether a reopen has been asked for and the worker thread has not yet + # finished it, including one that it is running. Reads only a Queue and a flag, so that it can + # be called from any thread, or a signal trap. Reads them in the opposite order to the worker + # thread, which marks the reopen as running before it takes the request, so that a reopen + # starting between the two reads is still seen. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reopener.rb:30 + def pending?; end + + # Reopen the appender, if asked to since it was last reopened. Called by the worker thread, + # between writes. A reopen that fails is reported rather than raised, whatever the exception, + # as Appenders#reopen reports it, so that one that is not a StandardError, such as a LoadError + # or NotImplementedError, does not stop the worker thread for good: the appender keeps what it + # had, and writing to it then fails, or not, as it would have. + # + # Returns nil, or the SystemStackError when reopening overflowed the stack, so that the worker + # thread hands over to a new one, since it must not overflow its stack again: on macOS a second + # stack overflow on the same thread crashes Ruby. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reopener.rb:41 + def reopen_if_asked; end +end + +# Internal: reports what happens on the worker thread of a queue processor, its progress and its +# problems, to the internal logger of its appender. +# +# It knows that logger, which is the appender's to choose, and makes sure that a report neither +# stops the worker thread nor raises into a calling thread, whatever the logger. It counts the log +# messages dropped because the queue was full, and those discarded because they could not be +# written, and reports each count at most once per interval. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:10 +class SemanticLogger::QueueProcessor::Reporter + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:15 + def initialize(appender); end + + # Record a log message dropped because the queue was full, reporting the running count at most + # once every `interval` seconds. The report gives the reason for the latest drop: a queue too + # small for the volume of messages, or, when `stopped`, a worker thread that has stopped for + # good, so that nothing empties the queue, however large. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:54 + def dropped(max_queue_size, stopped:, interval:); end + + # Returns [Integer] the number of log messages dropped because the queue was full. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:25 + def dropped_count; end + + # Record log messages discarded because they could not be written, whether their content or the + # destination was at fault, if any. The first is reported straight away, with the error. After + # that the count is reported, with the latest error, at most once every `interval` seconds. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:89 + def failed(logs, exception, interval:); end + + # Returns [Integer] the number of log messages discarded because they could not be written, + # whether their content or the destination was at fault (see Subscriber#message_error?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:29 + def failed_count; end + + # Report that the worker thread has fallen behind, when the log message it took off the queue + # was logged more than `threshold` seconds ago, with the number of messages still `queued`. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:70 + def lag(entry, threshold, queued); end + + # Log to the internal logger, ignoring any StandardError. These calls may run after Ruby has + # released file handles during shutdown, and the internal logger may not take them, such as a + # Ruby Logger, which has no #trace, returned by a custom appender's own #logger. + # + # Such a logger also takes only the message. So the exception is passed only when there is one, + # and is added to the message instead for a logger that does not take it (see #takes_exception?). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:37 + def log(level, message, exception = T.unsafe(nil)); end + + # Returns the internal logger of the appender, which it can replace at any time. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:22 + def logger; end + + # Report the number of log messages queued ahead of a command, such as a flush, that is being + # submitted: at :warn for more than 1,000, at :info for more than 100, otherwise at :trace, and + # not at all for none. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:81 + def queued(count, command); end + + private + + # Whether the logger's method for the level takes the exception after the message, as a Semantic + # Logger logger does. A Ruby or Rails Logger takes only the message: at most one positional + # parameter, and no *rest. Decided before the call, rather than by rescuing ArgumentError, which a + # logger that does take it can raise too, such as a broadcast logger one of whose loggers raises, + # after the others have written the report. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:106 + def takes_exception?(internal, level); end +end + +# The kinds of positional parameter that Method#parameters reports, other than *rest. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/reporter.rb:12 +SemanticLogger::QueueProcessor::Reporter::POSITIONAL = T.let(T.unsafe(nil), Array) + +# Internal: a command, such as :flush or :close, submitted on the queue for the worker thread +# to run, while the submitting thread waits for the reply. Or a task, a Proc, handed over for the +# worker thread to run without waiting for it (see QueueProcessor#hand_over), which nobody waits on. +# +# It knows its command, whether it has run, and how its reply gets back to the submitting +# thread, and makes sure that the submitting thread is never left waiting on a reply that cannot +# come. It also tells whoever counts the requests waiting, once, when it is no longer waiting. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:10 +class SemanticLogger::QueueProcessor::Request + # The block, if any, is called once the request is no longer waiting (see #done). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:14 + def initialize(command, &on_done); end + + # Called once no worker thread will run this request, such as one passed on to the next worker + # thread when none is running (see QueueProcessor#pass_on). A task runs on a new thread, since + # nothing then writes to the appender, and returns that thread. A command is not run: + # it replies false, so that the submitting thread does not wait for it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:70 + def abandon; end + + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:11 + def command; end + + # Called once the request has run, or will not: one that could not be added to the queue, or + # that the worker thread took off the queue but skipped, such as one behind a close. Calls the + # block given to #initialize the first time only, whichever thread calls it, so that the request + # is counted out once. Also called in a signal trap, where Ruby allows a Queue to be used, but + # not a Mutex to be locked. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:32 + def done; end + + # Whether the worker thread has run this request (see #reply). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:25 + def ran?; end + + # Called by the worker thread: run the block for this request, then reply with true, or + # with false when the block raised. Replies either way. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:38 + def reply; end + + # Called by the worker thread: run this command on the appender, or this task, then reply. + # Returns false once message processing must stop (:close). A command it does not know is + # yielded to the block, for the caller to report, and otherwise ignored. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:51 + def run(appender); end + + # Called by the submitting thread: wait for the reply from the worker thread. + # + # The block returns whether a worker thread that can still reply is running. Returns the + # reply, or false once none is, for example once the worker gave up after + # async_max_retries, or was replaced after a fork. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/request.rb:84 + def wait; end +end + +# Internal: seconds that #reopen waits for a worker thread that has stopped to end. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor.rb:24 +SemanticLogger::QueueProcessor::STOPPED_WORKER_WAIT_SECONDS = T.let(T.unsafe(nil), Float) + +# Internal: counts occurrences of a problem, such as a dropped log message, and has it +# reported at most once per interval instead of once per occurrence. +# +# It knows the total number of occurrences, how many there have been since the previous +# report, and when that report was made. What to report, and where, is up to the caller. +# +# Thread-safe: occurrences may be recorded from any thread, and from a signal trap, such as one +# that logs while the queue is full. Ruby does not allow a Mutex to be locked in a trap, so the +# occurrences recorded there wait on a Queue, which it does allow, until a thread started for +# them, or the next read or record where the Mutex can be locked, adds them in. +# +# pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:13 +class SemanticLogger::QueueProcessor::ThrottledCounter + # Parameters: + # reported_at: [Float|nil] + # When counting starts, on the monotonic clock (see .now), so that the first report is due + # one interval later. + # nil: Report the first occurrence straight away. + # Default: ThrottledCounter.now + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:25 + def initialize(reported_at: T.unsafe(nil)); end + + # Record one or more occurrences. + # + # When the previous report was at least `interval` seconds ago, yields the number of + # occurrences since then (including these) and the seconds elapsed since that report (nil + # when there has been no report yet), then starts counting afresh for the next report. + # + # In a signal trap the occurrences are only counted, and are added in and reported, when a + # report is due, by a thread started for them, just after the trap (see #wait). + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:48 + def record(count = T.unsafe(nil), interval:, &report_block); end + + # Returns [Integer] the total number of occurrences recorded. Read in a signal trap, it leaves + # out those recorded in a trap that have not been added in yet. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:35 + def total; end + + private + + # Adds the occurrences, and those waiting on the queue, to the counts. Holding the lock. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:80 + def add(count); end + + # Leaves occurrences recorded where the lock cannot be taken, such as in a signal trap, on the + # waiting Queue. The first to wait starts a thread, which can take the lock, to record none: + # that adds in every occurrence waiting by then, and reports them when a report is due. Any + # left waiting, such as those that come while it is not due, are added in by the next #record + # or #total that can lock. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:73 + def wait(count, interval, &report_block); end + + class << self + # Returns [Float] the seconds on the monotonic clock, which the intervals between reports are + # measured with, so that a change of the system clock, such as NTP stepping it back, neither + # holds back a report nor makes one early. + # + # pkg:gem/semantic_logger#lib/semantic_logger/queue_processor/throttled_counter.rb:17 + def now; end + end +end + +# Internal, experimental: whether this Ruby can log from Ractors other than the main one (Ruby 4.0 +# and later), and whether the code running now is in such a Ractor. The rest of Semantic Logger asks +# this module rather than checking Ractor itself. +# +# pkg:gem/semantic_logger#lib/semantic_logger/ractor_support.rb:5 +module SemanticLogger::RactorSupport + class << self + # Returns [true] since this Ruby can log from Ractors other than the main one. + # Returns [false] since this Ruby cannot log from Ractors other than the main one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/ractor_support.rb:18 + def enabled?; end + + # Returns [true|false] whether the current Ractor is one other than the main one. + # Returns [false] since every log call runs in the main Ractor. + # + # pkg:gem/semantic_logger#lib/semantic_logger/ractor_support.rb:23 + def other_ractor?; end + end +end + +# Replaces the values of an application's sensitive keys, such as passwords and access tokens, in +# the keyed data of a log entry: its payload, named tags, context, and metric dimensions (see +# Log#redact and SemanticLogger.sensitive_keys=). +# +# Keys are matched by name, the name of a Symbol key or a String key, both as written and in +# snake_case, which is lower case, so that "X-Api-Key" and "apiKey" are also asked about as +# "x_api_key" and "api_key". Keys of any other kind are never sensitive. +# +# Internal: built by SemanticLogger.sensitive_keys=, and asked by Log#redact to redact each of +# an entry's keyed fields, on the thread that writes the entry to the appenders. +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:12 +class SemanticLogger::Redactor + # Parameters + # sensitive_keys: [Array|Regexp|Object] + # Which keys are sensitive, one of: + # Array: Symbols and Strings, each matching any key name that contains it, ignoring case, + # as the Symbols in Rails' `config.filter_parameters` do, and Regexps. + # Regexp: Matches the sensitive key names. + # An object that responds to `#filter_param(key, value)`, such as + # ActiveSupport::ParameterFilter: given a key name and nil, it returns nil when the key is + # not sensitive, and otherwise the value that replaces the key's value. + # An object that responds to `#call(name)`, such as a Proc: given a key name, it returns + # whether the key is sensitive. + # + # The answer for each key is remembered (see #replacement_for), so the same key name must + # always get the same answer. + # + # Raises ArgumentError for any other value. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:69 + def initialize(sensitive_keys); end + + # Returns a copy of the value in which the value of every sensitive key is replaced, at any + # depth, or the value itself when it has no sensitive key, so that what the formatters write + # only changes when something is redacted. The exceptions are a structure that holds itself, + # cut off with CIRCULAR, and one nested deeper than MAX_DEPTH, replaced with NESTED_TOO_DEEPLY. + # + # Looks inside the keys and values of the structures that the formatters write as JSON objects + # and arrays (see Utils.structure?), such as a Hash, Array, Set, Struct, or Data, and inside an + # object that responds to #to_unsafe_h, such as ActionController::Parameters. A copy is a Hash or + # an Array, as they write it. Any other value is returned as it is. The value and the structures + # in it are never changed, since they can be the application's own, or be shared by other log + # entries, as named tags are. + # + # Never raises a StandardError: when the value cannot be redacted, such as when the sensitive + # keys raise, it is replaced whole, and the error is reported to the internal logger. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:89 + def redact(value); end + + # Returns the value that replaces the value of a sensitive key, or nil when the key is not + # sensitive, or is neither a Symbol nor a String. + # + # The answer is remembered (see #remember), since asking the sensitive keys costs far more than + # looking it up. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:103 + def replacement_for(key); end + + # Returns the sensitive keys, as supplied. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:51 + def sensitive_keys; end + + private + + # Asks the sensitive keys about the key's name, and when that is not sensitive, about each of its + # snake_case forms (see #snake_case_forms). + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:154 + def ask(key); end + + # Returns [Hash] a new Hash with the first count pairs of the members. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:233 + def hash_head(members, count); end + + # Returns [Proc] given a key name, the value that replaces a sensitive key's value, or nil. + # Raises ArgumentError when the sensitive keys are not one of the values #initialize accepts. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:118 + def matcher_for(sensitive_keys); end + + # Returns the members of a structure (see #structure?), usually a Hash or an Array. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:271 + def members_of(value); end + + # Returns [Regexp] the pattern for one of an Array of sensitive keys (see #initialize). + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:141 + def pattern_for(key); end + + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:136 + def regexp_matcher(regexp); end + + # Remembers the answer for the key, unless its name is longer than MAX_REMEMBERED_KEY_LENGTH. + # When MAX_REMEMBERED_KEYS are already remembered, they are forgotten first, so that the keys + # being logged now are remembered, rather than the first ones ever seen. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:169 + def remember(key, replacement); end + + # Reports an error raised while redacting to the internal logger. Only its class and where it + # was raised: its message, or the exception given to the internal logger, could hold the data + # being redacted. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:300 + def report(exception); end + + # Returns [Array] the key name in snake_case, in one or two forms, or none when it is + # snake_case already: words split where a lower case letter or digit meets a capital, such as + # "x_api_key" for "X-Api-Key", "api_key" for "apiKey", and "session_ids" for "sessionIDs"; and + # when it differs, with a run of capitals also split before its last capital, so that an + # acronym starts a word of its own, such as "api_key" for "APIKey" and "otp_code" for "OTPCode". + # Asking about both means a plural acronym, which the second form splits into "session_i_ds", is + # still matched by the first. + # + # Each pattern takes time in proportion to the length of the name, on JRuby too, since a key + # name can be long and chosen by whoever sends a request. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:285 + def snake_case_forms(name); end + + # Whether the value is a structure that #walk looks inside: one that the formatters write as a + # JSON object or array (see Utils.structure?), or an object that responds to #to_unsafe_h, such + # as ActionController::Parameters, which they write with all of its parameters. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:260 + def structure?(value); end + + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:295 + def to_snake_case(words); end + + # Returns the redacted copy of the value, or the value itself when nothing in it is sensitive. + # + # seen maps each structure being walked, or already walked, to its result, so that a structure + # held more than once is walked once, and one that holds itself is cut off rather than copied + # with the original, unredacted, structure inside. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:184 + def walk(value, seen, depth); end + + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:244 + def walk_array(value, members, seen, depth); end + + # Copies are only made from the first value that changes, since most entries have no sensitive + # key, and the structures before it are kept. + # + # A key that is itself a structure, which the formatters write as its JSON, is redacted too. + # + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:214 + def walk_hash(value, members, seen, depth); end + + # pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:197 + def walk_members(value, members, seen, depth); end +end + +# Replaces a structure found again inside itself, which cannot be copied whole. +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:18 +SemanticLogger::Redactor::CIRCULAR = T.let(T.unsafe(nil), String) + +# No snake_case forms of a key name, for one that is in snake_case already (see #snake_case_forms). +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:38 +SemanticLogger::Redactor::EMPTY_FORMS = T.let(T.unsafe(nil), Array) + +# What the sensitive keys can be, for the error raised for any other value. +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:46 +SemanticLogger::Redactor::EXPECTED = T.let(T.unsafe(nil), String) + +# The value that replaces a sensitive one, unless the sensitive keys supply their own (see +# #initialize). The same as Rails uses for its filtered parameters. +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:15 +SemanticLogger::Redactor::MASK = T.let(T.unsafe(nil), String) + +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:24 +SemanticLogger::Redactor::MAX_DEPTH = T.let(T.unsafe(nil), Integer) + +# How many keys the answer is remembered for (see #remember). Log entries use the same few keys +# over and over, but the names of request parameters, for example, are chosen by whoever sends +# the request, so neither how many nor how long they are is left to them. +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:32 +SemanticLogger::Redactor::MAX_REMEMBERED_KEYS = T.let(T.unsafe(nil), Integer) + +# The longest key name, in characters, that the answer is remembered for (see #remember). +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:35 +SemanticLogger::Redactor::MAX_REMEMBERED_KEY_LENGTH = T.let(T.unsafe(nil), Integer) + +# Replaces a structure nested deeper than the formatters write (see Utils.json_safe), so that +# walking it can never overflow the stack. +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:22 +SemanticLogger::Redactor::NESTED_TOO_DEEPLY = T.let(T.unsafe(nil), String) + +# A key name in snake_case already, which is not converted (see #snake_case_forms). +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:27 +SemanticLogger::Redactor::SNAKE_CASE = T.let(T.unsafe(nil), Regexp) + +# Stands for a key not yet asked about in the remembered answers, in which nil means "not sensitive". +# +# pkg:gem/semantic_logger#lib/semantic_logger/redactor.rb:42 +SemanticLogger::Redactor::UNKNOWN = T.let(T.unsafe(nil), Object) + +# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:865 +module SemanticLogger::Reporters; end + +# When using Minitest to run tests, log start and end messages for every test to the log file. +# On completion the time it took to run the test is also logged. +# +# For example, add the following lines to `test_helper.rb`: +# require 'minitest/reporters' +# +# reporters = [ +# Minitest::Reporters::ProgressReporter.new, +# SemanticLogger::Reporters::Minitest.new +# ] +# Minitest::Reporters.use!(reporters) +# +# And add `gem minitest-reporters` to the Gemfile. +# +# Log entries similar to the following should show up in the log file: +# +# 2019-02-06 18:58:17.522467 I [84730:70256] Minitest -- START MyJob test_0001_archives file +# 2019-02-06 18:58:17.527492 I [84730:70256] (4.980ms) Minitest -- PASS MyJob test_0001_archives file +# 2019-02-06 18:58:17.527835 I [84730:70256] Minitest -- START MyJob test_0002_returns job class +# 2019-02-06 18:58:17.529761 I [84730:70256] (1.882ms) Minitest -- PASS MyJob test_0002_returns job class +# +# pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:23 +class SemanticLogger::Reporters::Minitest < ::Minitest::AbstractReporter + include ::SemanticLogger::Loggable + + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:34 + def after_test(test); end + + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:30 + def before_test(test); end + + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:28 + def io; end + + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:28 + def io=(_arg0); end + + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 + def logger; end + + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 + def logger=(logger); end + + class << self + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 + def logger; end + + # pkg:gem/semantic_logger#lib/semantic_logger/reporters/minitest.rb:24 + def logger=(logger); end + end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:10 +class SemanticLogger::Subscriber < ::SemanticLogger::Base + # Initializer for Abstract Class SemanticLogger::Subscriber + # + # Parameters + # level: [:trace | :debug | :info | :warn | :error | :fatal] + # Override the log level for this subscriber. + # Default: none (:trace), so it writes every entry that a logger emits; each logger filters by + # its own level (see #fallback_level). + # + # formatter: [Object|Proc] + # An instance of a class that implements #call, or a Proc to be used to format + # the output from this subscriber + # Default: Use the built-in formatter (See: #call) + # + # filter: [Regexp|Proc] + # RegExp: Only include log messages where the class name matches the supplied. + # regular expression. All other messages will be ignored. + # Proc: Only include log messages where the supplied Proc returns true + # The Proc must return true or false. + # + # application: [String] + # Name of this application to appear in log messages. + # Default: SemanticLogger.application + # + # host: [String] + # Name of this host to appear in log messages. + # Default: SemanticLogger.host + # + # metrics: [Boolean] + # Whether to log metric only entries with this subscriber. + # Default: false + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:343 + def initialize(level: T.unsafe(nil), formatter: T.unsafe(nil), filter: T.unsafe(nil), application: T.unsafe(nil), environment: T.unsafe(nil), host: T.unsafe(nil), metrics: T.unsafe(nil), &block); end + + # Allow application name to be set globally or on a per subscriber basis. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:36 + def application; end + + # Allow application name to be set globally or on a per subscriber basis. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:13 + def application=(_arg0); end + + # Whether #batch writes none of the log messages when it raises a message error (see + # #message_error?), for example because it formats every message before sending any. + # + # When true, a batch that fails with a message error is split up and each part retried, + # so that only the offending message is discarded. When false, retrying could write some + # messages twice, so the whole batch is discarded instead. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:164 + def batch_all_or_nothing?; end + + # Whether an appender that implements #batch should be wrapped in a batch + # proxy automatically. Appenders that support batching but should only batch + # when explicitly requested (via `batch: true`) override this to return false. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:110 + def batch_by_default?; end + + # Returns [String] why this appender cannot be batched, and what to do instead, or nil when it + # can. add_appender asks it before it batches the appender, with `batch: true` or by default, see + # #batch_by_default?, and raises ArgumentError with it, after "add_appender cannot batch : ", + # rather than add an appender whose worker thread fails on every batch, and so writes nothing. + # + # Nil, since a #batch that writes each log message, formatted by #format_log, works with any + # formatter. A class whose own #batch cannot write a batch, with some formatters or at all, + # answers for that #batch, and only while it is the #batch in use (see #batch_defined_by?), so + # that a subclass that replaces it is batched as before. Appender::Http does, since its #batch + # formats the whole batch with #format_batch, which needs a formatter that can, see + # #format_batch_refusal. A subclass whose #batch calls super keeps that need, so it answers too, + # usually with #format_batch_refusal. One that inherits a #batch that its destination rejects, + # whatever the formatter, such as Appender::ElasticsearchHttp, says why, and what to use instead. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:127 + def batch_refusal; end + + # A subscriber should implement close if it can. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:21 + def close; end + + # Whether this appender is logging to stdout or stderr. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:83 + def console_output?; end + + # The console stream this appender writes to, if any. + # Returns one of :stdout, :stderr, or nil when not writing to a console stream. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:78 + def console_stream; end + + # Returns [SemanticLogger::Formatters::Default] default formatter for this subscriber. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:31 + def default_formatter; end + + # Allow environment name to be set globally or on a per subscriber basis. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:41 + def environment; end + + # Allow environment name to be set globally or on a per subscriber basis. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:13 + def environment=(_arg0); end + + # Whether the supplied exception, a message error (see #message_error?) that #batch raised, + # would fail any batch, whatever messages it holds, such as a request the destination refuses + # for its credentials or its url. Asked only about a message error, and only when + # #batch_all_or_nothing? is true, or #rejected_entry names a message. + # + # When true, the whole batch is discarded at once, rather than split up and each part written + # again to find the messages at fault, which would be refused in turn, about two writes for each + # message. False, since an error caused by the content of a message is caused by some of the + # messages in the batch. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:177 + def fails_any_batch?(_exception); end + + # A subscriber should implement flush if it can. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:16 + def flush; end + + # Every appender has its own formatter + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:12 + def formatter; end + + # Set the formatter from Symbol|Hash|Block + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:62 + def formatter=(formatter); end + + # Allow host name to be set globally or on a per subscriber basis. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:46 + def host; end + + # Allow host name to be set globally or on a per subscriber basis. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:13 + def host=(_arg0); end + + # Returns [String] the class and object address of this appender, like Kernel#inspect, followed + # by #inspect_details, but none of its instance variables. + # + # Appenders hold credentials in their instance variables: passwords and urls holding them, api + # keys and tokens, request headers, private keys, and the options passed to a client gem. + # Printing SemanticLogger.appenders, for example in a console or an error report, must not + # show them. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:94 + def inspect; end + + # Returns [String] what #inspect shows about this appender, such as its url without its + # credentials, or nil for nothing. Only an appender knows which of its settings are safe to + # show, so each one overrides this. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:103 + def inspect_details; end + + # Method called to log an event + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:26 + def log(log); end + + # Give each appender its own logger for logging. + # For example trace messages sent to services or errors when something fails. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:52 + def logger; end + + # Give each appender its own logger for logging. + # For example trace messages sent to services or errors when something fails. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:13 + def logger=(_arg0); end + + # Whether the supplied exception, raised by #log or #batch, was caused by the content of a + # log message, or is one that writing the message again cannot fix, such as a request the + # destination refuses outright, rather than by the destination being unavailable for now. + # + # Waiting cannot write such a message, so an asynchronous appender discards it and carries on + # straight away. On any other exception it backs off before carrying on, since the destination + # may be briefly unavailable, then writes the message (or the batch) again when #wrote_nothing? + # says that the write wrote none of it (see QueueProcessor::HeldWrite::MAX_RESENDS), or + # otherwise carries on with the next one, having discarded it. + # + # Every error raised by the formatter is one (see #format_log). An appender whose client + # raises its own errors for bad content can override this to recognize them. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:154 + def message_error?(exception); end + + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:13 + def metrics=(_arg0); end + + # Whether #log or #batch, when it raised the supplied exception, sent nothing to the destination, + # such as when it could not connect to it, so that the destination has not answered the write. + # Asked only once #wrote_nothing? has returned true for the exception. + # + # When true, writing the message, or batch, again after such a failure does not count towards + # QueueProcessor::HeldWrite::MAX_RESENDS: the limit is for a message the destination answers + # with a failure every time, such as a request it answers with a 429 that never clears, while + # one that cannot reach the destination during an outage is still written once it is back, as + # long as the worker thread keeps trying (async_max_retries). When false, every failure counts. + # + # False, since only the appender can tell. Appender::Http answers it from the error. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:230 + def not_sent?(_exception); end + + # Returns [Integer|nil] the position, counted from 0, of the log message in the batch that the + # destination rejected, when the supplied exception, a message error (see #message_error?) that + # #batch raised, says so, and the destination stored every message before that one. Nil when it + # cannot tell, as by default. + # + # When an Integer, the messages before that one are counted as written, that one is discarded, + # or, when the error would fail any batch (see #fails_any_batch?), it and every message after + # it, and the messages after it are written again as a batch. So none is written twice, and + # none that the destination did not reject is discarded, without splitting the batch to find + # the message at fault. Appender::SplunkHttp answers it from the HTTP Event Collector's response. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:191 + def rejected_entry(_exception); end + + # Whether this log entry meets the criteria to be logged by this appender. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:72 + def should_log?(log); end + + # Whether #log or #batch, when it raised the supplied exception, wrote none of the log messages + # it was given, so that writing them again cannot write any of them twice, and writing them + # again later may succeed. Asked only about an exception that is not a message error (see + # #message_error?), such as one raised because the destination is unavailable. + # + # When true, an asynchronous appender writes the same message, or batch, again once it has + # backed off. Once the destination has answered it with a failure after it was written again + # QueueProcessor::HeldWrite::MAX_RESENDS times, the appender discards it and carries on with the + # next one, unless it gives up after async_max_retries first. A write that never reached the + # destination (see #not_sent?) is not counted. When false, since the write may have written + # some or all of them, such as a request whose answer timed out after the destination stored + # it, or a batch written a message at a time, or since writing them again is bound to fail the + # same way, they are discarded instead. A flush or close does not wait for them: while one is + # waiting, they are discarded either way. + # + # A #log or #batch that writes the messages in more than one request must return false for an + # error from any request after the first, which the destination may follow having stored the + # messages of the earlier ones. + # + # False, since only the appender can tell. Appender::Http answers it from the error. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:215 + def wrote_nothing?(_exception); end + + private + + # Returns [true|false] whether the #batch in use is the one that `owner` defines, for a + # #batch_refusal that answers only for its own #batch, such as that of Appender::Http. False for + # any other, even one that calls super, such as one that a subclass, a prepended module, or the + # appender itself defines, and when it has none. Kernel#method finds it, since an appender may + # define a #method of its own, such as for the HTTP method of its requests. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:300 + def batch_defined_by?(owner); end + + # Returns [Hash] a copy of the supplied options, with a copy of each Hash among them, such as ssl:, for an + # appender to add its own settings to, or to give to a client it builds, which may change them: + # Net::TCPClient takes handshake_timeout: out of the ssl: Hash it is given. An appender never changes + # the Hashes it is given, which belong to the application: they can be frozen, or shared with another + # appender, and the next client the appender builds, such as after a reopen, needs them as they were. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:309 + def copy_options(options); end + + # Returns [true|false|nil] the `metrics` option of an appender that sends metric-only entries unless told + # otherwise: true when it is not supplied, see METRICS_NOT_SUPPLIED, with a deprecation warning, since v6 leaves + # them out by default, as the other log appenders do, otherwise the option as it was supplied. Remove in v6, with + # the METRICS_NOT_SUPPLIED default of the appenders that call it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:379 + def deprecated_metrics_default(metrics, appender); end + + # Without a level of its own, a subscriber logs everything it receives. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:357 + def fallback_level; end + + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:361 + def fallback_level_index; end + + # Returns the log messages formatted by the formatter's #batch, as for #format_log. + # + # A formatter that cannot format a batch, see #format_batch_refusal, is a configuration error + # rather than bad content, so it raises ArgumentError instead, which backs off and is reported + # like any other error from the destination. add_appender refuses such a formatter for an + # appender whose #batch_refusal says so, such as Appender::Http, so for one of those this only + # happens when #formatter= replaces it afterwards. + # + # The formatter is read once, so that one changed by #formatter= on another thread cannot be + # swapped in between the check and the call. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:266 + def format_batch(logs); end + + # Returns [String] why #format_batch cannot format a batch with the formatter, and what to do + # instead, or nil when it can. It needs a formatter that implements #batch(logs, logger), which a + # formatter block or Proc does not, other than this appender itself, which is its own formatter + # when it implements #call, and whose #batch is the appender's own. Such an appender sets the + # format of each entry that its destination takes, so the only advice for it is `batch: false`. + # + # #format_batch raises with it, and a #batch_refusal that answers for a #batch that calls + # #format_batch, such as that of Appender::Http, returns it, so that both give the same answer. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:286 + def format_batch_refusal(batch_formatter = T.unsafe(nil)); end + + # Returns the log message formatted by this appender's formatter. + # + # Any StandardError the formatter raises is raised as a FormatError, with the formatter's + # error as its cause, so that #message_error? recognizes it: an asynchronous appender then + # discards the message instead of backing off. Appenders call this rather than formatter.call. + # So is a ScriptError, such as the NotImplementedError of an abstract method, which would + # otherwise stop an asynchronous appender's thread, since that rescues only a StandardError. + # + # A SystemStackError is raised as it is, so that rescuing StandardError does not swallow it: + # the thread that overflowed must not keep writing (see Appenders#log). + # + # The block, when given, turns the formatter's output into what the appender sends, such as + # its JSON. An error doing so is also caused by the content of the message. + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:249 + def format_log(log); end + + # Whether to log metric only entries with this subscriber + # + # pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:366 + def metrics?; end +end + +# Raised by #format_log and #format_batch when the formatter fails, with the formatter's +# error as its cause. A formatter has no destination, so it can only fail because of the +# content of the log message, whatever it raises. +# +# pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:134 +class SemanticLogger::Subscriber::FormatError < ::StandardError; end + +# Errors raised by writing a log message whose content cannot be written, such as a +# value that cannot be serialized. Excludes JSON::ParserError, which comes from parsing a +# response rather than from the message, except its subclass JSON::NestingError, which +# JSON.generate raises for a value nested too deeply. +# +# pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:140 +SemanticLogger::Subscriber::MESSAGE_ERRORS = T.let(T.unsafe(nil), Array) + +# The default of the `metrics` option of the appenders that call #deprecated_metrics_default, so that it can tell +# an option that is not supplied from an explicit nil, which keeps meaning false. Remove in v6, with that method. +# +# pkg:gem/semantic_logger#lib/semantic_logger/subscriber.rb:372 +SemanticLogger::Subscriber::METRICS_NOT_SUPPLIED = T.let(T.unsafe(nil), Object) + +# The SyncProcessor performs logging in the current thread. +# +# Appenders are designed to only be used by one thread at a time, so all calls +# are monitor protected in case SyncProcessor is being used in a multi-threaded environment. +# +# Ruby does not allow a Monitor to be entered in a signal trap, so another thread runs a call made +# in a trap. A log entry is left on a queue of pending calls, which whoever next enters the monitor +# runs first, in order, and a thread started from the trap enters it to do so when nothing else does +# (see #defer). Every other call runs on a thread that the trap starts and waits for, at most +# TRAP_WAIT_SECONDS (see #outside_trap). Neither ever runs on the trap's thread, so that an appender +# can lock a Mutex of its own as it writes, flushes, closes, or reopens, as a Ruby Logger does. +# +# pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:13 +class SemanticLogger::SyncProcessor + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:141 + def initialize(appenders = T.unsafe(nil)); end + + # Add an appender. In a signal trap, as for #flush, which returns nil instead of the appender when + # it is not added in time. SemanticLogger.add_appender adds to the appenders directly instead. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:24 + def add(**args, &block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:133 + def appenders; end + + # Close the appenders, as for #flush in a signal trap. + # + # A stack overflow while closing is reported rather than raised, as by #log, since the calling + # thread belongs to the application, even when Appenders#close raises it, for the asynchronous + # Processor to move to a new thread. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:68 + def close; end + + # Returns [true|false] whether the calling thread is inside a call to this processor, such as in + # a signal trap that interrupted a log call. Another thread then waits for that call to return + # before it can use this processor, so the calling thread must not wait for one that does. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:106 + def current_thread_inside?; end + + # Flush the appenders. In a signal trap, a thread that the trap starts flushes them, after the + # entries logged in the trap before, and the trap waits for it, at most TRAP_WAIT_SECONDS, then + # returns its result, or raises what it raised. When it has not finished by then, such as when the + # trap interrupted a call inside this processor, which cannot return before the trap does, it + # returns nil and the flush runs just after. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:59 + def flush; end + + # Logs on the calling thread, which belongs to the application, so a stack overflow while + # writing (see Appenders#log) is reported rather than raised from the log call. + # + # In a signal trap, the entry is written just after, by another thread, before any entry logged + # after the trap, and the trap returns without waiting for it (see #defer). + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:33 + def log(log); end + + # Returns the internal logger of the appenders, for reporting a problem while logging, such as + # an exception raised by an on_log subscriber. The same logger as the asynchronous Processor's. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:137 + def logger; end + + # Returns [Integer] the number of entries logged in a signal trap that are still to be written + # (see #log), the only ones that wait in synchronous mode. Never enters the monitor. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:99 + def queue_size; end + + # Remove the appender from those that this processor writes to, and close it, once any log call + # writing to it has returned. Closes it after leaving the monitor, so that the other threads + # can log meanwhile. Returns the result of closing it, or, in a signal trap, as for #flush, nil + # when it is not closed in time. + # + # The appenders are reopened on the calling thread (see #reopen), so none is ever waiting to be + # reopened when it is removed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:84 + def remove(appender); end + + # Reopen the appenders on the calling thread, or, in a signal trap, as for #flush, so that an + # appender that connects or locks a Mutex as it reopens can do so. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:93 + def reopen(*args); end + + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:150 + def start; end + + # Returns [Hash] operational statistics for the logging pipeline. + # + # In synchronous mode messages are written inline on the calling thread, so the queue holds only + # the entries logged in a signal trap that are still to be written (see #log), and no messages + # are dropped. In a trap it reads them without entering the monitor. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:49 + def stats; end + + private + + # Leaves the block, given in a signal trap, on the queue of pending calls, and starts a thread to + # run them, unless one is running (see #start_runner). Never waits. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:203 + def defer(&block); end + + # Runs the block inside the monitor, after the pending calls, and returns its value, or returns + # TRAPPED, without running it, in a signal trap. Leaves the monitor even when a pending call + # raises past its rescue, such as Timeout or Thread#raise, so that no other thread waits for ever. + # + # A call made by the thread already inside, such as by an appender while it writes, runs at once, + # as it always has, without the pending calls, which may write to the appender in the middle of + # its write. Monitor#enter raises ThreadError in a trap, even when no other thread is inside, so + # it tells a trap without a check of its own, except when the trap interrupted the thread inside, + # which the monitor lets in again. The thread inside runs the calls that such a trap left before + # it leaves the monitor. Monitor#enter also raises ThreadError outside a trap, for a fiber when + # another fiber of its thread is inside, which is raised again, as before. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:167 + def exclusively; end + + # In a forked child, forgets the calls left pending in the parent, which the parent runs, and the + # parent's runner, which the child does not have. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:259 + def forget_parent_calls; end + + # Runs the block, given in a signal trap, on a thread that the trap starts, and returns its value, + # waiting at most TRAP_WAIT_SECONDS for it (see TrapSafe.hand_off). Does not wait when the trap + # interrupted the thread inside the monitor, since that thread cannot leave it before the trap + # returns. Outside the trap, the block enters the monitor and runs the pending calls first. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:213 + def outside_trap(&); end + + # Returns [Integer] the number of calls left pending by signal traps in this process. In a forked + # child, those of the parent are not counted, before the child forgets them (see + # #forget_parent_calls). Changes nothing, so that it can run in a trap without the monitor. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:275 + def pending_count; end + + # Run the calls left by signal traps, in the order they were made. Called inside the monitor, on + # any thread, so it reports what a call raises instead of raising it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:244 + def run_pending; end + + # Starts a thread that enters the monitor and runs the pending calls, unless one is running. + # + # Called in a signal trap, where a Mutex cannot be locked, after it left a call on the queue. The + # runner clears @runner, and only then checks for calls still pending, which it runs before it + # checks again. So a runner that this finds in @runner has not yet made that check, and runs the + # call left, and a call left after that check finds no runner and starts one. The runner waits + # until @runner holds it, so that it never clears it before. Two runners may run at once, rarely, + # which is harmless. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:225 + def start_runner; end + + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:279 + def statistics; end + + # Runs the block inside the monitor and returns its value, or, in a signal trap, runs it on a + # thread that the trap starts, as #outside_trap does. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:196 + def synchronize(&block); end + + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:267 + def write(log); end + + class << self + # Internal logger for SemanticLogger + # For example when an appender is not working etc.. + # By default logs to $stderr + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:124 + def logger; end + + # Allow the internal logger to be overridden from its default of $stderr + # Can be replaced with another Ruby logger or Rails logger, but never to + # SemanticLogger::Logger itself since it is for reporting problems + # while trying to log to the various appenders (raises ArgumentError) + # + # A Ruby or Rails logger is wrapped in an appender (see Appender.internal_logger), so .logger + # returns that appender. + # + # pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:117 + def logger=(logger); end + end +end + +# Returned by #exclusively, which does not run its block, in a signal trap. +# +# pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:19 +SemanticLogger::SyncProcessor::TRAPPED = T.let(T.unsafe(nil), Object) + +# Seconds that a call other than a log call, such as a flush or a reopen, waits in a signal trap +# for the thread that runs it. It may need a lock that the thread the trap interrupted holds. +# +# pkg:gem/semantic_logger#lib/semantic_logger/sync_processor.rb:16 +SemanticLogger::SyncProcessor::TRAP_WAIT_SECONDS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/semantic_logger#lib/semantic_logger/semantic_logger.rb:869 +module SemanticLogger::Test; end + +# Logging class to captures all logging events in memory. +# +# Example: +# +# class UserTest < ActiveSupport::TestCase +# describe User do +# let(:logger) { SemanticLogger::Test::CaptureLogEvents.new } +# let(:user) { User.new } +# +# it "logs message" do +# user.stub(:logger, logger) do +# user.enable! +# end +# assert log = logger.events.first +# assert_equal "Hello World", log.message +# assert_equal :info, log.level +# end +# end +# end +# +# pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:22 +class SemanticLogger::Test::CaptureLogEvents < ::SemanticLogger::Subscriber + # By default collect all log levels, and collect metric only log events. + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:26 + def initialize(level: T.unsafe(nil), metrics: T.unsafe(nil)); end + + # Supports batching of log events + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:42 + def batch(logs); end + + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:46 + def clear; end + + # Returns [false]: standing in for the processor, it holds no lock, so another thread never + # waits for the calling thread to return from a call to it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:52 + def current_thread_inside?; end + + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:23 + def events; end + + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:23 + def events=(_arg0); end + + # Standing in for a logger, it runs the `on_log` subscribers for the log events it created, as a + # logger does. Log events from a logger, received as the processor or an appender, already + # went through them. A log event built elsewhere and passed to `#log` is captured without + # running them, since it cannot be told apart from one received from a logger. + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:36 + def log(log); end + + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:56 + def to_h; end + + private + + # Without a level of its own, follow the global default level the way a logger does, + # so that `SemanticLogger.silence` applies. + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:71 + def fallback_level_index; end + + # Remember each log event created while standing in for a logger. + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/capture_log_events.rb:63 + def new_log(*, **, &); end +end + +# pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:3 +module SemanticLogger::Test::Minitest + # Verify a single log event has all the required attributes. + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:24 + def assert_semantic_logger_event(event, level: T.unsafe(nil), name: T.unsafe(nil), message: T.unsafe(nil), message_includes: T.unsafe(nil), payload: T.unsafe(nil), payload_includes: T.unsafe(nil), exception: T.unsafe(nil), exception_includes: T.unsafe(nil), backtrace: T.unsafe(nil), call_site: T.unsafe(nil), thread_name: T.unsafe(nil), tags: T.unsafe(nil), named_tags: T.unsafe(nil), context: T.unsafe(nil), level_index: T.unsafe(nil), duration: T.unsafe(nil), time: T.unsafe(nil), metric: T.unsafe(nil), metric_amount: T.unsafe(nil), dimensions: T.unsafe(nil)); end + + # Returns [Array] the log events from Semantic Logger + # captured whilst executing the supplied block. + # + # Notes: + # - All log messages are returned regardless of the global default log level. + # + # pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:9 + def semantic_logger_events(deprecated_klass = T.unsafe(nil), klass: T.unsafe(nil), silence: T.unsafe(nil), &block); end + + private + + # pkg:gem/semantic_logger#lib/semantic_logger/test/minitest.rb:77 + def assert_semantic_logger_entry(event, name, expected, actual = T.unsafe(nil)); end +end + +# Internal: locks a Mutex only where Ruby allows it, for code that can run in a signal trap, such as +# a trap that logs, or one that reopens the log files after a rotation. +# +# Ruby raises ThreadError for Mutex#lock in a trap. Queue and Thread methods are allowed there, so +# a caller that cannot lock leaves its work on a Queue, or to a new Thread, instead. +# +# pkg:gem/semantic_logger#lib/semantic_logger/trap_safe.rb:7 +module SemanticLogger::TrapSafe + class << self + # Returns the value that the Concurrent::Map holds for the key, adding the one that the block + # returns when it holds none, as Concurrent::Map#compute_if_absent does. + # + # Adding to it locks a Mutex on CRuby, so in a signal trap a new thread adds the block's value, + # which the trap waits for, at most ADD_WAIT_SECONDS (see .hand_off), then returns the value that + # the map holds. The new thread cannot add it while the thread that the trap interrupted is adding + # to the map, holding its Mutex: the trap then returns the block's value, and the new thread adds + # it just after the trap, unless another thread has added one for the key by then. + # + # pkg:gem/semantic_logger#lib/semantic_logger/trap_safe.rb:47 + def compute_if_absent(map, key, &); end + + # Runs the block on a new thread, for code in a signal trap whose work locks a Mutex, and waits for + # it at most the given seconds, since that thread may need a lock that the thread the trap + # interrupted holds, which it cannot release before the trap returns. + # + # Returns the block's value, or raises what it raised, when it finished in time. Otherwise returns + # nil, and the block finishes after that, when Ruby reports what it raises, if anything, as for any + # thread (see Thread#report_on_exception). Either way an exception is raised or reported, never + # both: the caller and the thread each take the one token of a queue, without waiting, as the + # caller stops waiting and as the block finishes, and whichever takes it first decides. + # + # pkg:gem/semantic_logger#lib/semantic_logger/trap_safe.rb:65 + def hand_off(seconds); end + + # Returns [true|false] whether the calling code runs in a signal trap, for code that writes to a + # structure that locks a Mutex of its own, such as a Concurrent::Map on CRuby, which it then must + # not write to. A new Mutex is never held, so only a trap keeps it from being locked. + # + # pkg:gem/semantic_logger#lib/semantic_logger/trap_safe.rb:33 + def in_trap?; end + + # Runs the block holding the mutex, and returns true. Returns false, without running the block, + # where the mutex cannot be locked: in a signal trap, or on a thread that already holds it, such + # as one that a signal trap interrupted while it did. A ThreadError raised by the block itself is + # raised again. + # + # pkg:gem/semantic_logger#lib/semantic_logger/trap_safe.rb:15 + def try_synchronize(mutex); end + + private + + # Called when the caller of .hand_off is interrupted, such as by another signal, before it decided who + # gets the block's outcome: it lets the thread start, then takes the token if the thread has not, so + # that Ruby reports what the block raises, and otherwise, once the thread has finished, reports it + # here, as Ruby would have, to standard error, so that it is never lost. An interrupt while it waits + # for the thread is raised, not reported as the block's. + # + # pkg:gem/semantic_logger#lib/semantic_logger/trap_safe.rb:99 + def report_outcome(thread, token, started); end + end +end + +# Seconds that .compute_if_absent waits in a signal trap for a new thread to add the value. +# +# pkg:gem/semantic_logger#lib/semantic_logger/trap_safe.rb:9 +SemanticLogger::TrapSafe::ADD_WAIT_SECONDS = T.let(T.unsafe(nil), Float) + +# Internal-use only utility functions for Semantic Logger. +# Not intended for public use. +# +# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:8 +module SemanticLogger::Utils + class << self + # Returns a bounded copy of a structure, such as a Hash or Array, for .json_safe, .encode_utf8, + # or an appender that copies log data for a gem that writes it itself: what the block returns for its + # members, given the next depth and the structures it is inside of, or, for one nested deeper + # than MAX_JSON_SAFE_DEPTH or that holds itself, a placeholder String naming its class, such + # as "#", in place of the structure. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:368 + def bounded_structure(value, depth, ancestors); end + + # Borrow from Rails, when not running Rails + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:93 + def camelize(term); end + + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:9 + def constantize_symbol(symbol, namespace = T.unsafe(nil)); end + + # Returns a copy of the supplied value with every String converted to valid UTF-8, and every + # Symbol whose name is not UTF-8 or ASCII converted the same way (see .encode_utf8_symbol). + # + # Recurses through Hash and Array structures, cleansing both keys and values. + # Strings that are already valid UTF-8 are returned unchanged (the common case), + # and so are Symbols that are UTF-8 or ASCII, so the fast path allocates nothing. Any + # other value (Numeric, Time, nil, a Struct, ...) is returned as-is, without looking + # inside it. + # + # A Hash or Array nested deeper than MAX_JSON_SAFE_DEPTH, or that holds itself, is + # replaced where it is too deep or repeats with the placeholder that .json_safe writes, + # such as "#", so that the copy is bounded, as .json_safe is. + # + # Used by formatters that serialize per value or emit to a non-JSON sink (where a + # single `.to_json` rescue boundary cannot catch an intermediate failure), and by + # appenders that hand log data to a gem that writes it itself. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:446 + def encode_utf8(value, depth = T.unsafe(nil), ancestors = T.unsafe(nil)); end + + # Returns the string converted to valid UTF-8, dropping any invalid bytes. + # + # Binary text, such as a response body, Base64-decoded text, or a C extension's error message, + # and US-ASCII text that holds bytes outside ASCII, such as a file read where no locale is set, + # do not say which characters those bytes are. They are read as the UTF-8 they usually hold, + # keeping its characters, as the json gem did before 3.1. Converting them would drop every byte + # outside ASCII, valid UTF-8 or not, since neither encoding defines one. Text in any other + # encoding, such as ISO-8859-1, is converted, and text tagged UTF-16 or UTF-32 (not UTF-16LE + # and the like) without a byte order mark is read as big-endian (see .encode_byte_ordered). + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:482 + def encode_utf8_string(string); end + + # Returns [Symbol] the Symbol, or, when its name is neither UTF-8 nor ASCII, a Symbol named with + # that name converted to valid UTF-8 (see .encode_utf8_string). + # + # A Symbol is named in the encoding of the text it was made from, such as a binary key from a + # request turned into a Symbol, which JSON cannot always write once it holds bytes outside + # ASCII: from json 3.1 not even valid UTF-8, and on CRuby with earlier versions not invalid + # bytes, nor, from json 2.9, UTF-8 bytes tagged US-ASCII. A UTF-8 Symbol is always valid. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:504 + def encode_utf8_symbol(symbol); end + + # Returns [String] the exception's message, without raising the error that its #message raises. + # + # An exception class can override #message or #to_s with code that raises, such as code that + # reads a record that is nil, or an abstract #message that raises NotImplementedError. Logging the + # exception must not replace it with that error, such as the one that a measure_* block re-raises. + # When #message raises a StandardError or a ScriptError, or does not return a String or an object + # that converts to one, the message the exception was raised with is returned instead (see + # .raised_message). Other errors, such as Interrupt, still propagate. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:153 + def exception_message(exception); end + + # Returns [String] the name of the exception's class as Ruby names it, as in Exception#inspect and + # #full_message: the constant it was assigned to, such as "Net::ReadTimeout", or, for an + # anonymous class, which has none, the class as Ruby writes it, such as `#`. It is + # in UTF-8, whatever the constant's encoding, such as ISO-8859-1, so that it joins with UTF-8 text. + # Every place that writes an exception's class asks this, so that they all name it alike. + # + # Never runs the class's own code, which can override self.name, self.to_s, or self.inspect with + # code that raises, or that names the class otherwise. Module's own #to_s, bound to the class, + # returns what Module#name returns when the class has a name, and the class written out when not. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:143 + def exception_name(exception); end + + # Extract the backtrace stripping off the leading semantic logger entries. + # Leaves all other system and gem path entries in place. + # Returns a new Array, leaving the supplied stack unchanged since it can belong to the caller. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:104 + def extract_backtrace(stack = T.unsafe(nil)); end + + # Whether this path should be excluded from any cleansed backtrace + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:112 + def extract_path?(path); end + + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:109 + def extract_paths; end + + # Returns [String] the lines, such as those of a backtrace, joined into a new String with a line + # break between each, whatever their encodings: as they are, as Array#join joins them, or, when + # that would raise, such as for a UTF-8 line and an ISO-8859-1 one that both hold bytes outside + # ASCII, with each line formatted as .join_texts formats a text and converted to valid UTF-8 + # (see .encode_utf8_string), which leaves a valid UTF-8 line as it is. + # + # Joined text that is binary or US-ASCII and holds bytes outside ASCII is converted to valid UTF-8 + # too, such as for an ASCII line and a binary one, or for Ruby's own backtrace lines, which are + # US-ASCII where no locale is set, in a directory such as café. Unlike .join_texts, which keeps + # text binary when it starts with binary text, such as when every text is binary, this converts + # such text even when every line is binary. Each line of such text is in that encoding or + # ASCII-only, so it is converted whole, as each line would be. Its encoding is checked first, + # since checking that it is ASCII-only reads the whole text. + # + # Lines are converted only when they cannot be joined as they are, which is rare, since checking + # each of what can be dozens of lines would double the time it takes to format an exception. + # Each is then converted once and the lines joined once, rather than pair by pair as .join_texts + # joins texts, which for a backtrace of thousands of lines takes a time that grows with the + # square of their number. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:567 + def join_lines(lines); end + + # Returns [String] the texts joined into a new String, such as a log message and an exception's + # message, whatever their encodings. + # + # Texts are joined as they are, so that text in an encoding such as ISO-8859-1 can still be + # joined with the application's other text in that encoding. Two texts are converted to valid + # UTF-8 first (see .encode_utf8_string) only when joining them would raise, such as for UTF-8 + # and binary texts that both hold bytes outside ASCII, or would make text that is not binary + # binary, such as an ASCII message joined with a binary exception message. + # + # Each text is formatted as interpolation would, rather than added or converted with #to_s, so + # that a String subclass whose #+ escapes the text added to it, such as + # ActiveSupport::SafeBuffer, is joined as plain text, and an object whose #to_s does not return a + # String is still joined. + # + # Plain Strings that are all UTF-8, the usual texts, always join as they are, so they are joined + # without those checks, which take several times as long. With an explicit separator, a new + # empty String, so that a global `$,` set by another library is not added between them. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:538 + def join_texts(*texts); end + + # Returns [true|false] whether the value is a structure that the JSON formatters write as an array + # of its own elements (see .structure_members): an Array or a Set. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:414 + def json_array?(value); end + + # Returns the value when JSON writes it as it is, otherwise a .json_safe copy, for a writer + # that serializes the value itself, such as GELF. The check costs one #to_json; only the + # rare value that needs repairing is copied. + # + # That includes a value holding a binary String that json 2.8 through 3.0.x warn about, since + # the writer's own serializing is not Semantic Logger's, so it would print the warning. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:208 + def json_ready(value); end + + # Returns a copy of the supplied value that JSON can represent: + # * Every String is converted to valid UTF-8, as by .encode_utf8, and so is the name of every + # Symbol, such as a Hash key, that is not UTF-8 or ASCII (see .encode_utf8_symbol). + # * Infinity and NaN floats become the Strings "Infinity", "-Infinity", and "NaN". + # * A Struct, Data, or OpenStruct instance becomes a Hash of its members (from #to_h), + # and a Set an Array, as ActiveSupport's #as_json does, so that its members follow + # these same rules. + # * A Hash key that is itself a structure becomes the JSON of its copy, since JSON writes a + # key with #to_s, which for a structure is its #inspect. + # * Any other object whose JSON raises because of invalid UTF-8, such as an exception + # message or a Pathname built from an uploaded file name, becomes its #to_s converted to + # valid UTF-8. + # * A Hash, Array, Set, Struct, or Data nested deeper than MAX_JSON_SAFE_DEPTH is replaced + # with a placeholder String naming its class, such as "#". + # So is one that holds itself, at the point where it would repeat. + # Any other value is returned as-is. + # + # The recursion never goes deeper than MAX_JSON_SAFE_DEPTH, and the placeholder does + # not look inside the structure it replaces. Rendering it instead (for example with + # #inspect) would recurse without limit through an arbitrarily deep structure, + # raising SystemStackError (or crashing Ruby) on the appender's thread, and would + # expose the instance variables of any object inside it. Ending a self-referencing + # structure where it repeats, rather than at that depth, keeps one that holds itself + # more than once from being copied an exponential number of times. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:347 + def json_safe(value, depth = T.unsafe(nil), ancestors = T.unsafe(nil)); end + + # Returns the value, deep frozen so that code in any Ractor can read the constant or setting + # that holds it. + # + # copy: false freezes the value itself, so only use it for a value that Semantic Logger owns, such + # as one of its constants. A value this Ruby cannot share, such as an UnboundMethod before Ruby 4.0, + # is returned unshareable, and may be left partly frozen. On a Ruby without Ractors (JRuby) the + # value is returned as it is. + # + # copy: true leaves the supplied value as it is, and returns a deep frozen copy of it, for a value + # that belongs to someone else, such as a setting. Without Ractors, or for a value Ruby cannot + # copy, the copy is a shallow frozen dup. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:73 + def make_shareable(value, copy: T.unsafe(nil)); end + + # Returns [true|false] whether the value holds a Hash, Array, Struct, or Data nested deeper + # than MAX_JSON_SAFE_DEPTH, which .json_safe would replace with a placeholder. Never recurses + # deeper than that itself, and follows the same rules as .json_safe. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:276 + def nested_too_deeply?(value, depth = T.unsafe(nil)); end + + # Returns [URI] the parsed url, supplied as the named option. + # + # Raises URI::InvalidURIError for an invalid url, including nil, as .without_url_in_errors does. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:33 + def parse_url(url, option: T.unsafe(nil), hint: T.unsafe(nil)); end + + # Returns [String] the message the exception was raised with, without what its class's own + # #message or #to_s adds: its class name when it was raised without one. Its class name too when + # that message cannot be converted to a String, since converting it raised a StandardError or a + # ScriptError (see .exception_message). + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:163 + def raised_message(exception); end + + # Returns [String] the scheme, host, and any non-default port of the url, which is safe to log. + # + # Everything else is left out, since log services carry credentials in each part of a url: the + # user and password, the query string (for example a Datadog api key), and the path (for example + # the token at the end of a Sumo Logic HTTP source url). An invalid url is not shown at all. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:54 + def redacted_url(url); end + + # Returns [String] value#inspect, or what the block renders the value as (for example with + # Amazing Print), without overflowing the stack for a value nested too deeply. + # + # #inspect has no depth limit: a Hash a few hundred levels deep overflows the stack of a + # thread. Rescuing the SystemStackError is not enough, since on macOS a second such overflow + # on the same thread crashes Ruby instead. A value that holds a structure nested deeper than + # MAX_JSON_SAFE_DEPTH is therefore rendered from a .json_safe copy, as the JSON formatters + # write it, cut off at that depth with their placeholder. Only that case pays for the copy. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:268 + def safe_inspect(value); end + + # Returns [true|false] whether the code running now was called by this file to serialize log + # data, such as the json gem raising a warning (see CoreExt::Warning), or an object's own + # #to_json in a payload: whether the innermost of this file's frames on the stack is one of + # SERIALIZERS. When it is another of its methods, such as .exception_message calling + # an exception's #message, the code is not serializing log data, even if log data is being + # serialized further out. + # + # The stack is walked only as far as that frame, however deep it is, such as below nested + # objects whose #to_json serializes a Hash, so that the answer does not depend on the depth. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:226 + def serializing_log_data?; end + + # Try to strip everything off of the supplied backtrace, until the first application stack entry is at the top. + # For example all leading gem paths and built-in ruby code paths are removed from the top. + # Once the first application entry is found, the remaining stack is returned. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:117 + def strip_backtrace(stack = T.unsafe(nil)); end + + # Whether this path should be excluded from any cleansed backtrace + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:132 + def strip_path?(path); end + + # Paths to exclude in the stripped backtrace + # Includes Gems and built-in Ruby code paths + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:126 + def strip_paths; end + + # Returns [true|false] whether .json_safe writes the value as a JSON object or array: a Hash, + # Array, Set, Struct, Data, or OpenStruct. Every one of them would otherwise be written by its + # #to_s, which is its #inspect. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:306 + def structure?(value); end + + # Returns the members of a structure (see .structure?), as the JSON formatters write them: a + # Hash or an Array as it is, the elements of a Set as an Array, and the #to_h of a Struct, Data, + # or OpenStruct, which is a Hash unless that method returns something else. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:419 + def structure_members(value); end + + # Serializes the value to JSON, repairing the data only when necessary. + # + # Data that JSON cannot represent appears in well under 1% of log events, so it + # is wasteful to walk and reallocate the entire structure (see .json_safe) on + # every call. Instead this attempts `.to_json` directly and only falls back to a + # repaired copy when serialization fails because of the data: + # * Invalid UTF-8. Depending on the json gem version this raises + # Encoding::UndefinedConversionError (an EncodingError) or JSON::GeneratorError. + # From json 3.1 so does a binary String that holds bytes outside ASCII, even valid UTF-8, + # which earlier versions write as UTF-8, with a warning that is dropped for log data (see + # CoreExt::Warning). + # * Infinity and NaN, which raise JSON::GeneratorError. + # * Structures nested deeper than the json gem allows, which raise + # JSON::NestingError (a JSON::ParserError, not a GeneratorError). + # * A Struct, Data, Set, or OpenStruct instance. The json gem writes one as the String + # returned by its #to_s, which for each is #inspect: every member is written with + # #inspect, exposing the instance variables of any object it holds, and without a + # depth limit, so a deep enough structure raises SystemStackError. The output is + # checked for that rendering (a JSON String starting with "#<", or "Set[" for a Set on + # Ruby 4.0), and SystemStackError is rescued, so .json_safe can write the members as a JSON object + # or array instead. The json gem offers no hook for these short of strict mode, + # which also rejects common values such as Time, and finding one up front would mean + # walking every payload on the hot path. ActiveSupport already writes them through + # #as_json, and escapes "<", so its output never matches the check. + # + # Log data can come from untrusted input, for example a float parsed from a request + # parameter or a deeply nested request body. Without the repair, such a value would + # make the whole log event impossible to serialize, and so silently dropped. + # + # The retry is attempted only once: if it still fails (for example an object whose + # own #to_json raises), the error propagates unchanged rather than being swallowed. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:200 + def to_json(value); end + + # Returns the result of the block, which uses the url supplied as the named option, for example + # to build a client gem's connection. + # + # Raises any of the errors from the block again, of the same class, without the url in its + # message, or as its cause, since a url can hold a user and password, or a token in its path or + # query string, and URI and client gems put the url in the error for an invalid one. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:43 + def without_url_in_errors(option: T.unsafe(nil), hint: T.unsafe(nil), errors: T.unsafe(nil)); end + + private + + # Returns [String] the value's JSON, or nil when .to_json has to repair the data. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:232 + def clean_json(value); end + + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:514 + def encode_byte_ordered(string); end + + # Returns a copy of the members of a Hash or Array, each converted by .encode_utf8. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:459 + def encode_utf8_members(value, depth, ancestors); end + + # Returns a frozen shallow copy of the value, the value when it is already frozen, or the value + # itself when it cannot be copied, such as a Thread. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:85 + def frozen_dup(value); end + + # Returns a copy of the members of a Hash, Array, Set, Struct, Data, or OpenStruct (see + # .structure_members), each made safe by .json_safe at the supplied depth. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:394 + def json_safe_members(value, depth, ancestors); end + + # Returns any other object as it is, when JSON can write it, otherwise its #to_s converted + # to valid UTF-8. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:384 + def json_safe_object(value); end + + # Whether the members of a Struct, Data, or OpenStruct are nested too deeply. As in + # .json_safe_members, a #to_h that does not return a Hash is one level deeper. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:295 + def members_nested_too_deeply?(value, depth); end + + # Whether the value is an OpenStruct. The ostruct gem is only loaded by the application, and + # is a bundled gem since Ruby 4.0, so Semantic Logger never requires it. + # + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:317 + def open_struct?(value); end + + # pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:509 + def read_as_utf8(string); end + end +end + +# Options used when transcoding a string to UTF-8. +# Invalid byte sequences and characters that cannot be represented in UTF-8 are +# dropped rather than substituted, matching the preference in issue #180. +# +# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:471 +SemanticLogger::Utils::ENCODE_UTF8_OPTIONS = T.let(T.unsafe(nil), Hash) + +# Paths whose entries are stripped from the top of a captured backtrace. +# +# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:107 +SemanticLogger::Utils::EXTRACT_PATHS = T.let(T.unsafe(nil), Array) + +# How the json gem writes an object through its #to_s: a JSON String starting with "#<", as +# for a Struct, Data, Set, or OpenStruct, whose #to_s is its #inspect. +# +# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:248 +SemanticLogger::Utils::INSPECTED_OBJECT = T.let(T.unsafe(nil), String) + +# How the json gem writes a Set where Set#inspect is "Set[...]" (Ruby 4.0), which holds no +# "#<" unless the Set holds an object. Nil where Set#inspect starts with "#<" too. +# +# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:252 +SemanticLogger::Utils::INSPECTED_SET = T.let(T.unsafe(nil), T.untyped) + +# Nesting depth after which .json_safe, and any other copy made by .bounded_structure, +# replaces a Hash, Array, Struct, or Data with a placeholder. Well below the json gem's +# default max_nesting of 100, leaving room for the levels that a formatter wraps the payload +# in. +# +# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:258 +SemanticLogger::Utils::MAX_JSON_SAFE_DEPTH = T.let(T.unsafe(nil), Integer) + +# The methods of this file that serialize log data to JSON (see .serializing_log_data?), as +# their frames are named in a backtrace. A call one of them makes to a method written in C, +# such as Hash#to_json, is named after that method but located in this file: "to_json". +# +# pkg:gem/semantic_logger#lib/semantic_logger/utils.rb:215 +SemanticLogger::Utils::SERIALIZERS = T.let(T.unsafe(nil), Array) + +# pkg:gem/semantic_logger#lib/semantic_logger/version.rb:2 +SemanticLogger::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/sentry-ruby@7.2.0.rbi b/sorbet/rbi/gems/sentry-ruby@7.3.0.rbi similarity index 88% rename from sorbet/rbi/gems/sentry-ruby@7.2.0.rbi rename to sorbet/rbi/gems/sentry-ruby@7.3.0.rbi index 9087fecc..2dda61ff 100644 --- a/sorbet/rbi/gems/sentry-ruby@7.2.0.rbi +++ b/sorbet/rbi/gems/sentry-ruby@7.3.0.rbi @@ -103,16 +103,25 @@ module Sentry # @!method add_attachment # @!macro add_attachment # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:257 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:269 def add_attachment(**opts); end # Takes an instance of Sentry::Breadcrumb and stores it to the current active scope. # # @return [Breadcrumb, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:355 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:367 def add_breadcrumb(breadcrumb, **options); end + # Records a feature flag evaluation on the current scope and active span. + # Only boolean results are recorded. + # @param name [String, Symbol] the flag name + # @param result [Boolean] the evaluation result + # @return [void] + # + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:233 + def add_feature_flag(name, result); end + # Add a global event processor [Proc]. # These run before scope event processors. # @@ -126,30 +135,30 @@ module Sentry # event # end # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:596 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:608 def add_global_event_processor(&block); end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:116 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:118 def apply_patches(config); end # @!attribute [rw] background_worker # @return [BackgroundWorker] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:88 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:90 def background_worker; end # @!attribute [rw] background_worker # @return [BackgroundWorker] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:88 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:90 def background_worker=(_arg0); end # @!attribute [r] backpressure_monitor # @return [BackpressureMonitor, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:96 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:98 def backpressure_monitor; end # Captures a check-in and sends it to Sentry via the currently active hub. @@ -164,14 +173,14 @@ module Sentry # # @return [String, nil] The {CheckInEvent#check_in_id} to use for later updates on the same slug # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:516 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:528 def capture_check_in(slug, status, **options); end # Takes an instance of Sentry::Event and dispatches it to the currently active hub. # # @return [Event, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:500 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:512 def capture_event(event); end # Takes an exception and reports it to Sentry via the currently active hub. @@ -179,7 +188,7 @@ module Sentry # @yieldparam scope [Scope] # @return [Event, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:464 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:476 def capture_exception(exception, **options, &block); end # Captures a log event and sends it to Sentry via the currently active hub. @@ -198,7 +207,7 @@ module Sentry # @see https://develop.sentry.dev/sdk/telemetry/logs/ Sentry SDK Telemetry Logs Protocol # @return [LogEvent, nil] The created log event or nil if Sentry is not initialized # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:536 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:548 def capture_log(message, **options); end # Takes a message string and reports it to Sentry via the currently active hub. @@ -206,10 +215,10 @@ module Sentry # @yieldparam scope [Scope] # @return [Event, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:492 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:504 def capture_message(message, **options, &block); end - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:721 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:733 def clear_external_propagation_context; end # Clones the main hub and stores it for the current execution context @@ -218,7 +227,7 @@ module Sentry # # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:394 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:406 def clone_hub_to_current_thread; end # Flushes pending events and cleans up SDK state. @@ -226,13 +235,13 @@ module Sentry # # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:291 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:303 def close; end # @!method configuration # @!macro configuration # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:168 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:170 def configuration; end # Takes a block and yields the current active scope. @@ -247,7 +256,7 @@ module Sentry # @yieldparam scope [Scope] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:410 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:422 def configure_scope(&block); end # Continue an incoming trace from a rack env like hash. @@ -255,7 +264,7 @@ module Sentry # @param env [Hash] # @return [Transaction, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:640 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:652 def continue_trace(env, **options); end # Returns an uri for security policy reporting that's generated from the given DSN @@ -267,24 +276,24 @@ module Sentry # # @return [String, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:337 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:349 def csp_report_uri; end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:731 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:743 def dependency_installed?(name); end # Checks if the exception object has been captured by the SDK. # # @return [Boolean] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:578 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:590 def exception_captured?(exc); end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:70 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:72 def exception_locals_tp; end # Copies +hub+ for a context that inherited it. The span is re-attached @@ -295,7 +304,7 @@ module Sentry # @param hub [Hub] # @return [Hub] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:766 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:778 def fork_hub(hub); end # Returns the baggage header for distributed tracing. @@ -303,13 +312,13 @@ module Sentry # # @return [String, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:613 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:625 def get_baggage; end # Returns the current active client. # @return [Client, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:376 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:388 def get_current_client; end # Returns the current active hub. @@ -318,7 +327,7 @@ module Sentry # # @return [Hub] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:365 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:377 def get_current_hub; end # Reads the hub stored for the current execution context. The active @@ -330,28 +339,28 @@ module Sentry # @!visibility private # @return [Hub, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:743 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:755 def get_current_hub_internal; end # Returns the current active scope. # # @return [Scope, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:384 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:396 def get_current_scope; end # Returns the external propagation context (trace_id, span_id) if a callback is registered. # # @return [Array, nil] A tuple of [trace_id, span_id] or nil if no context is available # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:712 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:724 def get_external_propagation_context; end # Returns the main thread's active hub. # # @return [Hub] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:345 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:357 def get_main_hub; end # Returns the a Hash containing sentry-trace and baggage. @@ -359,7 +368,7 @@ module Sentry # # @return [Hash, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:622 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:634 def get_trace_propagation_headers; end # Returns the a Hash containing sentry-trace and baggage. @@ -367,7 +376,7 @@ module Sentry # # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:631 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:643 def get_trace_propagation_meta; end # Returns the traceparent (sentry-trace) header for distributed tracing. @@ -375,7 +384,7 @@ module Sentry # # @return [String, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:604 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:616 def get_traceparent; end # Initializes the SDK with given configuration. @@ -383,28 +392,28 @@ module Sentry # @yieldparam config [Configuration] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:268 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:280 def init(&block); end # Returns true if the SDK is initialized. # # @return [Boolean] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:325 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:337 def initialized?; end # Returns a hash that contains all the integrations that have been registered to the main SDK. # # @return [Hash{String=>Hash}] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:132 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:134 def integrations; end # Returns the id of the lastly reported Sentry::Event. # # @return [String, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:570 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:582 def last_event_id; end # Returns the structured logger instance that implements Sentry's SDK telemetry logs protocol. @@ -420,7 +429,7 @@ module Sentry # # @return [StructuredLogger] The structured logger instance # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:657 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:669 def logger; end # Returns the metrics API for capturing custom metrics. @@ -432,7 +441,7 @@ module Sentry # # @return [Metrics] The metrics API # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:669 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:681 def metrics; end # Registers a callback function that retrieves the current external propagation context. @@ -448,7 +457,7 @@ module Sentry # [span_context.hex_trace_id, span_context.hex_span_id] # end # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:705 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:717 def register_external_propagation_context(&callback); end # Registers the SDK integration with its name and version. @@ -456,17 +465,17 @@ module Sentry # @param name [String] name of the integration # @param version [String] version of the integration # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:140 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:142 def register_integration(name, version); end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:101 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:103 def register_patch(key, patch = T.unsafe(nil), target = T.unsafe(nil), &block); end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:123 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:125 def registered_patches; end # @!method remove_attribute @@ -474,29 +483,29 @@ module Sentry # @param key [String, Symbol] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:250 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:262 def remove_attribute(key); end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:684 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:696 def sdk_logger; end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:689 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:701 def sdk_meta; end # @!method send_event # @!macro send_event # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:175 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:177 def send_event(*args); end # @!attribute [r] session_flusher # @return [SessionFlusher, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:92 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:94 def session_flusher; end # @!method set_attribute @@ -506,7 +515,7 @@ module Sentry # @param unit [String, Symbol, nil] an optional measurement unit for the value # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:241 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:253 def set_attribute(key, value, unit: T.unsafe(nil)); end # @!method set_attributes @@ -514,13 +523,13 @@ module Sentry # @param attributes_hash [Hash] # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:230 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:242 def set_attributes(attributes_hash); end # @!method set_context # @!macro set_context # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:221 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:223 def set_context(*args); end # Stores +hub+ for the current execution context (thread or fiber). @@ -529,42 +538,42 @@ module Sentry # @param hub [Hub, nil] # @return [Hub, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:779 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:791 def set_current_hub_internal(hub); end # @!method set_extras # @!macro set_extras # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:207 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:209 def set_extras(*args); end # @!method set_tags # @!macro set_tags # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:200 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:202 def set_tags(*args); end # @!method set_user # @!macro set_user # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:214 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:216 def set_user(*args); end # Takes or initializes a new Sentry::Transaction and makes a sampling decision for it. # # @return [Transaction, nil] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:544 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:556 def start_transaction(**options); end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:676 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:688 def sys_command(command); end # @!visibility private # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:726 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:738 def utc_now; end # Records the block's execution as a child of the current span. @@ -580,7 +589,7 @@ module Sentry # # result will be returned # end # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:562 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:574 def with_child_span(**attributes, &block); end # Takes a block and evaluates it. If the block raised an exception, it reports the exception to Sentry and re-raises it. @@ -595,7 +604,7 @@ module Sentry # 1/0 #=> ZeroDivisionError will be reported and re-raised # end # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:481 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:493 def with_exception_captured(**options, &block); end # Takes a block and yields a temporary scope. @@ -619,7 +628,7 @@ module Sentry # @yieldparam scope [Scope] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:435 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:447 def with_scope(&block); end # Wrap a given block with session tracking. @@ -638,7 +647,7 @@ module Sentry # end # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:455 + # pkg:gem/sentry-ruby#lib/sentry-ruby.rb:467 def with_session_tracking(&block); end end end @@ -689,7 +698,7 @@ end # pkg:gem/sentry-ruby#lib/sentry/attachment.rb:5 class Sentry::Attachment::PathNotFoundError < ::StandardError; end -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:54 +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:56 Sentry::BAGGAGE_HEADER_NAME = T.let(T.unsafe(nil), String) # pkg:gem/sentry-ruby#lib/sentry/background_worker.rb:8 @@ -1089,7 +1098,7 @@ end # pkg:gem/sentry-ruby#lib/sentry/breadcrumb_buffer.rb:7 Sentry::BreadcrumbBuffer::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer) -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:48 +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:50 Sentry::CAPTURED_SIGNATURE = T.let(T.unsafe(nil), Symbol) # @private @@ -1588,7 +1597,7 @@ class Sentry::Configuration # @return [String, nil] # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:817 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:815 def csp_report_uri; end # Controls which categories of data may be collected. @@ -1621,7 +1630,7 @@ class Sentry::Configuration # @api private # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:847 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:845 def detect_release; end # the dsn value, whether it's set via `config.dsn=` or `ENV["SENTRY_DSN"]` @@ -1667,7 +1676,7 @@ class Sentry::Configuration # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:160 def enabled_environments=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:795 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:793 def enabled_in_current_env?; end # Array of patches to apply. @@ -1693,18 +1702,7 @@ class Sentry::Configuration # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:717 def environment=(environment); end - # @api private - # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:860 - def error_messages; end - - # these are not config options - # @!visibility private - # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:424 - def errors; end - - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:782 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:780 def exception_class_allowed?(exc); end # Logger 'progname's to exclude from breadcrumbs @@ -1811,7 +1809,7 @@ class Sentry::Configuration # @api private # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:827 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:825 def log_deprecations; end # Max number of breadcrumbs a breadcrumb buffer can hold @@ -1903,7 +1901,7 @@ class Sentry::Configuration # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:737 def profiles_sample_rate=(profiles_sample_rate); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:810 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:808 def profiling_enabled?; end # Project directory root for in_app detection. Could be Rails root, etc. @@ -1958,10 +1956,10 @@ class Sentry::Configuration # @api private # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:866 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:858 def run_after_close_callbacks; end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:772 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:770 def sample_allowed?; end # The sampling factor to apply to events. A value of 0.0 will not send @@ -2066,7 +2064,7 @@ class Sentry::Configuration # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:272 def server_name=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:778 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:776 def session_tracking?; end # Allow to skip Sentry emails within rake tasks @@ -2103,7 +2101,7 @@ class Sentry::Configuration # @api private # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:835 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:833 def stacktrace_builder; end # Optional Proc, called to filter log messages before sending to Sentry @@ -2232,7 +2230,7 @@ class Sentry::Configuration # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:294 def traces_sampler=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:804 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:802 def tracing_enabled?; end # Transport related configuration. @@ -2251,7 +2249,7 @@ class Sentry::Configuration # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:269 def trusted_proxies=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:799 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:797 def valid_sample_rate?(sample_rate); end # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:616 @@ -2259,52 +2257,46 @@ class Sentry::Configuration private - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:911 - def capture_in_environment?; end - - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:927 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:903 def environment_from_env; end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:882 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:874 def excluded_exception?(incoming_exception); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:888 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:880 def excluded_exception_classes; end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:872 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:864 def fiber_storage_available?; end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:892 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:884 def get_exception_class(x); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:876 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:868 def init_dsn(dsn_string); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:896 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:888 def matches_exception?(excluded_exception_class, incoming_exception); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:951 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:927 def processor_count; end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:945 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:921 def run_callbacks(hook, event); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:941 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:917 def running_on_heroku?; end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:904 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:896 def safe_const_get(x); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:931 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:907 def server_name_from_env; end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:918 - def valid?; end - - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:956 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:932 def valid_http_status_code?(code); end - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:960 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:936 def valid_status_code_entry?(entry); end class << self @@ -3087,61 +3079,82 @@ Sentry::DataCollection::MODES = T.let(T.unsafe(nil), Array) # pkg:gem/sentry-ruby#lib/sentry/data_collection.rb:34 Sentry::DataCollection::PII_HEADER_SNIPPETS = T.let(T.unsafe(nil), Array) +# pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:10 +class Sentry::DebugLogFile + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:13 + def initialize(path, prefix); end + + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:25 + def append(entry); end + + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:48 + def clear; end + + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:33 + def entries; end + + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:11 + def path; end + + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:56 + def start_run; end +end + # DebugStructuredLogger is a logger that captures structured log events to a file for debugging purposes. # # It also sends log events to Sentry via the normal structured logger. # -# pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:12 +# pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:10 class Sentry::DebugStructuredLogger < ::SimpleDelegator - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:17 + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:15 def initialize(configuration); end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:15 + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:13 def backend; end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:41 + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:44 def capture_log_event(level, message, parameters, **attributes); end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:60 + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:65 def clear; end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:28 - def debug(message, parameters = T.unsafe(nil), **attributes); end + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:25 + def debug(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:28 - def error(message, parameters = T.unsafe(nil), **attributes); end + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:25 + def error(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:28 - def fatal(message, parameters = T.unsafe(nil), **attributes); end + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:25 + def fatal(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:28 - def info(message, parameters = T.unsafe(nil), **attributes); end + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:25 + def info(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:35 - def log(level, message, parameters:, **attributes); end + def log(level, message = T.unsafe(nil), parameters:, **attributes); end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:15 + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:13 def log_file; end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:54 + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:57 def logged_events; end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:28 - def trace(message, parameters = T.unsafe(nil), **attributes); end + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:61 + def start_run; end + + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:25 + def trace(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:28 - def warn(message, parameters = T.unsafe(nil), **attributes); end + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:25 + def warn(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end private - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:69 + # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:74 def initialize_backend(configuration); end - - # pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:73 - def initialize_log_file(log_file_path); end end -# pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:13 +# pkg:gem/sentry-ruby#lib/sentry/debug_structured_logger.rb:11 Sentry::DebugStructuredLogger::DEFAULT_LOG_FILE_PATH = T.let(T.unsafe(nil), String) # DebugTransport is a transport that logs events to a file for debugging purposes. @@ -3149,45 +3162,42 @@ Sentry::DebugStructuredLogger::DEFAULT_LOG_FILE_PATH = T.let(T.unsafe(nil), Stri # It can optionally also send events to Sentry via HTTP transport if a real DSN # is provided. # -# pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:13 +# pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:75 class Sentry::DebugTransport < ::SimpleDelegator - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:18 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:80 def initialize(configuration); end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:16 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:78 def backend; end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:55 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:118 def clear; end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:35 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:98 def log_envelope(envelope); end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:16 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:78 def log_file; end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:47 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:110 def logged_envelopes; end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:30 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:93 def send_envelope(envelope); end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:25 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:88 def send_event(event); end - private + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:114 + def start_run; end - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:62 - def fully_written?(line); end + private - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:66 + # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:125 def initialize_backend(configuration); end - - # pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:71 - def initialize_log_file(configuration); end end -# pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:14 +# pkg:gem/sentry-ruby#lib/sentry/transport/debug_transport.rb:76 Sentry::DebugTransport::DEFAULT_LOG_FILE_PATH = T.let(T.unsafe(nil), String) # pkg:gem/sentry-ruby#lib/sentry/transport/dummy_transport.rb:4 @@ -3652,7 +3662,7 @@ class Sentry::FilenameCache def longest_load_path(abs_path); end end -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:60 +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:62 Sentry::GLOBALS = T.let(T.unsafe(nil), Array) # pkg:gem/sentry-ruby#lib/sentry/transport/http_transport.rb:7 @@ -3894,7 +3904,268 @@ class Sentry::Interface def to_h; end end -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:50 +# pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:4 +module Sentry::JobExtensions; end + +# Base class for extensions that let a background-job backend enrich Sentry's +# job integrations. A backend gem subclasses it and overrides the hooks it can +# supply; jobs are opaque to Sentry and only interpreted by the extension. +# +# pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:8 +class Sentry::JobExtensions::Extension + include ::Sentry::LoggingHelper + + # Creates an extension. Raises ArgumentError if the name is not a Symbol. + # + # @param name [Symbol] + # @param integration [Module] the integration that captures the job's exceptions + # @param origin [String] the origin of the job's spans + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:38 + def initialize(name:, integration:, origin:); end + + # Captures an exception raised by the job, enriched with the extension's error data. + # + # @param job [Object] + # @param exception [Exception] + # @return [Event, nil] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:105 + def capture_exception(job:, exception:, contexts: T.unsafe(nil), tags: T.unsafe(nil), extra: T.unsafe(nil), **context); end + + # Returns data to add to the event captured for a failed job. Data already on + # the scope or passed explicitly by the job integration takes precedence. + # + # @param job [Object] + # @param exception [Exception] + # @return [Hash] with optional `:contexts`, `:tags` and `:extra` + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:152 + def error_data(job:, exception:, **); end + + # Returns the trace propagation headers the job carries, so that performing + # it continues the trace it was enqueued in. + # + # @param job [Object] + # @return [Hash{String => String}] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:199 + def extract_trace_headers(job:, **); end + + # Finishes the job's transaction with the given status. + # + # @param transaction [Transaction, nil] + # @param status [Integer] + # @return [void] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:93 + def finish_job(transaction:, status:); end + + # Returns the backend's job payload carrying the trace propagation headers. + # + # @param job [Object] + # @param payload [Object] + # @param headers [Hash{String => String}] + # @return [Object] a payload of the same class as the one given + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:190 + def inject_trace_headers(job:, payload:, headers:, **); end + + # Wraps enqueueing a job in a `queue.publish` span. + # + # @param job [Object] + # @yieldreturn [Object] the result of enqueueing the job + # @return [Object] the block's result + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:51 + def instrument_enqueue(job:, **context, &enqueue); end + + # Returns the integration that captures the job's exceptions. Defaults to + # the extension's integration. + # + # @param job [Object] + # @return [Module] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:258 + def integration(job:, **); end + + # Returns messaging attributes for the job's spans. + # + # @param job [Object] + # @return [Hash] with optional `:system`, `:message_id`, `:destination`, + # `:receive_latency`, `:retry_count` and `:body_size` + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:208 + def messaging_data(job:, **); end + + # The extension's name, used in SDK log messages. + # @return [Symbol] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:31 + def name; end + + # Returns the description of the `queue.publish` span. Defaults to the job's class name. + # + # @param job [Object] + # @return [String, nil] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:233 + def publish_description(job:, **); end + + # Returns messaging attributes for the `queue.publish` span. Defaults to + # {#messaging_data}. + # + # @param job [Object] + # @return [Hash] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:217 + def publish_messaging_data(job:, **context); end + + # Returns the origin of the `queue.publish` span. Defaults to {#span_origin}. + # + # @param job [Object] + # @return [String] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:249 + def publish_span_origin(job:, **context); end + + # Returns whether to record a `queue.publish` span when the job is enqueued. + # + # @param job [Object] + # @return [Boolean] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:134 + def record_publish_span?(job:, **); end + + # Returns whether to capture the job's exception. By default only when the + # backend won't retry the job. + # + # @param job [Object] + # @param exception [Exception] + # @return [Boolean] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:170 + def report_exception?(job:, exception:, **context); end + + # Returns whether to capture an exception that the job integration's own + # retry mechanism retries, so the backend never sees it. + # + # @param job [Object] + # @param exception [Exception] + # @return [Boolean] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:180 + def report_retried_exception?(job:, exception:, **); end + + # Runs a hook, logging its failure and returning `fallback` instead of raising. + # + # @param context [String] what the hook does, used in the log message + # @return [Object] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:118 + def safely(context, fallback: T.unsafe(nil)); end + + # Returns data to apply to the scope the job is performed in. + # + # @param job [Object] + # @return [Hash] with optional `:contexts`, `:tags`, `:extra` and `:user` + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:142 + def scope_data(job:, **); end + + # Returns the origin of the job's transaction. Defaults to the extension's origin. + # + # @param job [Object] + # @return [String] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:241 + def span_origin(job:, **); end + + # Prepares the scope for performing the job and starts its `queue.process` + # transaction, continuing the trace the job was enqueued in. + # + # @param scope [Scope] + # @param job [Object] + # @return [Transaction, nil] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:71 + def start_job(scope:, job:, **context); end + + # Returns the name of the job's transaction. Defaults to the job's class name. + # + # @param job [Object] + # @return [String, nil] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:225 + def transaction_name(job:, **); end + + # Returns whether the backend will retry the failed job. + # + # @param job [Object] + # @return [Boolean] + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:160 + def will_retry?(job:, **); end + + private + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:286 + def apply_scope_data(scope, data); end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:335 + def contexts_with_scope_values(contexts, scope_contexts); end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:264 + def hook_hash(description); end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:339 + def log_failure(context, error); end + + # Builds the capture options so that the caller's contexts, tags and extra + # take precedence over the scope's, and the scope's over the extension's. + # + # Every value passed to capture_exception becomes event data, and + # Scope#apply_to_event lets event data beat scope data. It also merges + # contexts by name, so an event context replaces the scope context of the + # same name entirely. The extension's tags and extra therefore leave out + # keys the scope already has, and each extension context absorbs the scope + # context of the same name before the caller's values are merged on top. + # + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:318 + def merged_error_data(data, contexts:, tags:, extra:); end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:299 + def normalized_error_data(data); end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:343 + def sdk_logger; end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:293 + def set_messaging_data(span, data); end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:271 + def start_transaction(scope, trace_headers, origin); end + + # pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:331 + def without_scope_keys(values, scope_values); end +end + +# pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:26 +Sentry::JobExtensions::Extension::EMPTY_ERROR_DATA = T.let(T.unsafe(nil), Hash) + +# pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:23 +Sentry::JobExtensions::Extension::EMPTY_HASH = T.let(T.unsafe(nil), Hash) + +# pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:14 +Sentry::JobExtensions::Extension::MESSAGING_DATA_ATTRIBUTES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:12 +Sentry::JobExtensions::Extension::PROCESS_OP = T.let(T.unsafe(nil), String) + +# pkg:gem/sentry-ruby#lib/sentry/job_extensions/extension.rb:11 +Sentry::JobExtensions::Extension::PUBLISH_OP = T.let(T.unsafe(nil), String) + +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:52 Sentry::LOGGER_PROGNAME = T.let(T.unsafe(nil), String) # @api private @@ -4079,10 +4350,10 @@ module Sentry::LoggingHelper def sdk_logger; end end -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:46 +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:48 Sentry::META = T.let(T.unsafe(nil), Hash) -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:58 +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:60 Sentry::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) # pkg:gem/sentry-ruby#lib/sentry/interfaces/mechanism.rb:4 @@ -4344,7 +4615,7 @@ Sentry::Profiler::VERSION = T.let(T.unsafe(nil), String) # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:9 class Sentry::PropagationContext - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:121 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:123 def initialize(scope, env = T.unsafe(nil)); end # This is only for accessing the current baggage variable. @@ -4357,25 +4628,25 @@ class Sentry::PropagationContext # Returns the Baggage from the propagation context or populates as head SDK if empty. # @return [Baggage, nil] # - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:181 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:183 def get_baggage; end # Returns the Dynamic Sampling Context from the baggage. # @return [Hash, nil] # - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:188 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:190 def get_dynamic_sampling_context; end # Returns the trace context that can be used to embed in an Event. # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:165 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:167 def get_trace_context; end # Returns the sentry-trace header from the propagation context. # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:175 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:177 def get_traceparent; end # Is there an incoming trace or not? @@ -4416,11 +4687,11 @@ class Sentry::PropagationContext private - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:194 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:196 def populate_head_baggage; end class << self - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:94 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:96 def extract_sample_rand_from_baggage(baggage, trace_id = T.unsafe(nil)); end # Extract the trace_id, parent_span_id and parent_sampled values from a sentry-trace header. @@ -4431,7 +4702,7 @@ class Sentry::PropagationContext # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:43 def extract_sentry_trace(sentry_trace); end - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:104 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:106 def generate_sample_rand(baggage, trace_id, parent_sampled); end # Determines whether we should continue an incoming trace based on org_id matching @@ -4440,7 +4711,7 @@ class Sentry::PropagationContext # @param incoming_baggage [Baggage] the baggage from the incoming request # @return [Boolean] # - # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:61 + # pkg:gem/sentry-ruby#lib/sentry/propagation_context.rb:63 def should_continue_trace?(incoming_baggage); end end end @@ -4537,45 +4808,50 @@ end # # pkg:gem/sentry-ruby#lib/sentry/redis.rb:5 class Sentry::Redis - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:10 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:14 def initialize(commands, host, port, db); end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:14 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:18 def instrument; end private - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:34 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:38 def commands; end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:53 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:57 def commands_description; end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:34 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:38 def db; end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:34 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:38 def host; end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:59 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:63 def parsed_commands; end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:34 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:38 def port; end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:36 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:40 def record_breadcrumb; end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:75 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:81 def server_description; end end -# pkg:gem/sentry-ruby#lib/sentry/redis.rb:85 +# Commands whose later arguments can carry credentials. Arguments are never recorded. +# +# pkg:gem/sentry-ruby#lib/sentry/redis.rb:12 +Sentry::Redis::ARGUMENTLESS_COMMANDS = T.let(T.unsafe(nil), Array) + +# pkg:gem/sentry-ruby#lib/sentry/redis.rb:91 module Sentry::Redis::GlobalRedisInstrumentation - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:86 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:92 def call(command, redis_config); end - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:92 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:98 def call_pipelined(commands, redis_config); end end @@ -4585,12 +4861,17 @@ Sentry::Redis::LOGGER_NAME = T.let(T.unsafe(nil), Symbol) # pkg:gem/sentry-ruby#lib/sentry/redis.rb:6 Sentry::Redis::OP_NAME = T.let(T.unsafe(nil), String) -# pkg:gem/sentry-ruby#lib/sentry/redis.rb:79 +# pkg:gem/sentry-ruby#lib/sentry/redis.rb:85 module Sentry::Redis::OldClientPatch - # pkg:gem/sentry-ruby#lib/sentry/redis.rb:80 + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:86 def logging(commands, &block); end end +# Commands that carry credentials from their first argument on. +# +# pkg:gem/sentry-ruby#lib/sentry/redis.rb:10 +Sentry::Redis::SENSITIVE_COMMANDS = T.let(T.unsafe(nil), Array) + # pkg:gem/sentry-ruby#lib/sentry/redis.rb:7 Sentry::Redis::SPAN_ORIGIN = T.let(T.unsafe(nil), String) @@ -4746,31 +5027,31 @@ Sentry::RequestInterface::MAX_BODY_LIMIT = T.let(T.unsafe(nil), Integer) # pkg:gem/sentry-ruby#lib/sentry/interfaces/request.rb:7 Sentry::RequestInterface::REQUEST_ID_HEADERS = T.let(T.unsafe(nil), Array) -# Sends Crons check-ins for rufus-scheduler `cron`, `every` and `interval` jobs. +# Sends Crons check-ins for rufus-scheduler `cron` and `every` jobs. # Enable with `config.enabled_patches << :rufus_scheduler`. # # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:6 module Sentry::RufusScheduler class << self - # Returns [slug, monitor_config], or nil for jobs that aren't monitored (like `at`/`in`). + # Returns [slug, monitor_config], or nil for jobs that aren't monitored (like `at`/`in`, or unsupported schedules). # # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:50 def monitor_for(job); end private - # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:94 + # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:100 def monitor_config_for(job); end # sidekiq-scheduler jobs are monitored by the :sidekiq_scheduler patch. # - # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:70 + # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:76 def sidekiq_scheduler_job?(job); end # Job ids are random per process and block paths change between deploys, # so the slug comes from `name:`, then the handler method or class. # - # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:77 + # pkg:gem/sentry-ruby#lib/sentry/rufus_scheduler.rb:83 def slug_for(job); end end end @@ -4788,44 +5069,54 @@ module Sentry::RufusScheduler::Job def sentry_monitor; end end -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:52 +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:54 Sentry::SENTRY_TRACE_HEADER_NAME = T.let(T.unsafe(nil), String) -# pkg:gem/sentry-ruby#lib/sentry/scope.rb:10 +# pkg:gem/sentry-ruby#lib/sentry/scope.rb:11 class Sentry::Scope include ::Sentry::ArgumentCheckingHelper include ::Sentry::CallbackHelper # @param max_breadcrumbs [Integer] the maximum number of breadcrumbs to be stored in the scope. # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:36 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:41 def initialize(max_breadcrumbs: T.unsafe(nil)); end # Add a new attachment to the scope. # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:380 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:404 def add_attachment(**opts); end # Adds the breadcrumb to the scope's breadcrumbs buffer. # @param breadcrumb [Breadcrumb] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:127 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:133 def add_breadcrumb(breadcrumb); end # Adds a new event processor [Proc] to the scope. # @param block [Proc] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:368 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:392 def add_event_processor(&block); end + # Records a feature flag evaluation on the scope (and the active span, if any). + # Only boolean results are supported; other values are ignored. + # The scope keeps the most recent {MAX_FLAGS} distinct flags (oldest evicted first). + # @param name [String, Symbol] the flag name + # @param result [Boolean] the evaluation result + # @return [void] + # + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:315 + def add_feature_flag(name, result); end + # Applies stored attributes and event processors to the given event. # @param event [Event] # @param hint [Hash] the hint data that'll be passed to event processors. # @return [Event] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:51 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:56 def apply_to_event(event, hint = T.unsafe(nil)); end # A leaner version of apply_to_event that applies to @@ -4836,90 +5127,93 @@ class Sentry::Scope # @param telemetry [MetricEvent, LogEvent] the telemetry event to apply scope context to # @return [MetricEvent, LogEvent] the telemetry event with scope context applied # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:90 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:96 def apply_to_telemetry(telemetry); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def attachments; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def attributes; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def breadcrumbs; end # Resets the scope's attributes to defaults. # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:43 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:48 def clear; end # Clears the scope's breadcrumbs buffer # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:133 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:139 def clear_breadcrumbs; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def contexts; end # @return [Scope] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:138 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:144 def dup; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def event_processors; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def extra; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def fingerprint; end + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 + def flags; end + # Generate a new propagation context either from the incoming env headers or from scratch. # @param env [Hash, nil] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:375 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:399 def generate_propagation_context(env = T.unsafe(nil)); end # Returns the associated Span object. # @return [Span, nil] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:338 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:362 def get_span; end # Returns the trace context for this scope. # Prioritizes external propagation context (from OTel) over local propagation context. # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:345 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:369 def get_trace_context; end # Returns the associated Transaction object. # @return [Transaction, nil] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:332 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:356 def get_transaction; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def level; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def propagation_context; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def rack_env; end # Removes a single attribute from the scope. No-op if the attribute is not set. # @param key [String, Symbol] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:297 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:305 def remove_attribute(key); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def session; end # Sets a single attribute on the scope. @@ -4928,26 +5222,26 @@ class Sentry::Scope # @param unit [String, Symbol, nil] an optional measurement unit for the value # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:289 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:297 def set_attribute(key, value, unit: T.unsafe(nil)); end # Updates the scope's attributes by merging with the old value. # @param attributes_hash [Hash] # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:278 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:286 def set_attributes(attributes_hash); end # @!macro set_context # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:270 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:278 def set_context(key, value); end # Updates the scope's contexts attribute by merging with the old value. # @param contexts [Hash] # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:258 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:266 def set_contexts(contexts_hash); end # Adds a new key-value pair to current extras. @@ -4955,47 +5249,47 @@ class Sentry::Scope # @param value [Object] # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:237 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:245 def set_extra(key, value); end # @!macro set_extras # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:228 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:236 def set_extras(extras_hash); end # Sets the scope's fingerprint attribute. # @param fingerprint [Array] # @return [Array] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:359 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:383 def set_fingerprint(fingerprint); end # Sets the scope's level attribute. # @param level [String, Symbol] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:304 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:328 def set_level(level); end # Sets the scope's rack_env attribute. # @param env [Hash] # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:208 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:216 def set_rack_env(env); end # Sets the currently active session on the scope. # @param session [Session, nil] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:320 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:344 def set_session(session); end # Sets the scope's span attribute. # @param span [Span] # @return [Span] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:216 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:224 def set_span(span); end # Adds a new key-value pair to current tags. @@ -5003,12 +5297,12 @@ class Sentry::Scope # @param value [Object] # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:251 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:259 def set_tag(key, value); end # @!macro set_tags # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:242 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:250 def set_tags(tags_hash); end # Appends a new transaction name to the scope. @@ -5016,30 +5310,30 @@ class Sentry::Scope # @param transaction_name [String] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:312 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:336 def set_transaction_name(transaction_name, source: T.unsafe(nil)); end # @!macro set_user # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:222 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:230 def set_user(user_hash); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def span; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def tags; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def transaction_name; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def transaction_source; end # These are high cardinality and thus bad. # @return [Boolean] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:326 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:350 def transaction_source_low_quality?; end # Updates the scope's data from the given options. @@ -5052,75 +5346,84 @@ class Sentry::Scope # @param attachments [Array] # @return [Array] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:184 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:192 def update_from_options(contexts: T.unsafe(nil), extra: T.unsafe(nil), tags: T.unsafe(nil), user: T.unsafe(nil), level: T.unsafe(nil), fingerprint: T.unsafe(nil), attachments: T.unsafe(nil), **options); end # Updates the scope's data from a given scope. # @param scope [Scope] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:160 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:167 def update_from_scope(scope); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:33 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:38 def user; end protected - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def attachments=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def attributes=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def breadcrumbs=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def contexts=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def event_processors=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def extra=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def fingerprint=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 + def flags=(_arg0); end + + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def level=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def propagation_context=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def rack_env=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def session=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def span=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def tags=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def transaction_name=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def transaction_source=(_arg0); end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:388 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:412 def user=(_arg0); end private - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:392 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:416 + def add_feature_flag_to_span(name, result); end + + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:422 + def apply_flags_to_event(event); end + + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:429 def set_default_value; end - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:411 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:449 def set_new_breadcrumb_buffer; end class << self @@ -5131,30 +5434,35 @@ class Sentry::Scope # @param block [Proc] # @return [void] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:451 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:489 def add_global_event_processor(&block); end # Returns the global event processors array. # @return [Array] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:441 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:479 def global_event_processors; end # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:417 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:455 def os_context; end # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/scope.rb:432 + # pkg:gem/sentry-ruby#lib/sentry/scope.rb:470 def runtime_context; end end end -# pkg:gem/sentry-ruby#lib/sentry/scope.rb:14 +# pkg:gem/sentry-ruby#lib/sentry/scope.rb:15 Sentry::Scope::ATTRIBUTES = T.let(T.unsafe(nil), Array) +# Maximum number of feature flag evaluations kept on a scope. +# +# pkg:gem/sentry-ruby#lib/sentry/scope.rb:36 +Sentry::Scope::MAX_FLAGS = T.let(T.unsafe(nil), Integer) + # pkg:gem/sentry-ruby#lib/sentry/session.rb:4 class Sentry::Session # pkg:gem/sentry-ruby#lib/sentry/session.rb:11 @@ -5205,16 +5513,16 @@ class Sentry::SessionFlusher < ::Sentry::ThreadedPeriodicWorker private - # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:65 + # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:68 def attrs; end - # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:45 + # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:48 def init_aggregates(aggregation_key); end - # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:51 + # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:54 def pending_envelope; end - # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:38 + # pkg:gem/sentry-ruby#lib/sentry/session_flusher.rb:41 def reset_if_forked; end end @@ -5278,195 +5586,208 @@ class Sentry::SizeExceededError < ::Sentry::ExternalError; end # pkg:gem/sentry-ruby#lib/sentry/span.rb:7 class Sentry::Span - # pkg:gem/sentry-ruby#lib/sentry/span.rb:121 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:127 def initialize(transaction:, description: T.unsafe(nil), op: T.unsafe(nil), status: T.unsafe(nil), trace_id: T.unsafe(nil), span_id: T.unsafe(nil), parent_span_id: T.unsafe(nil), sampled: T.unsafe(nil), start_timestamp: T.unsafe(nil), timestamp: T.unsafe(nil), origin: T.unsafe(nil)); end # Span data # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:106 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:109 def data; end - # pkg:gem/sentry-ruby#lib/sentry/span.rb:245 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:252 def deep_dup; end # Span description # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:94 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:97 def description; end # Finishes the span by adding a timestamp. # @return [self] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:151 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:158 def finish(end_timestamp: T.unsafe(nil)); end + # Feature flag data + # @return [Hash] + # + # pkg:gem/sentry-ruby#lib/sentry/span.rb:112 + def flags; end + # Returns the Dynamic Sampling Context from the transaction baggage. # @return [Hash, nil] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:174 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:181 def get_dynamic_sampling_context; end # Returns the span's context that can be used to embed in an Event. # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:197 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:204 def get_trace_context; end # Span operation # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:97 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:100 def op; end # Span origin that tracks what kind of instrumentation created a span # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:109 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:115 def origin; end # Span parent's span_id. # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:82 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:85 def parent_span_id; end # Sampling result of the span. # @return [Boolean, nil] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:85 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:88 def sampled; end # Inserts a key-value pair to the span's data payload. # @param key [String, Symbol] # @param value [Object] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:292 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:299 def set_data(key, value); end # Sets the span's description. # @param description [String] description of the span. # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:257 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:264 def set_description(description); end + # Sets a feature flag on the span. + # @param name [String] the flag name + # @param result [Boolean] the evaluation result + # + # pkg:gem/sentry-ruby#lib/sentry/span.rb:306 + def set_flag(name, result); end + # Sets the span's status with given http status code. # @param status_code [String] example: "500". # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:276 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:283 def set_http_status(status_code); end # Sets the span's operation. # @param op [String] operation of the span. # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:251 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:258 def set_op(op); end # Sets the origin of the span. # @param origin [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:305 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:320 def set_origin(origin); end # Sets the span's status. # @param status [String] status of the span. # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:264 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:271 def set_status(status); end # Sets a tag to the span. # @param key [String, Symbol] # @param value [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:299 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:314 def set_tag(key, value); end # Sets the span's finish timestamp. # @param timestamp [Float] finished time in float format (most precise). # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:270 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:277 def set_timestamp(timestamp); end # An uuid that can be used to identify the span. # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:79 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:82 def span_id; end # The SpanRecorder the current span belongs to. # SpanRecorder holds all spans under the same Transaction object (including the Transaction itself). # @return [SpanRecorder] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:114 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:120 def span_recorder; end # The SpanRecorder the current span belongs to. # SpanRecorder holds all spans under the same Transaction object (including the Transaction itself). # @return [SpanRecorder] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:114 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:120 def span_recorder=(_arg0); end # Starts a child span with given attributes. # @param attributes [Hash] the attributes for the child span. # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:212 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:219 def start_child(**attributes); end # Starting timestamp of the span. # @return [Float] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:88 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:91 def start_timestamp; end # Span status # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:100 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:103 def status; end # Span tags # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:103 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:106 def tags; end # Finishing timestamp of the span. # @return [Float] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:91 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:94 def timestamp; end # Generates a W3C Baggage header string for distributed tracing # from the incoming baggage stored on the transaction. # @return [String, nil] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:168 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:175 def to_baggage; end # @return [Hash] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:179 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:186 def to_h; end # Generates a trace string that can be used to connect other transactions. # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:158 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:165 def to_sentry_trace; end # An uuid that can be used to identify a trace. # @return [String] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:76 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:79 def trace_id; end # The Transaction object the Span belongs to. # Every span needs to be attached to a Transaction and their child spans will also inherit the same transaction. # @return [Transaction] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:119 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:125 def transaction; end # Starts a child span, yield it to the given block, and then finish the span after the block is executed. @@ -5479,11 +5800,16 @@ class Sentry::Span # @param block [Proc] the action to be recorded in the child span. # @yieldparam child_span [Span] # - # pkg:gem/sentry-ruby#lib/sentry/span.rb:233 + # pkg:gem/sentry-ruby#lib/sentry/span.rb:240 def with_child_span(**attributes, &block); end + + private + + # pkg:gem/sentry-ruby#lib/sentry/span.rb:326 + def serialized_data; end end -# pkg:gem/sentry-ruby#lib/sentry/span.rb:72 +# pkg:gem/sentry-ruby#lib/sentry/span.rb:73 Sentry::Span::DEFAULT_SPAN_ORIGIN = T.let(T.unsafe(nil), String) # We will try to be consistent with OpenTelemetry on this front going forward. @@ -5520,7 +5846,7 @@ Sentry::Span::DataConventions::HTTP_QUERY = T.let(T.unsafe(nil), String) # Time in ms the request spent in the server queue before processing began. # -# pkg:gem/sentry-ruby#lib/sentry/span.rb:55 +# pkg:gem/sentry-ruby#lib/sentry/span.rb:56 Sentry::Span::DataConventions::HTTP_QUEUE_TIME_MS = T.let(T.unsafe(nil), String) # pkg:gem/sentry-ruby#lib/sentry/span.rb:12 @@ -5532,6 +5858,9 @@ Sentry::Span::DataConventions::LINENO = T.let(T.unsafe(nil), String) # pkg:gem/sentry-ruby#lib/sentry/span.rb:50 Sentry::Span::DataConventions::MESSAGING_DESTINATION_NAME = T.let(T.unsafe(nil), String) +# pkg:gem/sentry-ruby#lib/sentry/span.rb:53 +Sentry::Span::DataConventions::MESSAGING_MESSAGE_BODY_SIZE = T.let(T.unsafe(nil), String) + # pkg:gem/sentry-ruby#lib/sentry/span.rb:49 Sentry::Span::DataConventions::MESSAGING_MESSAGE_ID = T.let(T.unsafe(nil), String) @@ -5575,7 +5904,13 @@ Sentry::Span::DataConventions::SERVER_SOCKET_PORT = T.let(T.unsafe(nil), String) # pkg:gem/sentry-ruby#lib/sentry/span.rb:11 Sentry::Span::DataConventions::URL = T.let(T.unsafe(nil), String) -# pkg:gem/sentry-ruby#lib/sentry/span.rb:58 +# pkg:gem/sentry-ruby#lib/sentry/span.rb:74 +Sentry::Span::MAX_FLAGS = T.let(T.unsafe(nil), Integer) + +# pkg:gem/sentry-ruby#lib/sentry/span.rb:75 +Sentry::Span::SPAN_FLAG_ATTRIBUTE_PREFIX = T.let(T.unsafe(nil), String) + +# pkg:gem/sentry-ruby#lib/sentry/span.rb:59 Sentry::Span::STATUS_MAP = T.let(T.unsafe(nil), Hash) # Designed to just report events to Spotlight in development. @@ -5857,7 +6192,7 @@ class Sentry::StructuredLogger # @return [LogEvent, nil] The created log event or nil if logging is disabled # # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:73 - def debug(message, parameters = T.unsafe(nil), **attributes); end + def debug(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end # Logs a message at ERROR level # @@ -5868,7 +6203,7 @@ class Sentry::StructuredLogger # @return [LogEvent, nil] The created log event or nil if logging is disabled # # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:106 - def error(message, parameters = T.unsafe(nil), **attributes); end + def error(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end # Logs a message at FATAL level # @@ -5879,7 +6214,7 @@ class Sentry::StructuredLogger # @return [LogEvent, nil] The created log event or nil if logging is disabled # # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:117 - def fatal(message, parameters = T.unsafe(nil), **attributes); end + def fatal(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end # Logs a message at INFO level # @@ -5890,7 +6225,7 @@ class Sentry::StructuredLogger # @return [LogEvent, nil] The created log event or nil if logging is disabled # # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:84 - def info(message, parameters = T.unsafe(nil), **attributes); end + def info(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end # Logs a message at the specified level # @@ -5902,7 +6237,7 @@ class Sentry::StructuredLogger # @return [LogEvent, nil] The created log event or nil if logging is disabled # # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:129 - def log(level, message, parameters:, **attributes); end + def log(level, message = T.unsafe(nil), parameters:, **attributes); end # Logs a message at TRACE level # @@ -5913,7 +6248,7 @@ class Sentry::StructuredLogger # @return [LogEvent, nil] The created log event or nil if logging is disabled # # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:62 - def trace(message, parameters = T.unsafe(nil), **attributes); end + def trace(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end # Logs a message at WARN level # @@ -5924,7 +6259,7 @@ class Sentry::StructuredLogger # @return [LogEvent, nil] The created log event or nil if logging is disabled # # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:95 - def warn(message, parameters = T.unsafe(nil), **attributes); end + def warn(message = T.unsafe(nil), parameters = T.unsafe(nil), **attributes, &block); end end # Severity number mapping for log levels according to the Sentry Logs Protocol @@ -5933,37 +6268,37 @@ end # pkg:gem/sentry-ruby#lib/sentry/structured_logger.rb:35 Sentry::StructuredLogger::LEVELS = T.let(T.unsafe(nil), Hash) -# pkg:gem/sentry-ruby#lib/sentry/configuration.rb:974 +# pkg:gem/sentry-ruby#lib/sentry/configuration.rb:950 class Sentry::StructuredLoggingConfiguration - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:983 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:959 def initialize; end # File path for DebugStructuredLogger to log events to # @return [String, Pathname, nil] # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:977 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:953 def file_path; end # File path for DebugStructuredLogger to log events to # @return [String, Pathname, nil] # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:977 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:953 def file_path=(_arg0); end # The class to use as a structured logger. # @return [Class] # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:981 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:957 def logger_class; end # The class to use as a structured logger. # @return [Class] # - # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:981 + # pkg:gem/sentry-ruby#lib/sentry/configuration.rb:957 def logger_class=(_arg0); end end -# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:56 +# pkg:gem/sentry-ruby#lib/sentry-ruby.rb:58 Sentry::THREAD_LOCAL = T.let(T.unsafe(nil), Symbol) # TelemetryEventBuffer is a base class for buffering telemetry events (logs, metrics, etc.) @@ -6689,6 +7024,19 @@ module Sentry::Utils::HttpTracing end end +# pkg:gem/sentry-ruby#lib/sentry/utils/latency.rb:7 +module Sentry::Utils::Latency + private + + # pkg:gem/sentry-ruby#lib/sentry/utils/latency.rb:10 + def milliseconds_since(time); end + + class << self + # pkg:gem/sentry-ruby#lib/sentry/utils/latency.rb:10 + def milliseconds_since(time); end + end +end + # pkg:gem/sentry-ruby#lib/sentry/utils/real_ip.rb:11 class Sentry::Utils::RealIp # pkg:gem/sentry-ruby#lib/sentry/utils/real_ip.rb:23 @@ -6725,6 +7073,27 @@ end # pkg:gem/sentry-ruby#lib/sentry/utils/request_id.rb:6 Sentry::Utils::RequestId::REQUEST_ID_HEADERS = T.let(T.unsafe(nil), Array) +# pkg:gem/sentry-ruby#lib/sentry/utils/ring_buffer.rb:7 +class Sentry::Utils::RingBuffer + # pkg:gem/sentry-ruby#lib/sentry/utils/ring_buffer.rb:10 + def initialize(capacity); end + + # pkg:gem/sentry-ruby#lib/sentry/utils/ring_buffer.rb:23 + def clear; end + + # pkg:gem/sentry-ruby#lib/sentry/utils/ring_buffer.rb:31 + def dup; end + + # pkg:gem/sentry-ruby#lib/sentry/utils/ring_buffer.rb:27 + def empty?; end + + # pkg:gem/sentry-ruby#lib/sentry/utils/ring_buffer.rb:17 + def set(key, value); end + + # pkg:gem/sentry-ruby#lib/sentry/utils/ring_buffer.rb:8 + def values; end +end + # pkg:gem/sentry-ruby#lib/sentry/utils/sample_rand.rb:5 class Sentry::Utils::SampleRand # pkg:gem/sentry-ruby#lib/sentry/utils/sample_rand.rb:23 diff --git a/sorbet/rbi/gems/shrine@3.10.2.rbi b/sorbet/rbi/gems/shrine@3.11.0.rbi similarity index 100% rename from sorbet/rbi/gems/shrine@3.10.2.rbi rename to sorbet/rbi/gems/shrine@3.11.0.rbi diff --git a/sorbet/rbi/gems/websocket-driver@0.8.2.rbi b/sorbet/rbi/gems/websocket-driver@0.8.2.rbi deleted file mode 100644 index f7267543..00000000 --- a/sorbet/rbi/gems/websocket-driver@0.8.2.rbi +++ /dev/null @@ -1,996 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `websocket-driver` gem. -# Please instead update this file by running `bin/tapioca gem websocket-driver`. - - -# source://websocket-driver//lib/websocket/driver.rb#16 -module WebSocket; end - -# source://websocket-driver//lib/websocket/driver.rb#19 -class WebSocket::Driver - include ::WebSocket::Driver::EventEmitter - - # @return [Driver] a new instance of Driver - # - # source://websocket-driver//lib/websocket/driver.rb#72 - def initialize(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver.rb#92 - def add_extension(extension); end - - # source://websocket-driver//lib/websocket/driver.rb#125 - def binary(message); end - - # source://websocket-driver//lib/websocket/driver.rb#137 - def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver.rb#129 - def ping(*args); end - - # source://websocket-driver//lib/websocket/driver.rb#133 - def pong(*args); end - - # Returns the value of attribute protocol. - # - # source://websocket-driver//lib/websocket/driver.rb#70 - def protocol; end - - # Returns the value of attribute ready_state. - # - # source://websocket-driver//lib/websocket/driver.rb#70 - def ready_state; end - - # source://websocket-driver//lib/websocket/driver.rb#96 - def set_header(name, value); end - - # source://websocket-driver//lib/websocket/driver.rb#102 - def start; end - - # source://websocket-driver//lib/websocket/driver.rb#87 - def state; end - - # source://websocket-driver//lib/websocket/driver.rb#120 - def text(message); end - - private - - # source://websocket-driver//lib/websocket/driver.rb#158 - def fail(type, message); end - - # source://websocket-driver//lib/websocket/driver.rb#146 - def fail_handshake(error); end - - # source://websocket-driver//lib/websocket/driver.rb#164 - def open; end - - # source://websocket-driver//lib/websocket/driver.rb#171 - def queue(message); end - - class << self - # source://websocket-driver//lib/websocket/driver.rb#176 - def client(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver.rb#200 - def encode(data, encoding = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver.rb#216 - def host_header(uri); end - - # source://websocket-driver//lib/websocket/driver.rb#184 - def rack(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver.rb#180 - def server(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver.rb#224 - def validate_options(options, valid_keys); end - - # @return [Boolean] - # - # source://websocket-driver//lib/websocket/driver.rb#238 - def websocket?(env); end - end -end - -# source://websocket-driver//lib/websocket/driver/client.rb#4 -class WebSocket::Driver::Client < ::WebSocket::Driver::Hybi - # @return [Client] a new instance of Client - # - # source://websocket-driver//lib/websocket/driver/client.rb#13 - def initialize(socket, options = T.unsafe(nil)); end - - # Returns the value of attribute headers. - # - # source://websocket-driver//lib/websocket/driver/client.rb#11 - def headers; end - - # source://websocket-driver//lib/websocket/driver/client.rb#60 - def parse(chunk); end - - # source://websocket-driver//lib/websocket/driver/client.rb#49 - def proxy(origin, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/client.rb#53 - def start; end - - # Returns the value of attribute status. - # - # source://websocket-driver//lib/websocket/driver/client.rb#11 - def status; end - - # source://websocket-driver//lib/websocket/driver/client.rb#45 - def version; end - - private - - # source://websocket-driver//lib/websocket/driver/client.rb#86 - def fail_handshake(message); end - - # source://websocket-driver//lib/websocket/driver/client.rb#77 - def handshake_request; end - - # source://websocket-driver//lib/websocket/driver/client.rb#93 - def validate_handshake; end - - class << self - # source://websocket-driver//lib/websocket/driver/client.rb#7 - def generate_key; end - end -end - -# source://websocket-driver//lib/websocket/driver/client.rb#5 -WebSocket::Driver::Client::VALID_SCHEMES = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver.rb#53 -class WebSocket::Driver::CloseEvent < ::Struct - # Returns the value of attribute code - # - # @return [Object] the current value of code - def code; end - - # Sets the attribute code - # - # @param value [Object] the value to set the attribute code to. - # @return [Object] the newly set value - def code=(_); end - - # Returns the value of attribute reason - # - # @return [Object] the current value of reason - def reason; end - - # Sets the attribute reason - # - # @param value [Object] the value to set the attribute reason to. - # @return [Object] the newly set value - def reason=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://websocket-driver//lib/websocket/driver.rb#57 -class WebSocket::Driver::ConfigurationError < ::ArgumentError; end - -# source://websocket-driver//lib/websocket/driver.rb#48 -class WebSocket::Driver::ConnectEvent < ::Struct - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://websocket-driver//lib/websocket/driver/draft75.rb#4 -class WebSocket::Driver::Draft75 < ::WebSocket::Driver - # @return [Draft75] a new instance of Draft75 - # - # source://websocket-driver//lib/websocket/driver/draft75.rb#5 - def initialize(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/draft75.rb#21 - def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/draft75.rb#74 - def frame(buffer, type = T.unsafe(nil), error_type = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/draft75.rb#28 - def parse(chunk); end - - # source://websocket-driver//lib/websocket/driver/draft75.rb#17 - def version; end - - private - - # source://websocket-driver//lib/websocket/driver/draft75.rb#83 - def handshake_response; end - - # source://websocket-driver//lib/websocket/driver/draft75.rb#89 - def parse_leading_byte(octet); end -end - -# source://websocket-driver//lib/websocket/driver/draft76.rb#4 -class WebSocket::Driver::Draft76 < ::WebSocket::Driver::Draft75 - # @return [Draft76] a new instance of Draft76 - # - # source://websocket-driver//lib/websocket/driver/draft76.rb#7 - def initialize(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#31 - def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#25 - def start; end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#21 - def version; end - - private - - # @raise [ProtocolError] - # - # source://websocket-driver//lib/websocket/driver/draft76.rb#41 - def handshake_response; end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#66 - def handshake_signature; end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#88 - def number_from_key(key); end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#81 - def parse_leading_byte(octet); end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#73 - def send_handshake_body; end - - # source://websocket-driver//lib/websocket/driver/draft76.rb#93 - def spaces_in_key(key); end -end - -# source://websocket-driver//lib/websocket/driver/draft76.rb#5 -WebSocket::Driver::Draft76::BODY_SIZE = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/event_emitter.rb#4 -module WebSocket::Driver::EventEmitter - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#5 - def initialize; end - - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#9 - def add_listener(event, callable = T.unsafe(nil), &block); end - - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#37 - def emit(event, *args); end - - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#43 - def listener_count(event); end - - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#48 - def listeners(event); end - - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#15 - def on(event, callable = T.unsafe(nil), &block); end - - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#29 - def remove_all_listeners(event = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/event_emitter.rb#23 - def remove_listener(event, callable = T.unsafe(nil), &block); end -end - -# source://websocket-driver//lib/websocket/driver/headers.rb#4 -class WebSocket::Driver::Headers - # @return [Headers] a new instance of Headers - # - # source://websocket-driver//lib/websocket/driver/headers.rb#7 - def initialize(received = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/headers.rb#20 - def [](name); end - - # source://websocket-driver//lib/websocket/driver/headers.rb#24 - def []=(name, value); end - - # source://websocket-driver//lib/websocket/driver/headers.rb#15 - def clear; end - - # source://websocket-driver//lib/websocket/driver/headers.rb#31 - def inspect; end - - # source://websocket-driver//lib/websocket/driver/headers.rb#35 - def to_h; end - - # source://websocket-driver//lib/websocket/driver/headers.rb#39 - def to_s; end -end - -# source://websocket-driver//lib/websocket/driver/headers.rb#5 -WebSocket::Driver::Headers::ALLOWED_DUPLICATES = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#6 -class WebSocket::Driver::Hybi < ::WebSocket::Driver - # @return [Hybi] a new instance of Hybi - # - # source://websocket-driver//lib/websocket/driver/hybi.rb#59 - def initialize(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#86 - def add_extension(extension); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#129 - def binary(message); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#142 - def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#159 - def frame(buffer, type = T.unsafe(nil), code = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#91 - def parse(chunk); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#133 - def ping(message = T.unsafe(nil), &callback); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#138 - def pong(message = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#82 - def version; end - - private - - # source://websocket-driver//lib/websocket/driver/hybi.rb#338 - def check_frame_length; end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#349 - def emit_frame(buffer); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#397 - def emit_message; end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#272 - def fail(type, message); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#234 - def handshake_response; end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#327 - def parse_extended_length(buffer); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#310 - def parse_length(octet); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#277 - def parse_opcode(octet); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#198 - def send_frame(frame); end - - # source://websocket-driver//lib/websocket/driver/hybi.rb#260 - def shutdown(code, reason, error = T.unsafe(nil)); end - - class << self - # source://websocket-driver//lib/websocket/driver/hybi.rb#12 - def generate_accept(key); end - end -end - -# source://websocket-driver//lib/websocket/driver/hybi.rb#19 -WebSocket::Driver::Hybi::BYTE = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#53 -WebSocket::Driver::Hybi::DEFAULT_ERROR_CODE = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#40 -WebSocket::Driver::Hybi::ERRORS = T.let(T.unsafe(nil), Hash) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#52 -WebSocket::Driver::Hybi::ERROR_CODES = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#20 -WebSocket::Driver::Hybi::FIN = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi/frame.rb#5 -class WebSocket::Driver::Hybi::Frame - # Returns the value of attribute final. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def final; end - - # Sets the attribute final - # - # @param value the value to set the attribute final to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def final=(_arg0); end - - # Returns the value of attribute length. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def length; end - - # Sets the attribute length - # - # @param value the value to set the attribute length to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def length=(_arg0); end - - # Returns the value of attribute length_bytes. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def length_bytes; end - - # Sets the attribute length_bytes - # - # @param value the value to set the attribute length_bytes to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def length_bytes=(_arg0); end - - # Returns the value of attribute masked. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def masked; end - - # Sets the attribute masked - # - # @param value the value to set the attribute masked to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def masked=(_arg0); end - - # Returns the value of attribute masking_key. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def masking_key; end - - # Sets the attribute masking_key - # - # @param value the value to set the attribute masking_key to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def masking_key=(_arg0); end - - # Returns the value of attribute opcode. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def opcode; end - - # Sets the attribute opcode - # - # @param value the value to set the attribute opcode to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def opcode=(_arg0); end - - # Returns the value of attribute payload. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def payload; end - - # Sets the attribute payload - # - # @param value the value to set the attribute payload to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def payload=(_arg0); end - - # Returns the value of attribute rsv1. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def rsv1; end - - # Sets the attribute rsv1 - # - # @param value the value to set the attribute rsv1 to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def rsv1=(_arg0); end - - # Returns the value of attribute rsv2. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def rsv2; end - - # Sets the attribute rsv2 - # - # @param value the value to set the attribute rsv2 to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def rsv2=(_arg0); end - - # Returns the value of attribute rsv3. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def rsv3; end - - # Sets the attribute rsv3 - # - # @param value the value to set the attribute rsv3 to. - # - # source://websocket-driver//lib/websocket/driver/hybi/frame.rb#6 - def rsv3=(_arg0); end -end - -# source://websocket-driver//lib/websocket/driver/hybi.rb#17 -WebSocket::Driver::Hybi::GUID = T.let(T.unsafe(nil), String) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#25 -WebSocket::Driver::Hybi::LENGTH = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#20 -WebSocket::Driver::Hybi::MASK = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#55 -WebSocket::Driver::Hybi::MAX_RESERVED_ERROR = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#37 -WebSocket::Driver::Hybi::MESSAGE_OPCODES = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#54 -WebSocket::Driver::Hybi::MIN_RESERVED_ERROR = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi/message.rb#5 -class WebSocket::Driver::Hybi::Message - # @return [Message] a new instance of Message - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#12 - def initialize; end - - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#20 - def <<(frame); end - - # Returns the value of attribute data. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def data; end - - # Sets the attribute data - # - # @param value the value to set the attribute data to. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def data=(_arg0); end - - # Returns the value of attribute opcode. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def opcode; end - - # Sets the attribute opcode - # - # @param value the value to set the attribute opcode to. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def opcode=(_arg0); end - - # Returns the value of attribute rsv1. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def rsv1; end - - # Sets the attribute rsv1 - # - # @param value the value to set the attribute rsv1 to. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def rsv1=(_arg0); end - - # Returns the value of attribute rsv2. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def rsv2; end - - # Sets the attribute rsv2 - # - # @param value the value to set the attribute rsv2 to. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def rsv2=(_arg0); end - - # Returns the value of attribute rsv3. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def rsv3; end - - # Sets the attribute rsv3 - # - # @param value the value to set the attribute rsv3 to. - # - # source://websocket-driver//lib/websocket/driver/hybi/message.rb#6 - def rsv3=(_arg0); end -end - -# source://websocket-driver//lib/websocket/driver/hybi.rb#24 -WebSocket::Driver::Hybi::OPCODE = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#27 -WebSocket::Driver::Hybi::OPCODES = T.let(T.unsafe(nil), Hash) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#36 -WebSocket::Driver::Hybi::OPCODE_CODES = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#38 -WebSocket::Driver::Hybi::OPENING_OPCODES = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#57 -WebSocket::Driver::Hybi::PACK_FORMATS = T.let(T.unsafe(nil), Hash) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#21 -WebSocket::Driver::Hybi::RSV1 = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#22 -WebSocket::Driver::Hybi::RSV2 = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#23 -WebSocket::Driver::Hybi::RSV3 = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver/hybi.rb#16 -WebSocket::Driver::Hybi::VERSION = T.let(T.unsafe(nil), String) - -# source://websocket-driver//lib/websocket/driver.rb#44 -WebSocket::Driver::MAX_LENGTH = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver.rb#50 -class WebSocket::Driver::MessageEvent < ::Struct - # Returns the value of attribute data - # - # @return [Object] the current value of data - def data; end - - # Sets the attribute data - # - # @param value [Object] the value to set the attribute data to. - # @return [Object] the newly set value - def data=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://websocket-driver//lib/websocket/driver.rb#49 -class WebSocket::Driver::OpenEvent < ::Struct - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://websocket-driver//lib/websocket/driver.rb#45 -WebSocket::Driver::PORTS = T.let(T.unsafe(nil), Hash) - -# source://websocket-driver//lib/websocket/driver.rb#51 -class WebSocket::Driver::PingEvent < ::Struct - # Returns the value of attribute data - # - # @return [Object] the current value of data - def data; end - - # Sets the attribute data - # - # @param value [Object] the value to set the attribute data to. - # @return [Object] the newly set value - def data=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://websocket-driver//lib/websocket/driver.rb#52 -class WebSocket::Driver::PongEvent < ::Struct - # Returns the value of attribute data - # - # @return [Object] the current value of data - def data; end - - # Sets the attribute data - # - # @param value [Object] the value to set the attribute data to. - # @return [Object] the newly set value - def data=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://websocket-driver//lib/websocket/driver.rb#55 -class WebSocket::Driver::ProtocolError < ::StandardError; end - -# source://websocket-driver//lib/websocket/driver/proxy.rb#4 -class WebSocket::Driver::Proxy - include ::WebSocket::Driver::EventEmitter - - # @return [Proxy] a new instance of Proxy - # - # source://websocket-driver//lib/websocket/driver/proxy.rb#9 - def initialize(client, origin, options); end - - # Returns the value of attribute headers. - # - # source://websocket-driver//lib/websocket/driver/proxy.rb#7 - def headers; end - - # source://websocket-driver//lib/websocket/driver/proxy.rb#49 - def parse(chunk); end - - # source://websocket-driver//lib/websocket/driver/proxy.rb#31 - def set_header(name, value); end - - # source://websocket-driver//lib/websocket/driver/proxy.rb#37 - def start; end - - # Returns the value of attribute status. - # - # source://websocket-driver//lib/websocket/driver/proxy.rb#7 - def status; end -end - -# source://websocket-driver//lib/websocket/driver.rb#46 -WebSocket::Driver::STATES = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver/server.rb#4 -class WebSocket::Driver::Server < ::WebSocket::Driver - # @return [Server] a new instance of Server - # - # source://websocket-driver//lib/websocket/driver/server.rb#7 - def initialize(socket, options = T.unsafe(nil)); end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def add_extension(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def binary(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def close(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#13 - def env; end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def frame(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#43 - def parse(chunk); end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def ping(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#38 - def protocol; end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def set_header(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def start(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#27 - def text(*args, &block); end - - # source://websocket-driver//lib/websocket/driver/server.rb#17 - def url; end - - # source://websocket-driver//lib/websocket/driver/server.rb#38 - def version; end - - # source://websocket-driver//lib/websocket/driver/server.rb#60 - def write(buffer); end - - private - - # source://websocket-driver//lib/websocket/driver/server.rb#66 - def fail_request(message); end - - # source://websocket-driver//lib/websocket/driver/server.rb#71 - def open; end -end - -# source://websocket-driver//lib/websocket/driver/server.rb#5 -WebSocket::Driver::Server::EVENTS = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/driver/stream_reader.rb#4 -class WebSocket::Driver::StreamReader - # @return [StreamReader] a new instance of StreamReader - # - # source://websocket-driver//lib/websocket/driver/stream_reader.rb#8 - def initialize; end - - # source://websocket-driver//lib/websocket/driver/stream_reader.rb#30 - def each_byte; end - - # source://websocket-driver//lib/websocket/driver/stream_reader.rb#13 - def put(chunk); end - - # Read bytes from the data: - # - # source://websocket-driver//lib/websocket/driver/stream_reader.rb#19 - def read(length); end - - private - - # source://websocket-driver//lib/websocket/driver/stream_reader.rb#41 - def prune; end -end - -# Try to minimise the number of reallocations done: -# -# source://websocket-driver//lib/websocket/driver/stream_reader.rb#6 -WebSocket::Driver::StreamReader::MINIMUM_AUTOMATIC_PRUNE_OFFSET = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/driver.rb#56 -class WebSocket::Driver::URIError < ::ArgumentError; end - -# source://websocket-driver//lib/websocket/http.rb#2 -module WebSocket::HTTP - class << self - # source://websocket-driver//lib/websocket/http.rb#10 - def normalize_header(name); end - end -end - -# source://websocket-driver//lib/websocket/http/headers.rb#4 -module WebSocket::HTTP::Headers - # source://websocket-driver//lib/websocket/http/headers.rb#40 - def initialize; end - - # @return [Boolean] - # - # source://websocket-driver//lib/websocket/http/headers.rb#48 - def complete?; end - - # @return [Boolean] - # - # source://websocket-driver//lib/websocket/http/headers.rb#52 - def error?; end - - # Returns the value of attribute headers. - # - # source://websocket-driver//lib/websocket/http/headers.rb#38 - def headers; end - - # source://websocket-driver//lib/websocket/http/headers.rb#56 - def parse(chunk); end - - private - - # source://websocket-driver//lib/websocket/http/headers.rb#87 - def complete; end - - # source://websocket-driver//lib/websocket/http/headers.rb#91 - def error; end - - # source://websocket-driver//lib/websocket/http/headers.rb#95 - def header_line(line); end - - # source://websocket-driver//lib/websocket/http/headers.rb#109 - def string_buffer; end -end - -# source://websocket-driver//lib/websocket/http/headers.rb#6 -WebSocket::HTTP::Headers::CR = T.let(T.unsafe(nil), Integer) - -# RFC 2616 grammar rules: -# -# CHAR = -# -# CTL = -# -# SP = -# -# HT = -# -# token = 1* -# -# separators = "(" | ")" | "<" | ">" | "@" -# | "," | ";" | ":" | "\" | <"> -# | "/" | "[" | "]" | "?" | "=" -# | "{" | "}" | SP | HT -# -# Or, as redefined in RFC 7230: -# -# token = 1*tchar -# -# tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" -# / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" -# / DIGIT / ALPHA -# ; any VCHAR, except delimiters -# -# source://websocket-driver//lib/websocket/http/headers.rb#36 -WebSocket::HTTP::Headers::HEADER_LINE = T.let(T.unsafe(nil), Regexp) - -# source://websocket-driver//lib/websocket/http/headers.rb#7 -WebSocket::HTTP::Headers::LF = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/http/headers.rb#5 -WebSocket::HTTP::Headers::MAX_REQUEST_SIZE = T.let(T.unsafe(nil), Integer) - -# source://websocket-driver//lib/websocket/http/request.rb#4 -class WebSocket::HTTP::Request - include ::WebSocket::HTTP::Headers - - # Returns the value of attribute env. - # - # source://websocket-driver//lib/websocket/http/request.rb#11 - def env; end - - private - - # source://websocket-driver//lib/websocket/http/request.rb#29 - def complete; end - - # source://websocket-driver//lib/websocket/http/request.rb#40 - def set_server_vars; end - - # source://websocket-driver//lib/websocket/http/request.rb#15 - def start_line(line); end -end - -# source://websocket-driver//lib/websocket/http/request.rb#7 -WebSocket::HTTP::Request::REQUEST_LINE = T.let(T.unsafe(nil), Regexp) - -# source://websocket-driver//lib/websocket/http/request.rb#8 -WebSocket::HTTP::Request::REQUEST_TARGET = T.let(T.unsafe(nil), Regexp) - -# source://websocket-driver//lib/websocket/http/request.rb#9 -WebSocket::HTTP::Request::RESERVED_HEADERS = T.let(T.unsafe(nil), Array) - -# source://websocket-driver//lib/websocket/http/response.rb#4 -class WebSocket::HTTP::Response - include ::WebSocket::HTTP::Headers - - # source://websocket-driver//lib/websocket/http/response.rb#11 - def [](name); end - - # source://websocket-driver//lib/websocket/http/response.rb#15 - def body; end - - # Returns the value of attribute code. - # - # source://websocket-driver//lib/websocket/http/response.rb#9 - def code; end - - private - - # source://websocket-driver//lib/websocket/http/response.rb#21 - def start_line(line); end -end - -# source://websocket-driver//lib/websocket/http/response.rb#7 -WebSocket::HTTP::Response::STATUS_LINE = T.let(T.unsafe(nil), Regexp) - -module WebSocket::Mask - class << self - def mask(_arg0, _arg1); end - end -end diff --git a/sorbet/rbi/gems/websocket-driver@0.9.0.rbi b/sorbet/rbi/gems/websocket-driver@0.9.0.rbi new file mode 100644 index 00000000..6a33d03c --- /dev/null +++ b/sorbet/rbi/gems/websocket-driver@0.9.0.rbi @@ -0,0 +1,888 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `websocket-driver` gem. +# Please instead update this file by running `bin/tapioca gem websocket-driver`. + + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:16 +module WebSocket; end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:19 +class WebSocket::Driver + include ::WebSocket::Driver::EventEmitter + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:72 + def initialize(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:95 + def add_extension(extension); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:128 + def binary(message); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:140 + def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:132 + def ping(*args); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:136 + def pong(*args); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:70 + def protocol; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:70 + def ready_state; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:99 + def set_header(name, value); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:105 + def start; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:90 + def state; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:123 + def text(message); end + + private + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:161 + def fail(type, message); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:149 + def fail_handshake(error); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:167 + def open; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:174 + def queue(message); end + + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:179 + def client(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:203 + def encode(data, encoding = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:219 + def host_header(uri); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:187 + def rack(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:183 + def server(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:227 + def validate_options(options, valid_keys); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:231 + def websocket?(env); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/client.rb:4 +class WebSocket::Driver::Client < ::WebSocket::Driver::Hybi + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:13 + def initialize(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:11 + def headers; end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:60 + def parse(chunk); end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:49 + def proxy(origin, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:53 + def start; end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:11 + def status; end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:45 + def version; end + + private + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:86 + def fail_handshake(message); end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:77 + def handshake_request; end + + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:93 + def validate_handshake; end + + class << self + # pkg:gem/websocket-driver#lib/websocket/driver/client.rb:7 + def generate_key; end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/client.rb:5 +WebSocket::Driver::Client::VALID_SCHEMES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:53 +class WebSocket::Driver::CloseEvent < ::Struct + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def code; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def code=(_); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def reason; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def reason=(_); end + + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def [](*_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def inspect; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def keyword_init?; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def members; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:53 + def new(*_arg0); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:57 +class WebSocket::Driver::ConfigurationError < ::ArgumentError; end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:48 +class WebSocket::Driver::ConnectEvent < ::Struct + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:48 + def [](*_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:48 + def inspect; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:48 + def keyword_init?; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:48 + def members; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:48 + def new(*_arg0); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:4 +class WebSocket::Driver::Draft75 < ::WebSocket::Driver + # pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:5 + def initialize(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:21 + def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:77 + def frame(buffer, type = T.unsafe(nil), error_type = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:28 + def parse(chunk); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:17 + def version; end + + private + + # pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:86 + def handshake_response; end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft75.rb:92 + def parse_leading_byte(octet); end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:4 +class WebSocket::Driver::Draft76 < ::WebSocket::Driver::Draft75 + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:7 + def initialize(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:31 + def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:25 + def start; end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:21 + def version; end + + private + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:78 + def get_key_value(key); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:41 + def handshake_response; end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:56 + def handshake_signature; end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:71 + def parse_leading_byte(octet); end + + # pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:63 + def send_handshake_body; end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/draft76.rb:5 +WebSocket::Driver::Draft76::BODY_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:4 +module WebSocket::Driver::EventEmitter + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:5 + def initialize; end + + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:9 + def add_listener(event, callable = T.unsafe(nil), &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:37 + def emit(event, *args); end + + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:43 + def listener_count(event); end + + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:48 + def listeners(event); end + + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:15 + def on(event, callable = T.unsafe(nil), &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:29 + def remove_all_listeners(event = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/event_emitter.rb:23 + def remove_listener(event, callable = T.unsafe(nil), &block); end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:4 +class WebSocket::Driver::Headers + # pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:7 + def initialize(received = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:20 + def [](name); end + + # pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:24 + def []=(name, value); end + + # pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:15 + def clear; end + + # pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:31 + def inspect; end + + # pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:35 + def to_h; end + + # pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:39 + def to_s; end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/headers.rb:5 +WebSocket::Driver::Headers::ALLOWED_DUPLICATES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:6 +class WebSocket::Driver::Hybi < ::WebSocket::Driver + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:59 + def initialize(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:86 + def add_extension(extension); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:129 + def binary(message); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:142 + def close(reason = T.unsafe(nil), code = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:159 + def frame(buffer, type = T.unsafe(nil), code = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:91 + def parse(chunk); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:133 + def ping(message = T.unsafe(nil), &callback); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:138 + def pong(message = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:82 + def version; end + + private + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:339 + def check_frame_length; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:350 + def emit_frame(buffer); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:398 + def emit_message; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:272 + def fail(type, message); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:234 + def handshake_response; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:328 + def parse_extended_length(buffer); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:311 + def parse_length(octet); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:278 + def parse_opcode(octet); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:198 + def send_frame(frame); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:260 + def shutdown(code, reason, error = T.unsafe(nil)); end + + class << self + # pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:12 + def generate_accept(key); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:19 +WebSocket::Driver::Hybi::BYTE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:53 +WebSocket::Driver::Hybi::DEFAULT_ERROR_CODE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:40 +WebSocket::Driver::Hybi::ERRORS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:52 +WebSocket::Driver::Hybi::ERROR_CODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:20 +WebSocket::Driver::Hybi::FIN = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:5 +class WebSocket::Driver::Hybi::Frame + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def final; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def final=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def length; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def length=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def length_bytes; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def length_bytes=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def masked; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def masked=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def masking_key; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def masking_key=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def opcode; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def opcode=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def payload; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def payload=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def rsv1; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def rsv1=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def rsv2; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def rsv2=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def rsv3; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/frame.rb:6 + def rsv3=(_arg0); end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:17 +WebSocket::Driver::Hybi::GUID = T.let(T.unsafe(nil), String) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:25 +WebSocket::Driver::Hybi::LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:20 +WebSocket::Driver::Hybi::MASK = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:55 +WebSocket::Driver::Hybi::MAX_RESERVED_ERROR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:37 +WebSocket::Driver::Hybi::MESSAGE_OPCODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:54 +WebSocket::Driver::Hybi::MIN_RESERVED_ERROR = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:5 +class WebSocket::Driver::Hybi::Message + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:12 + def initialize; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:20 + def <<(frame); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def data; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def data=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def opcode; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def opcode=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def rsv1; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def rsv1=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def rsv2; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def rsv2=(_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def rsv3; end + + # pkg:gem/websocket-driver#lib/websocket/driver/hybi/message.rb:6 + def rsv3=(_arg0); end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:24 +WebSocket::Driver::Hybi::OPCODE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:27 +WebSocket::Driver::Hybi::OPCODES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:36 +WebSocket::Driver::Hybi::OPCODE_CODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:38 +WebSocket::Driver::Hybi::OPENING_OPCODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:57 +WebSocket::Driver::Hybi::PACK_FORMATS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:21 +WebSocket::Driver::Hybi::RSV1 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:22 +WebSocket::Driver::Hybi::RSV2 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:23 +WebSocket::Driver::Hybi::RSV3 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver/hybi.rb:16 +WebSocket::Driver::Hybi::VERSION = T.let(T.unsafe(nil), String) + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:44 +WebSocket::Driver::MAX_LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:50 +class WebSocket::Driver::MessageEvent < ::Struct + # pkg:gem/websocket-driver#lib/websocket/driver.rb:50 + def data; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:50 + def data=(_); end + + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:50 + def [](*_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:50 + def inspect; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:50 + def keyword_init?; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:50 + def members; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:50 + def new(*_arg0); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:49 +class WebSocket::Driver::OpenEvent < ::Struct + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:49 + def [](*_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:49 + def inspect; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:49 + def keyword_init?; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:49 + def members; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:49 + def new(*_arg0); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:45 +WebSocket::Driver::PORTS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:51 +class WebSocket::Driver::PingEvent < ::Struct + # pkg:gem/websocket-driver#lib/websocket/driver.rb:51 + def data; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:51 + def data=(_); end + + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:51 + def [](*_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:51 + def inspect; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:51 + def keyword_init?; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:51 + def members; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:51 + def new(*_arg0); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:52 +class WebSocket::Driver::PongEvent < ::Struct + # pkg:gem/websocket-driver#lib/websocket/driver.rb:52 + def data; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:52 + def data=(_); end + + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:52 + def [](*_arg0); end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:52 + def inspect; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:52 + def keyword_init?; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:52 + def members; end + + # pkg:gem/websocket-driver#lib/websocket/driver.rb:52 + def new(*_arg0); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:55 +class WebSocket::Driver::ProtocolError < ::StandardError; end + +# pkg:gem/websocket-driver#lib/websocket/driver/proxy.rb:4 +class WebSocket::Driver::Proxy + include ::WebSocket::Driver::EventEmitter + + # pkg:gem/websocket-driver#lib/websocket/driver/proxy.rb:9 + def initialize(client, origin, options); end + + # pkg:gem/websocket-driver#lib/websocket/driver/proxy.rb:7 + def headers; end + + # pkg:gem/websocket-driver#lib/websocket/driver/proxy.rb:49 + def parse(chunk); end + + # pkg:gem/websocket-driver#lib/websocket/driver/proxy.rb:31 + def set_header(name, value); end + + # pkg:gem/websocket-driver#lib/websocket/driver/proxy.rb:37 + def start; end + + # pkg:gem/websocket-driver#lib/websocket/driver/proxy.rb:7 + def status; end +end + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:46 +WebSocket::Driver::STATES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver/server.rb:4 +class WebSocket::Driver::Server < ::WebSocket::Driver + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:7 + def initialize(socket, options = T.unsafe(nil)); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def add_extension(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def binary(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def close(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:13 + def env; end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def frame(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:43 + def parse(chunk); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def ping(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:38 + def protocol; end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def set_header(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def start(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:27 + def text(*args, &block); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:17 + def url; end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:38 + def version; end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:60 + def write(buffer); end + + private + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:66 + def fail_request(message); end + + # pkg:gem/websocket-driver#lib/websocket/driver/server.rb:71 + def open; end +end + +# pkg:gem/websocket-driver#lib/websocket/driver/server.rb:5 +WebSocket::Driver::Server::EVENTS = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/driver/stream_reader.rb:4 +class WebSocket::Driver::StreamReader + # pkg:gem/websocket-driver#lib/websocket/driver/stream_reader.rb:8 + def initialize; end + + # pkg:gem/websocket-driver#lib/websocket/driver/stream_reader.rb:30 + def each_byte; end + + # pkg:gem/websocket-driver#lib/websocket/driver/stream_reader.rb:13 + def put(chunk); end + + # Read bytes from the data: + # + # pkg:gem/websocket-driver#lib/websocket/driver/stream_reader.rb:19 + def read(length); end + + private + + # pkg:gem/websocket-driver#lib/websocket/driver/stream_reader.rb:41 + def prune; end +end + +# Try to minimise the number of reallocations done: +# +# pkg:gem/websocket-driver#lib/websocket/driver/stream_reader.rb:6 +WebSocket::Driver::StreamReader::MINIMUM_AUTOMATIC_PRUNE_OFFSET = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:56 +class WebSocket::Driver::URIError < ::ArgumentError; end + +# pkg:gem/websocket-driver#lib/websocket/http.rb:2 +module WebSocket::HTTP + class << self + # pkg:gem/websocket-driver#lib/websocket/http.rb:10 + def normalize_header(name); end + end +end + +# pkg:gem/websocket-driver#lib/websocket/http/headers.rb:4 +module WebSocket::HTTP::Headers + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:40 + def initialize; end + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:48 + def complete?; end + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:52 + def error?; end + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:38 + def headers; end + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:56 + def parse(chunk); end + + private + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:87 + def complete; end + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:91 + def error; end + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:95 + def header_line(line); end + + # pkg:gem/websocket-driver#lib/websocket/http/headers.rb:109 + def string_buffer; end +end + +# pkg:gem/websocket-driver#lib/websocket/http/headers.rb:6 +WebSocket::HTTP::Headers::CR = T.let(T.unsafe(nil), Integer) + +# RFC 2616 grammar rules: +# +# CHAR = +# +# CTL = +# +# SP = +# +# HT = +# +# token = 1* +# +# separators = "(" | ")" | "<" | ">" | "@" +# | "," | ";" | ":" | "\" | <"> +# | "/" | "[" | "]" | "?" | "=" +# | "{" | "}" | SP | HT +# +# Or, as redefined in RFC 7230: +# +# token = 1*tchar +# +# tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" +# / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" +# / DIGIT / ALPHA +# ; any VCHAR, except delimiters +# +# pkg:gem/websocket-driver#lib/websocket/http/headers.rb:36 +WebSocket::HTTP::Headers::HEADER_LINE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-driver#lib/websocket/http/headers.rb:7 +WebSocket::HTTP::Headers::LF = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/http/headers.rb:5 +WebSocket::HTTP::Headers::MAX_REQUEST_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/websocket-driver#lib/websocket/http/request.rb:4 +class WebSocket::HTTP::Request + include ::WebSocket::HTTP::Headers + + # pkg:gem/websocket-driver#lib/websocket/http/request.rb:11 + def env; end + + private + + # pkg:gem/websocket-driver#lib/websocket/http/request.rb:29 + def complete; end + + # pkg:gem/websocket-driver#lib/websocket/http/request.rb:40 + def set_server_vars; end + + # pkg:gem/websocket-driver#lib/websocket/http/request.rb:15 + def start_line(line); end +end + +# pkg:gem/websocket-driver#lib/websocket/http/request.rb:7 +WebSocket::HTTP::Request::REQUEST_LINE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-driver#lib/websocket/http/request.rb:8 +WebSocket::HTTP::Request::REQUEST_TARGET = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-driver#lib/websocket/http/request.rb:9 +WebSocket::HTTP::Request::RESERVED_HEADERS = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-driver#lib/websocket/http/response.rb:4 +class WebSocket::HTTP::Response + include ::WebSocket::HTTP::Headers + + # pkg:gem/websocket-driver#lib/websocket/http/response.rb:11 + def [](name); end + + # pkg:gem/websocket-driver#lib/websocket/http/response.rb:15 + def body; end + + # pkg:gem/websocket-driver#lib/websocket/http/response.rb:9 + def code; end + + private + + # pkg:gem/websocket-driver#lib/websocket/http/response.rb:21 + def start_line(line); end +end + +# pkg:gem/websocket-driver#lib/websocket/http/response.rb:7 +WebSocket::HTTP::Response::STATUS_LINE = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-driver#lib/websocket/driver.rb:25 +module WebSocket::Mask + class << self + # pkg:gem/websocket-driver#lib/websocket/driver.rb:25 + def mask(_arg0, _arg1); end + end +end diff --git a/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi b/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi deleted file mode 100644 index 162d4081..00000000 --- a/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +++ /dev/null @@ -1,121 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `websocket-extensions` gem. -# Please instead update this file by running `bin/tapioca gem websocket-extensions`. - - -# source://websocket-extensions//lib/websocket/extensions.rb#1 -module WebSocket; end - -# source://websocket-extensions//lib/websocket/extensions.rb#2 -class WebSocket::Extensions - # @return [Extensions] a new instance of Extensions - # - # source://websocket-extensions//lib/websocket/extensions.rb#10 - def initialize; end - - # source://websocket-extensions//lib/websocket/extensions.rb#75 - def activate(header); end - - # source://websocket-extensions//lib/websocket/extensions.rb#19 - def add(ext); end - - # source://websocket-extensions//lib/websocket/extensions.rb#157 - def close; end - - # source://websocket-extensions//lib/websocket/extensions.rb#48 - def generate_offer; end - - # source://websocket-extensions//lib/websocket/extensions.rb#100 - def generate_response(header); end - - # source://websocket-extensions//lib/websocket/extensions.rb#137 - def process_incoming_message(message); end - - # source://websocket-extensions//lib/websocket/extensions.rb#147 - def process_outgoing_message(message); end - - # source://websocket-extensions//lib/websocket/extensions.rb#120 - def valid_frame_rsv(frame); end - - # source://websocket-extensions//lib/websocket/extensions.rb#120 - def valid_frame_rsv?(frame); end - - private - - # source://websocket-extensions//lib/websocket/extensions.rb#167 - def reserve(ext); end - - # @return [Boolean] - # - # source://websocket-extensions//lib/websocket/extensions.rb#173 - def reserved?(ext); end -end - -# source://websocket-extensions//lib/websocket/extensions.rb#6 -class WebSocket::Extensions::ExtensionError < ::ArgumentError; end - -# source://websocket-extensions//lib/websocket/extensions.rb#8 -WebSocket::Extensions::MESSAGE_OPCODES = T.let(T.unsafe(nil), Array) - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#83 -class WebSocket::Extensions::Offers - # @return [Offers] a new instance of Offers - # - # source://websocket-extensions//lib/websocket/extensions/parser.rb#84 - def initialize; end - - # source://websocket-extensions//lib/websocket/extensions/parser.rb#101 - def by_name(name); end - - # source://websocket-extensions//lib/websocket/extensions/parser.rb#95 - def each_offer(&block); end - - # source://websocket-extensions//lib/websocket/extensions/parser.rb#89 - def push(name, params); end - - # source://websocket-extensions//lib/websocket/extensions/parser.rb#105 - def to_a; end -end - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#6 -class WebSocket::Extensions::Parser - class << self - # source://websocket-extensions//lib/websocket/extensions/parser.rb#17 - def parse_header(header); end - - # source://websocket-extensions//lib/websocket/extensions/parser.rb#60 - def serialize_params(name, params); end - end -end - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#11 -WebSocket::Extensions::Parser::EXT = T.let(T.unsafe(nil), Regexp) - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#12 -WebSocket::Extensions::Parser::EXT_LIST = T.let(T.unsafe(nil), Regexp) - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#8 -WebSocket::Extensions::Parser::NOTOKEN = T.let(T.unsafe(nil), Regexp) - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#13 -WebSocket::Extensions::Parser::NUMBER = T.let(T.unsafe(nil), Regexp) - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#10 -WebSocket::Extensions::Parser::PARAM = T.let(T.unsafe(nil), Regexp) - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#15 -class WebSocket::Extensions::Parser::ParseError < ::ArgumentError; end - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#9 -WebSocket::Extensions::Parser::QUOTED = T.let(T.unsafe(nil), Regexp) - -# source://websocket-extensions//lib/websocket/extensions/parser.rb#7 -WebSocket::Extensions::Parser::TOKEN = T.let(T.unsafe(nil), Regexp) - -module WebSocket::Mask - class << self - def mask(_arg0, _arg1); end - end -end diff --git a/sorbet/rbi/gems/websocket-extensions@0.2.0.rbi b/sorbet/rbi/gems/websocket-extensions@0.2.0.rbi new file mode 100644 index 00000000..848095c8 --- /dev/null +++ b/sorbet/rbi/gems/websocket-extensions@0.2.0.rbi @@ -0,0 +1,177 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `websocket-extensions` gem. +# Please instead update this file by running `bin/tapioca gem websocket-extensions`. + + +# pkg:gem/websocket-extensions#lib/websocket/extensions.rb:1 +module WebSocket; end + +# pkg:gem/websocket-extensions#lib/websocket/extensions.rb:2 +class WebSocket::Extensions + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:29 + def initialize(options = T.unsafe(nil)); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:97 + def activate(header); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:39 + def add(ext); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:184 + def close; end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:68 + def generate_offer; end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:122 + def generate_response(header); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:162 + def process_incoming_message(message); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:173 + def process_outgoing_message(message); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:145 + def valid_frame_rsv(frame); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:160 + def valid_frame_rsv?(frame); end + + private + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:194 + def reserve(ext); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:200 + def reserved?(ext); end + + class << self + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:15 + def validate_options(options, valid_keys); end + end +end + +# pkg:gem/websocket-extensions#lib/websocket/extensions.rb:6 +class WebSocket::Extensions::ExtensionError < ::ArgumentError + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:9 + def initialize(message, type = T.unsafe(nil)); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions.rb:7 + def type; end +end + +# pkg:gem/websocket-extensions#lib/websocket/extensions.rb:27 +WebSocket::Extensions::MESSAGE_OPCODES = T.let(T.unsafe(nil), Array) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:135 +class WebSocket::Extensions::Offers + # pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:136 + def initialize; end + + # pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:153 + def by_name(name); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:147 + def each_offer(&block); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:141 + def push(name, params); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:157 + def to_a; end +end + +# RFC 6455 grammar rules: +# +# Sec-WebSocket-Extensions = extension-list +# +# extension-list = 1#extension +# +# extension = extension-token *( ";" extension-param ) +# +# extension-token = registered-token +# +# registered-token = token +# +# extension-param = token [ "=" (token | quoted-string) ] +# ; When using the quoted-string syntax variant, the value +# ; after quoted-string unescaping MUST conform to the +# ; 'token' ABNF. +# +# These make use of the following rules from RFC 2616: +# +# token = 1* +# +# separators = "(" | ")" | "<" | ">" | "@" +# | "," | ";" | ":" | "\" | <"> +# | "/" | "[" | "]" | "?" | "=" +# | "{" | "}" | SP | HT +# +# quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) +# +# qdtext = > +# +# quoted-pair = "\" CHAR +# +# CHAR = +# +# CTL = +# +# TEXT = +# +# LWS = [CRLF] 1*( SP | HT ) +# +# SP = +# +# HT = +# +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:51 +class WebSocket::Extensions::Parser + class << self + # pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:68 + def parse_header(header); end + + # pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:112 + def serialize_params(name, params); end + end +end + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:60 +WebSocket::Extensions::Parser::COM = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:58 +WebSocket::Extensions::Parser::EQL = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:63 +WebSocket::Extensions::Parser::EXT = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:64 +WebSocket::Extensions::Parser::EXT_LIST = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:57 +WebSocket::Extensions::Parser::LWS = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:53 +WebSocket::Extensions::Parser::NOTOKEN = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:55 +WebSocket::Extensions::Parser::NUMBER = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:62 +WebSocket::Extensions::Parser::PARAM = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:66 +class WebSocket::Extensions::Parser::ParseError < ::ArgumentError; end + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:54 +WebSocket::Extensions::Parser::QUOTED = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:59 +WebSocket::Extensions::Parser::SEM = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/websocket-extensions#lib/websocket/extensions/parser.rb:52 +WebSocket::Extensions::Parser::TOKEN = T.let(T.unsafe(nil), Regexp) From 02ea836bbcdeb8fb764c4ff4a11523aaed8af766 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Wed, 2 Dec 2026 12:40:17 +1300 Subject: [PATCH 2/3] Update CSpell, Prettier and the docs site packages, and override glob, minimatch and ws to patched versions --- docs/biome.json | 2 +- docs/package.json | 12 +- docs/pnpm-lock.yaml | 286 ++++++++++++++++--------------- docs/pnpm-workspace.yaml | 9 +- package.json | 10 +- pnpm-lock.yaml | 360 +++++++++++++++++++-------------------- 6 files changed, 345 insertions(+), 334 deletions(-) diff --git a/docs/biome.json b/docs/biome.json index b1101b3e..a1180d61 100644 --- a/docs/biome.json +++ b/docs/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.6.7/schema.json", + "$schema": "https://biomejs.dev/schemas/2.6.9/schema.json", "vcs": { "enabled": true, "clientKind": "git", diff --git a/docs/package.json b/docs/package.json index f8222fdb..c14655b4 100644 --- a/docs/package.json +++ b/docs/package.json @@ -29,20 +29,20 @@ "@types/react-syntax-highlighter": "^15.5.13", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", - "lucide-react": "^1.72.0", - "next": "16.4.5", + "lucide-react": "^1.79.0", + "next": "16.4.6", "next-themes": "^0.4.6", "react": "^19.3.1", "react-dom": "^19.3.1", "react-syntax-highlighter": "^16.1.2", - "recharts": "^3.10.1", - "tailwind-merge": "^3.7.0", + "recharts": "^3.11.1", + "tailwind-merge": "^3.7.1", "tailwindcss-animate": "^1.0.7", "use-interval": "^1.4.0" }, "devDependencies": { - "@biomejs/biome": "^2.6.7", - "@playwright/test": "^1.65.0", + "@biomejs/biome": "^2.6.9", + "@playwright/test": "^1.65.1", "@tailwindcss/postcss": "^4.3.5", "@types/jest": "^30.0.0", "@types/node": "^22.20.5", diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index 47ed937e..9962383a 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -6,8 +6,9 @@ settings: overrides: next>postcss: ^8.5.23 - glob@>=9.0.0 <14.0.2: ^14.0.2 - minimatch@>=7.0.0 <11.0.1: ^11.0.1 + glob@>=9.0.0 <14.0.6: ^14.0.6 + minimatch@>=7.0.0 <11.0.8: ^11.0.8 + ws@>=8.0.0 <8.23.0: ^8.23.0 importers: @@ -41,11 +42,11 @@ importers: specifier: ^2.1.1 version: 2.1.1 lucide-react: - specifier: ^1.72.0 - version: 1.72.0(@types/react@19.3.0)(react@19.3.1) + specifier: ^1.79.0 + version: 1.79.0(@types/react@19.3.0)(react@19.3.1) next: - specifier: 16.4.5 - version: 16.4.5(@babel/core@7.29.7)(@playwright/test@1.65.0)(@types/node@22.20.5)(react-dom@19.3.1(react@19.3.1))(react@19.3.1) + specifier: 16.4.6 + version: 16.4.6(@babel/core@7.29.7)(@playwright/test@1.65.1)(@types/node@22.20.5)(react-dom@19.3.1(react@19.3.1))(react@19.3.1) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.3.1(react@19.3.1))(react@19.3.1) @@ -59,11 +60,11 @@ importers: specifier: ^16.1.2 version: 16.1.2(react@19.3.1) recharts: - specifier: ^3.10.1 - version: 3.10.1(@types/react@19.3.0)(react-dom@19.3.1(react@19.3.1))(react-is@19.3.1)(react@19.3.1)(redux@5.0.1) + specifier: ^3.11.1 + version: 3.11.1(@types/react@19.3.0)(react-dom@19.3.1(react@19.3.1))(react-is@19.3.1)(react@19.3.1)(redux@5.0.1) tailwind-merge: - specifier: ^3.7.0 - version: 3.7.0 + specifier: ^3.7.1 + version: 3.7.1 tailwindcss-animate: specifier: ^1.0.7 version: 1.0.7(tailwindcss@4.3.5) @@ -72,11 +73,11 @@ importers: version: 1.4.0(react@19.3.1) devDependencies: '@biomejs/biome': - specifier: ^2.6.7 - version: 2.6.7 + specifier: ^2.6.9 + version: 2.6.9 '@playwright/test': - specifier: ^1.65.0 - version: 1.65.0 + specifier: ^1.65.1 + version: 1.65.1 '@tailwindcss/postcss': specifier: ^4.3.5 version: 4.3.5 @@ -292,71 +293,71 @@ packages: '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - '@biomejs/biome@2.6.7': - resolution: {integrity: sha512-2bT1FE6FvZZgPLFw4BjcDyRwG8Ry9zYla4X+Lw8oj2SxvqiXHiYkkEpjcrsWQrik6iYHygAa/D67YxLbVz9P1Q==} + '@biomejs/biome@2.6.9': + resolution: {integrity: sha512-RelCBDzTXu4DBU8c35P4iMrDO80SUjW0OgjDA7CT1z3UcCU5IclWTZ2XnMelI4frQL//xg2K2BQxAhcOKxdPQA==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-android-arm64@2.6.7': - resolution: {integrity: sha512-f4fyRTl+rW6QZp+iHdZrKAKptG/xmIDijTnxWhpC1Hnzr8yvjaBm/aJ98JiMv5mMx7jL1MOu4+zwmQUzfcoKBg==} + '@biomejs/cli-android-arm64@2.6.9': + resolution: {integrity: sha512-/3Aj5aiG+Iz8yDBJJb/GFDsptr9ONk3n1wZUIERuU+pVXMIslBaOnrTYJI5QVVXZ9jE494myQHiIvFrjQCBYeQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [android] - '@biomejs/cli-android-x64@2.6.7': - resolution: {integrity: sha512-eUdeN+mh2bwen+By1feKzpFkFGAfLG3Pxi6tbwpzMvePBwFGMd4mnE6gaxDRMiWJ1eMuc+Xhtg3ErbLLbtL5wQ==} + '@biomejs/cli-android-x64@2.6.9': + resolution: {integrity: sha512-erjbUpD9KJhzTsGHY9oStJ1bSiUJ1ikUXgdr0iOFoIAMiKqW+GdVdEqAlEyqiZA6CBiFqf2fV+g0AVl3hYOuYg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [android] - '@biomejs/cli-darwin-arm64@2.6.7': - resolution: {integrity: sha512-GewLcsnCsVblgnWYw5QRz5ydy9xphCtlFP37TpLKarezqwZMrH2qxrYblhY6DPOir4gnKyaqDnS/xZWIGVjaKw==} + '@biomejs/cli-darwin-arm64@2.6.9': + resolution: {integrity: sha512-fO67s0SF+lKGhNPQ7jUXiz0yXGl/1Qm3XTIn/4Hd2Z2z3ewQMrotWIMVdIPxZAgLJdQtRLBOzgsTRzTl981yWA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@2.6.7': - resolution: {integrity: sha512-AMPl+Q+bHjRcNUBn8gwBl+dJAnKRUWGZ7ZiJo2U8tQtdpqJ32OqvIg4cwTH+xv0jrcNVkUSE69nj57zsHZ1WBA==} + '@biomejs/cli-darwin-x64@2.6.9': + resolution: {integrity: sha512-RdjT3Z6dLlii0x6EroncTp9jg38FMx2R1aeaaU4BbZ4//3TJ2mA2R39KMIrZYxHdHXcfv9X2V5hwKkXhg08w/g==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@2.6.7': - resolution: {integrity: sha512-BIA7qVO1O15D2wVKxLTcvEWszgOqJVZRUhlksg1KQ9N0VtYCbvknV1vyjFiSrzuBT57+z59gbzhYQCinw9lRSQ==} + '@biomejs/cli-linux-arm64-musl@2.6.9': + resolution: {integrity: sha512-qoG0R5MhJ8VFozVFZQC42V3qCI1TInDhL/YcPPg0oTzfv3vuh0ZDXj+2nNahq8gboHUMv7MWpGjRDLhpQatJ+A==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: [musl] - '@biomejs/cli-linux-arm64@2.6.7': - resolution: {integrity: sha512-Qa2edxQClKn17y1ASWkOOuT96K2si1nTLiPbXMOMilNJ79eNsa1as1kaSbgxOXy1kRUENw76sp4pAddneq3l8Q==} + '@biomejs/cli-linux-arm64@2.6.9': + resolution: {integrity: sha512-x73OpQSuQLuvNfzXWEjf0mK95NxlJQX4eG/jmuSrGWOz+/jcLUE4N/21yBu3n0X+wa8bJ3NsWNvmNacLnyc2CQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: [glibc] - '@biomejs/cli-linux-x64-musl@2.6.7': - resolution: {integrity: sha512-+AOQyCsPR4nH5L4Hjzp8T0iaHm4UxY3unjL/KUJKc/8ziLnbkbmL3adtWmQW5ERB1zi6LRA1fsjaSuf/xGnLaQ==} + '@biomejs/cli-linux-x64-musl@2.6.9': + resolution: {integrity: sha512-o73Sk1hCbGOFOrDlxtpHGIubnLwMXscT32+ujMwUyq9o0f4onxO7OznzkFgcZGbwKy1R3ohroOkqZDXqj1u29g==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: [musl] - '@biomejs/cli-linux-x64@2.6.7': - resolution: {integrity: sha512-VpHQ33CPNYrlIn0vyDdRS1KUlS3AiM17FiyEE2gwU000NwzyY4MgjzVHEv2KrmMb5D9Ksm3gFkwg+IOx/ULJNQ==} + '@biomejs/cli-linux-x64@2.6.9': + resolution: {integrity: sha512-uVrqS0HDjRzFlx88ZpfmlZvJ+xIwTU+110vunzrYvZQ5OqXl/1ugMTNvAs61hejH7jh7iequKJwagRVarrYcSQ==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: [glibc] - '@biomejs/cli-win32-arm64@2.6.7': - resolution: {integrity: sha512-2nLivZfgcGMIXP/bI8w1FZP5JE2MetP+XZInyMQ7SvJBKlDoGrm/nRjN7uUi9dOaaSlpbRWkHSfb7PqcQR3nXg==} + '@biomejs/cli-win32-arm64@2.6.9': + resolution: {integrity: sha512-4yvNG4nQGJsJA/PTVAt8IBFXvY6hXk4UdjtPlTf4QTMIjH7ysOwBew78bKThkRv1eyRwH2mGLIk4lAZp8tfAdw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@2.6.7': - resolution: {integrity: sha512-uYfH+n+IAtVz3lh7m6JxdjxfJ3WCvAJDE3spHIUbU955V42oKymlhiQiu92fAhXZb7KOjvRcrfImySQbc1MFFg==} + '@biomejs/cli-win32-x64@2.6.9': + resolution: {integrity: sha512-mwarNc4GEg5JknsRaJDyJDFr4kICD7snsGM8yYFOoIHimSU1ekWNbcZ44QDa6/30fUZC9077wbBpXE8fp03aug==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -582,8 +583,8 @@ packages: cpu: [x64] os: [win32] - '@isaacs/nonrecursive-glob-match@1.0.3': - resolution: {integrity: sha512-SI7kyKHq4XXDRozw+r9GlRZkia1ZkFrpLW98r2IC2Bpr8YkFGE3fvjzmxCG0x78A++69HmDNrDvSMYBZmHGpKA==} + '@isaacs/nonrecursive-glob-match@1.1.0': + resolution: {integrity: sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==} '@istanbuljs/load-nyc-config@1.1.0': resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} @@ -712,57 +713,57 @@ packages: '@emnapi/core': ^1.7.1 || 2.0.0-beta.2 '@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2 - '@next/env@16.4.5': - resolution: {integrity: sha512-JwSPwpdkZL5VMl2jA/q+JI8MZdweAL3xmw5/tb9y/TLtmS0YXZnmYDzSihwk8xTj1OL+WM53gTqaj96yuLp6Xw==} + '@next/env@16.4.6': + resolution: {integrity: sha512-SunBjJ6t+oBtecS3dTjdVuMhUogP5wD/vrGL5EVuQYM1iS4O5ilL51HkiJ3sPjMzRHiCChvr4dbaSJbR7F3lxA==} - '@next/swc-darwin-arm64@16.4.5': - resolution: {integrity: sha512-W5TniBzWKASbNNwHZ/S/f1MxQUXU/LdjklVMWA0Ujbfl7SZnUzFls45hO0i/sF7Bx1jJBWp7WWmoQajXtX/O8A==} + '@next/swc-darwin-arm64@16.4.6': + resolution: {integrity: sha512-kJ4VVZkley17xKaJx72QN2IBqjrj7zenCQZaUF0l9ShS/1Mt2kW4+Z5KGG6vgr3L/J562xTOizVyM1iA/u5nlg==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@16.4.5': - resolution: {integrity: sha512-uWq4qkHapBDS1oFltWS4YxTb9pLHAtLNcpbuK6SmRsebLYZqpBML/j/C0op+50JYGTpZgVL/DWNt/6oWlamrrw==} + '@next/swc-darwin-x64@16.4.6': + resolution: {integrity: sha512-eIPGZIqC+8JKaeZmvnCANJQF4xWkkHqSnAAajtFxgwDMAOnCgxNvP52SeWZ41PyVwoe+Le/NQuZSaQ8j7YshSA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@16.4.5': - resolution: {integrity: sha512-FdRcyOx5u5P51mlAqLB9EXdd8jZO5fsdHtk4BAQSkqOywCsbTNN/rmw+jO7pnmjNdAtu2AG46NzbCL2FPDrrgw==} + '@next/swc-linux-arm64-gnu@16.4.6': + resolution: {integrity: sha512-9nI6O8vvczH2D9ZNdMGqb/3NuT15T9ksOZnAmx9/gjF2cOi74+xxyf1Hk96uIMfm14c9y6wHeBq6SH8g6udvcA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] libc: [glibc] - '@next/swc-linux-arm64-musl@16.4.5': - resolution: {integrity: sha512-cyvmmgtRXR8aGVT86wi9Py53IlfyCx7P2fZxuAXAoTummDnhKtUyjrMeXfapqp4qgD+gT5RqyGD/VfA16jEK7Q==} + '@next/swc-linux-arm64-musl@16.4.6': + resolution: {integrity: sha512-7/qPhTxDp2ScluOJOhLuhWmlA17o1yZ0SIgpISBCpBxXgtnK4+KGywBpFkfLPiU1rnSM1faFGzYkH6i7JdTrqA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] libc: [musl] - '@next/swc-linux-x64-gnu@16.4.5': - resolution: {integrity: sha512-hPc+Fl+N22DAvqZHq559NmamXboOX5Lu8I5Wl0DezfrhTk1Zz21NQeYoZDmNI/NjTcrdsVxM72Fzn2lI+Q+vAw==} + '@next/swc-linux-x64-gnu@16.4.6': + resolution: {integrity: sha512-oOpbNa8XOW1qCGd9VvzC4fbkkRxEls7/WI6tz+YHC0xRA7KpV1U7DrAnCPjzVyOk/karzWEepCOcTIDmwK8FwQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] libc: [glibc] - '@next/swc-linux-x64-musl@16.4.5': - resolution: {integrity: sha512-gbACYE8IP/jlprNTpiWXHb8N9CofOzpnEwH2SrIz1dUbiJf1FbDssDupCAPeP1Taxe8mgG20sGZamJI7KFOdZw==} + '@next/swc-linux-x64-musl@16.4.6': + resolution: {integrity: sha512-aM8CZ+OR2EwXaAYw7KGkW2GDmNDsLBIRe1MMRZCJPTdw/xhTD0IMUVO4sf3KqrzuRouGzwwLZn34+gFeVXiUQA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] libc: [musl] - '@next/swc-win32-arm64-msvc@16.4.5': - resolution: {integrity: sha512-+8gj++ZMo8H20Xh2ijjNqyFk5LPLw0AC4Fs4Tq/G94rjjQXhOjN4jgSWsWKPFsyY26hfIeemJIwKtMxOsp5GBA==} + '@next/swc-win32-arm64-msvc@16.4.6': + resolution: {integrity: sha512-U0p7/tEtqvHX2crhd841CDwKtp5CFkKXVjOhmfccR3Pvp64sj8KBwRqsvltqLOwVBbj0NtkxwXSDpEHYGbxeXQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@16.4.5': - resolution: {integrity: sha512-qNZj66pYXnaWLiF9R9GUbfBdrCv7kC6TaZfIwB2KH5WPc/8pEM3nVOj8hpQhWJU8S94rlH5MPDcX15+RrgUhiw==} + '@next/swc-win32-x64-msvc@16.4.6': + resolution: {integrity: sha512-3ZG15/5WIdlTQsIEvc9sPTTSL5XFrlLklIKmfF4fwsDnoAhu6NcBDXsk3mbGxNyo6aVLEGex+fHCv2MahY7a9g==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -853,8 +854,8 @@ packages: resolution: {integrity: sha512-SEeaJLb3qBNF/OaXnaR1NmmBbFYk1zC0ZH/52fATcRPLFg/p791YrcyFFy44Bo9sLaGuSuLp5Q6axbb/O+v/RA==} engines: {node: ^14.18.0 || >=16.0.0} - '@playwright/test@1.65.0': - resolution: {integrity: sha512-iGURLGuKDLakSEl7Pgfv8h7f+XLT+V861Wfhz0zlEl5nyFuKUopdkFBPKqTllTUp06aOwPuH8iuUEb3yp3MpbQ==} + '@playwright/test@1.65.1': + resolution: {integrity: sha512-y+NCIRm2LvY4slUVWvGh1nujJ8RF/hEisIsq2mtUPgdQC4L701bq5hZGMhrpeXjACvwvO9tj5dJqhvM6TP9lbw==} engines: {node: '>=20'} hasBin: true @@ -1938,8 +1939,8 @@ packages: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} - glob@14.0.3: - resolution: {integrity: sha512-A1vjIwC3qpdCso45Iw127gnp7sPhqgY8lUQhDrArIs+GbmfaaVPFuoyy7WyLT9EPZCRZ7j7aLdwUhQmHWesEow==} + glob@14.0.6: + resolution: {integrity: sha512-OwXjVP2svY5EyLY75Vek96C8qK43gqrt4xsZ+qSILdnaEiJPXkd62mcfUSNx/TQErQRdu5uM5kF67sfONragKw==} engines: {node: 18 || 20 || >=22} graceful-fs@4.2.11: @@ -2328,8 +2329,8 @@ packages: lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - lucide-react@1.72.0: - resolution: {integrity: sha512-fbF5i1GU8GODETa3Q7rXqrJrcx3iPYrQtxthom103zGx+Z0BGwKYAW9s+9435ohYJ7hQm0av0PoZcqI1CRwNrg==} + lucide-react@1.79.0: + resolution: {integrity: sha512-MDHKxzUobPRyQgt4hHO1z+pUQJKYMvenh8qw+ndWQE0Wg+Hbjli/ZrkZXBGmRBrMvvqDRjkmQj0Z5RbeL/ogNw==} peerDependencies: '@types/react': '*' react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 @@ -2354,9 +2355,9 @@ packages: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} - minimatch@11.0.3: - resolution: {integrity: sha512-iny/40PEGkNJQ5/Pv6z3nm6FbRAby32GeZRjCUJk2WnNDbgPSTcdI+DDvLqsgBdD4cD5sMtMheqPPnehCCa8Nw==} - engines: {node: 18 || 20 || >=22} + minimatch@11.0.9: + resolution: {integrity: sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==} + engines: {node: 20 || >=22} minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} @@ -2390,8 +2391,8 @@ packages: react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc - next@16.4.5: - resolution: {integrity: sha512-rmdfsWosjTUO+6R0S3KokoIk6Kj0sWDRTe86tZHdqaWH/oXq/udX3/4xb+YQi7aWbyEFoglDU54kaifLCdXbBw==} + next@16.4.6: + resolution: {integrity: sha512-QZJiYhaZLJMo2KpkQGQIwvmd79WVsAWeYIU554a8d7zArS3si/IRy3lBNV/rtYhE70oLwdLYhPAXLPx8HwcwtA==} engines: {node: '>=20.9.0'} hasBin: true peerDependencies: @@ -2493,13 +2494,13 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} - playwright-core@1.65.0: - resolution: {integrity: sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==} + playwright-core@1.65.1: + resolution: {integrity: sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==} engines: {node: '>=20'} hasBin: true - playwright@1.65.0: - resolution: {integrity: sha512-F3AMWcR44qMBt4kq+6Kb6mX7bjGXshktKFOPULd7reED6ZJWevjbNRqysP7q+AATE9kdPEZBibex1BYsvpVoeA==} + playwright@1.65.1: + resolution: {integrity: sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==} engines: {node: '>=20'} hasBin: true @@ -2588,13 +2589,17 @@ packages: resolution: {integrity: sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==} engines: {node: '>=0.10.0'} - recharts@3.10.1: - resolution: {integrity: sha512-QXFrvt6IVcw7eeZCoyXTwkIJAX3Dv1nyVhMicXJ47GsGDDpcN8z6o644DibE9XjpBTThtsomLKnTV6lc+cVFUA==} + recharts@3.11.1: + resolution: {integrity: sha512-3XYqpdvpOYRDbi6NUMUEStTRXLmSmw9GJ/cp3xGbACLt+0PEa5CnWfg5Wi4VN7YLtVA5/hJiIhNPoxntWaTY/g==} engines: {node: '>=18'} peerDependencies: + '@types/react': '*' react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-is: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + peerDependenciesMeta: + '@types/react': + optional: true redux-thunk@3.1.0: resolution: {integrity: sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==} @@ -2742,8 +2747,8 @@ packages: resolution: {integrity: sha512-eNRKgb3z66Yp3D2CixVujOUvXLFUTij/zVnV8KRyvFdQwpz7I5DS8UfRkTeLzb64u+dkzDSdelE24izu+zSSUg==} engines: {node: ^14.18.0 || >=16.0.0} - tailwind-merge@3.7.0: - resolution: {integrity: sha512-XPPUyAc+cvspz3lHTcR/QgPfW2A0lv/xQNIjX3HGhLR+Nq2lHaLq5MtTesHn8GUr3W3DguT2KT5x3NVgRtYwmA==} + tailwind-merge@3.7.1: + resolution: {integrity: sha512-v7y4BV4FUlO8exj/4M5UXKeoowDiuugVUg3tkMNIyOUCOHy5xp8+5aWQeXCtZ2491sUV1YPsVeM9EveZ6/xuZQ==} tailwindcss-animate@1.0.7: resolution: {integrity: sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==} @@ -2935,8 +2940,8 @@ packages: resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - ws@8.22.0: - resolution: {integrity: sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==} + ws@8.23.0: + resolution: {integrity: sha512-wCkmX8QMOrKjgO8HW2WyDbTSGeqkocxgDzS9iR79rEAexty6/2qzilx3Ag8Tqf9ykop3irLKle0MtVn5qjVnoQ==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 @@ -3180,47 +3185,47 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} - '@biomejs/biome@2.6.7': + '@biomejs/biome@2.6.9': optionalDependencies: - '@biomejs/cli-android-arm64': 2.6.7 - '@biomejs/cli-android-x64': 2.6.7 - '@biomejs/cli-darwin-arm64': 2.6.7 - '@biomejs/cli-darwin-x64': 2.6.7 - '@biomejs/cli-linux-arm64': 2.6.7 - '@biomejs/cli-linux-arm64-musl': 2.6.7 - '@biomejs/cli-linux-x64': 2.6.7 - '@biomejs/cli-linux-x64-musl': 2.6.7 - '@biomejs/cli-win32-arm64': 2.6.7 - '@biomejs/cli-win32-x64': 2.6.7 - - '@biomejs/cli-android-arm64@2.6.7': + '@biomejs/cli-android-arm64': 2.6.9 + '@biomejs/cli-android-x64': 2.6.9 + '@biomejs/cli-darwin-arm64': 2.6.9 + '@biomejs/cli-darwin-x64': 2.6.9 + '@biomejs/cli-linux-arm64': 2.6.9 + '@biomejs/cli-linux-arm64-musl': 2.6.9 + '@biomejs/cli-linux-x64': 2.6.9 + '@biomejs/cli-linux-x64-musl': 2.6.9 + '@biomejs/cli-win32-arm64': 2.6.9 + '@biomejs/cli-win32-x64': 2.6.9 + + '@biomejs/cli-android-arm64@2.6.9': optional: true - '@biomejs/cli-android-x64@2.6.7': + '@biomejs/cli-android-x64@2.6.9': optional: true - '@biomejs/cli-darwin-arm64@2.6.7': + '@biomejs/cli-darwin-arm64@2.6.9': optional: true - '@biomejs/cli-darwin-x64@2.6.7': + '@biomejs/cli-darwin-x64@2.6.9': optional: true - '@biomejs/cli-linux-arm64-musl@2.6.7': + '@biomejs/cli-linux-arm64-musl@2.6.9': optional: true - '@biomejs/cli-linux-arm64@2.6.7': + '@biomejs/cli-linux-arm64@2.6.9': optional: true - '@biomejs/cli-linux-x64-musl@2.6.7': + '@biomejs/cli-linux-x64-musl@2.6.9': optional: true - '@biomejs/cli-linux-x64@2.6.7': + '@biomejs/cli-linux-x64@2.6.9': optional: true - '@biomejs/cli-win32-arm64@2.6.7': + '@biomejs/cli-win32-arm64@2.6.9': optional: true - '@biomejs/cli-win32-x64@2.6.7': + '@biomejs/cli-win32-x64@2.6.9': optional: true '@cspotcode/source-map-support@0.8.1': @@ -3391,7 +3396,7 @@ snapshots: '@img/sharp-win32-x64@0.35.5': optional: true - '@isaacs/nonrecursive-glob-match@1.0.3': {} + '@isaacs/nonrecursive-glob-match@1.1.0': {} '@istanbuljs/load-nyc-config@1.1.0': dependencies: @@ -3516,7 +3521,7 @@ snapshots: chalk: 4.1.2 collect-v8-coverage: 1.0.3 exit-x: 0.2.2 - glob: 14.0.3 + glob: 14.0.6 graceful-fs: 4.2.11 istanbul-lib-coverage: 3.2.2 istanbul-lib-instrument: 6.0.3 @@ -3624,30 +3629,30 @@ snapshots: '@tybys/wasm-util': 0.10.4 optional: true - '@next/env@16.4.5': {} + '@next/env@16.4.6': {} - '@next/swc-darwin-arm64@16.4.5': + '@next/swc-darwin-arm64@16.4.6': optional: true - '@next/swc-darwin-x64@16.4.5': + '@next/swc-darwin-x64@16.4.6': optional: true - '@next/swc-linux-arm64-gnu@16.4.5': + '@next/swc-linux-arm64-gnu@16.4.6': optional: true - '@next/swc-linux-arm64-musl@16.4.5': + '@next/swc-linux-arm64-musl@16.4.6': optional: true - '@next/swc-linux-x64-gnu@16.4.5': + '@next/swc-linux-x64-gnu@16.4.6': optional: true - '@next/swc-linux-x64-musl@16.4.5': + '@next/swc-linux-x64-musl@16.4.6': optional: true - '@next/swc-win32-arm64-msvc@16.4.5': + '@next/swc-win32-arm64-msvc@16.4.6': optional: true - '@next/swc-win32-x64-msvc@16.4.5': + '@next/swc-win32-x64-msvc@16.4.6': optional: true '@parcel/watcher-android-arm64@2.6.0': @@ -3708,9 +3713,9 @@ snapshots: '@pkgr/core@0.3.6': {} - '@playwright/test@1.65.0': + '@playwright/test@1.65.1': dependencies: - playwright: 1.65.0 + playwright: 1.65.1 '@radix-ui/primitive@1.2.0': {} @@ -4682,9 +4687,9 @@ snapshots: get-stream@6.0.1: {} - glob@14.0.3: + glob@14.0.6: dependencies: - minimatch: 11.0.3 + minimatch: 11.0.9 minipass: 7.1.3 path-scurry: 3.0.0 @@ -4876,7 +4881,7 @@ snapshots: chalk: 4.1.2 ci-info: 4.4.0 deepmerge: 4.3.1 - glob: 14.0.3 + glob: 14.0.6 graceful-fs: 4.2.11 jest-circus: 30.5.2 jest-docblock: 30.5.0 @@ -5044,7 +5049,7 @@ snapshots: cjs-module-lexer: 2.3.0 collect-v8-coverage: 1.0.3 es-module-lexer: 2.3.2 - glob: 14.0.3 + glob: 14.0.6 graceful-fs: 4.2.11 jest-haste-map: 30.5.1 jest-message-util: 30.5.1 @@ -5163,7 +5168,7 @@ snapshots: whatwg-encoding: 3.1.1 whatwg-mimetype: 4.0.0 whatwg-url: 14.2.0 - ws: 8.22.0 + ws: 8.23.0 xml-name-validator: 5.0.0 transitivePeerDependencies: - bufferutil @@ -5248,7 +5253,7 @@ snapshots: dependencies: yallist: 3.1.1 - lucide-react@1.72.0(@types/react@19.3.0)(react@19.3.1): + lucide-react@1.79.0(@types/react@19.3.0)(react@19.3.1): dependencies: react: 19.3.1 optionalDependencies: @@ -5268,9 +5273,9 @@ snapshots: mimic-fn@2.1.0: {} - minimatch@11.0.3: + minimatch@11.0.9: dependencies: - '@isaacs/nonrecursive-glob-match': 1.0.3 + '@isaacs/nonrecursive-glob-match': 1.1.0 brace-expansion: 5.0.12 minimist@1.2.8: {} @@ -5292,9 +5297,9 @@ snapshots: react: 19.3.1 react-dom: 19.3.1(react@19.3.1) - next@16.4.5(@babel/core@7.29.7)(@playwright/test@1.65.0)(@types/node@22.20.5)(react-dom@19.3.1(react@19.3.1))(react@19.3.1): + next@16.4.6(@babel/core@7.29.7)(@playwright/test@1.65.1)(@types/node@22.20.5)(react-dom@19.3.1(react@19.3.1))(react@19.3.1): dependencies: - '@next/env': 16.4.5 + '@next/env': 16.4.6 '@swc/helpers': 0.5.23 baseline-browser-mapping: 2.11.34 caniuse-lite: 1.0.30001820 @@ -5303,15 +5308,15 @@ snapshots: react-dom: 19.3.1(react@19.3.1) styled-jsx: 5.1.6(@babel/core@7.29.7)(react@19.3.1) optionalDependencies: - '@next/swc-darwin-arm64': 16.4.5 - '@next/swc-darwin-x64': 16.4.5 - '@next/swc-linux-arm64-gnu': 16.4.5 - '@next/swc-linux-arm64-musl': 16.4.5 - '@next/swc-linux-x64-gnu': 16.4.5 - '@next/swc-linux-x64-musl': 16.4.5 - '@next/swc-win32-arm64-msvc': 16.4.5 - '@next/swc-win32-x64-msvc': 16.4.5 - '@playwright/test': 1.65.0 + '@next/swc-darwin-arm64': 16.4.6 + '@next/swc-darwin-x64': 16.4.6 + '@next/swc-linux-arm64-gnu': 16.4.6 + '@next/swc-linux-arm64-musl': 16.4.6 + '@next/swc-linux-x64-gnu': 16.4.6 + '@next/swc-linux-x64-musl': 16.4.6 + '@next/swc-win32-arm64-msvc': 16.4.6 + '@next/swc-win32-x64-msvc': 16.4.6 + '@playwright/test': 1.65.1 sharp: 0.35.5(@types/node@22.20.5) transitivePeerDependencies: - '@babel/core' @@ -5392,11 +5397,11 @@ snapshots: dependencies: find-up: 4.1.0 - playwright-core@1.65.0: {} + playwright-core@1.65.1: {} - playwright@1.65.0: + playwright@1.65.1: dependencies: - playwright-core: 1.65.0 + playwright-core: 1.65.1 postcss@8.5.32: dependencies: @@ -5476,7 +5481,7 @@ snapshots: react@19.3.1: {} - recharts@3.10.1(@types/react@19.3.0)(react-dom@19.3.1(react@19.3.1))(react-is@19.3.1)(react@19.3.1)(redux@5.0.1): + recharts@3.11.1(@types/react@19.3.0)(react-dom@19.3.1(react@19.3.1))(react-is@19.3.1)(react@19.3.1)(redux@5.0.1): dependencies: '@reduxjs/toolkit': 2.13.0(react-redux@9.3.1(@types/react@19.3.0)(react@19.3.1)(redux@5.0.1))(react@19.3.1) clsx: 2.1.1 @@ -5492,8 +5497,9 @@ snapshots: tiny-invariant: 1.3.3 use-sync-external-store: 1.7.0(react@19.3.1) victory-vendor: 37.4.1 + optionalDependencies: + '@types/react': 19.3.0 transitivePeerDependencies: - - '@types/react' - redux redux-thunk@3.1.0(redux@5.0.1): @@ -5632,7 +5638,7 @@ snapshots: dependencies: '@pkgr/core': 0.3.6 - tailwind-merge@3.7.0: {} + tailwind-merge@3.7.1: {} tailwindcss-animate@1.0.7(tailwindcss@4.3.5): dependencies: @@ -5645,8 +5651,8 @@ snapshots: test-exclude@7.0.2: dependencies: '@istanbuljs/schema': 0.1.6 - glob: 14.0.3 - minimatch: 11.0.3 + glob: 14.0.6 + minimatch: 11.0.9 tiny-invariant@1.3.3: {} @@ -5832,7 +5838,7 @@ snapshots: imurmurhash: 0.1.4 signal-exit: 4.1.0 - ws@8.22.0: {} + ws@8.23.0: {} xml-name-validator@5.0.0: {} diff --git a/docs/pnpm-workspace.yaml b/docs/pnpm-workspace.yaml index f44fc451..c8c2a019 100644 --- a/docs/pnpm-workspace.yaml +++ b/docs/pnpm-workspace.yaml @@ -7,10 +7,15 @@ overrides: # Next 15.5 pins postcss 8.4.31, which has open advisories; Next 16 moved to 8.5 'next>postcss': ^8.5.23 # Jest 30 still asks for glob 10 and its minimatch, which have open advisories - 'glob@>=9.0.0 <14.0.2': ^14.0.2 - 'minimatch@>=7.0.0 <11.0.1': ^11.0.1 + 'glob@>=9.0.0 <14.0.6': ^14.0.6 + 'minimatch@>=7.0.0 <11.0.8': ^11.0.8 + # jsdom asks for ws ^8.18, and versions before 8.23 answer every ping, so a peer can exhaust memory + 'ws@>=8.0.0 <8.23.0': ^8.23.0 auditConfig: ignoreGhsas: # deepmerge has no patched version. Only jest-config uses it here, on Jest's own config in development - GHSA-gcqx-w48m-w2h4 + # cross-spawn's command injection happens only on Windows, spawning batch files. Only jest-changed-files uses it + # here, and the tests run on macOS and Linux + - GHSA-ghv9-86vm-4v8m diff --git a/package.json b/package.json index e6ca9104..c35952e5 100644 --- a/package.json +++ b/package.json @@ -23,14 +23,14 @@ "homepage": "https://github.com/docspring/logstruct#readme", "devDependencies": { "@docspring/cspell-lockfile-dicts": "^1.2.0", - "cspell": "^10.4.1", - "jscpd": "^5.4.2", - "prettier": "^3.9.10" + "cspell": "^10.5.2", + "jscpd": "^5.4.3", + "prettier": "^3.10.1" }, "pnpm": { "overrides": { - "glob@>=9.0.0 <14.0.2": "^14.0.2", - "minimatch@>=7.0.0 <11.0.1": "^11.0.1" + "glob@>=9.0.0 <14.0.6": "^14.0.6", + "minimatch@>=7.0.0 <11.0.8": "^11.0.8" } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fcb085e..694b31f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,8 +5,8 @@ settings: excludeLinksFromLockfile: false overrides: - glob@>=9.0.0 <14.0.2: ^14.0.2 - minimatch@>=7.0.0 <11.0.1: ^11.0.1 + glob@>=9.0.0 <14.0.6: ^14.0.6 + minimatch@>=7.0.0 <11.0.8: ^11.0.8 importers: @@ -16,51 +16,51 @@ importers: specifier: ^1.2.0 version: 1.2.0 cspell: - specifier: ^10.4.1 - version: 10.4.1 + specifier: ^10.5.2 + version: 10.5.2 jscpd: - specifier: ^5.4.2 - version: 5.4.2 + specifier: ^5.4.3 + version: 5.4.3 prettier: - specifier: ^3.9.10 - version: 3.9.10 + specifier: ^3.10.1 + version: 3.10.1 packages: - '@cspell/cspell-bundled-dicts@10.4.1': - resolution: {integrity: sha512-QkDsQSUa6qK/2/AF43YYTrN1rpsJN3Yn1ckA3qH9zmBn0N/tkCWaJ675wo8j1CguPjZdPBF1t4J5tLcjiQv/Dg==} + '@cspell/cspell-bundled-dicts@10.5.2': + resolution: {integrity: sha512-1EVGMy+/Ayjpu2r4i4x3K44kWoVbrdramIR+cX75fo5bDMgb1MXf7vIEfFKETY1h4eczd40SxM46twxrCxTwRw==} engines: {node: '>=22.18.0'} - '@cspell/cspell-json-reporter@10.4.1': - resolution: {integrity: sha512-PV0fshBdl78839JMs0H8rpq6766TTdZQPdT+tiZ1+atarso+gZLxM4DXMqePdCBbhgV46jbW91DoN4KZIYUysA==} + '@cspell/cspell-json-reporter@10.5.2': + resolution: {integrity: sha512-ecpINoJ0qa1qP/PywhvcKQ2mA0fwhljSPvUn7+lw87dp4Ixa1qi7+re4SDGSqRr29FlJcKZRPfcRdK9iJPzbFA==} engines: {node: '>=22.18.0'} - '@cspell/cspell-performance-monitor@10.4.1': - resolution: {integrity: sha512-hVYcJ3i8vnuo+8lK+awOsuYHIA2rlFS/DIW/ZIjKmCcVjgdNTVAWtx/EQs3mqGZGegJTOPaSv1uGvLpLgtLTHw==} + '@cspell/cspell-performance-monitor@10.5.2': + resolution: {integrity: sha512-wQVHhjMd5BCum9oeBmncdu2h3i9FcWLbrKAInQafgAb0ASOLRJiaGMeH3HkjOIWgHXmoJYlrfw/MjWj3iLJp9g==} engines: {node: '>=22.18.0'} - '@cspell/cspell-pipe@10.4.1': - resolution: {integrity: sha512-7P4srvEo/LUyoGTwwsnijCZzUKTyC39N9seYyk7/u4DHmww4cQpKW3ktWdZu90hOP1hV+zdAptUMnHTHxa5NmQ==} + '@cspell/cspell-pipe@10.5.2': + resolution: {integrity: sha512-iwPHCMtFsIskUFijqTmaypLCRkazjjJViolJRreZycWMz+ts6JaY3iE8jtWbLZ8nTMp5nyIca6H4AdYoxuftjA==} engines: {node: '>=22.18.0'} - '@cspell/cspell-resolver@10.4.1': - resolution: {integrity: sha512-7aKxe59PqwVHUIQQJaN//RiiooCudG4sU+ycKUUUcEKN04vxQuo582Desa1WQQsKMH4VjCLZF1XD5lCmnpS0rw==} + '@cspell/cspell-resolver@10.5.2': + resolution: {integrity: sha512-Ia/4+nNqQFECHZo+sSrnO+Ogzom+0FrCUErWEfV660HT8DWX90sR97v6sQsDy9Rc2nI+7lt7Q9vWEk7uhHuV3g==} engines: {node: '>=22.18.0'} - '@cspell/cspell-service-bus@10.4.1': - resolution: {integrity: sha512-sC7dR3kfGIugcAjVjIfKKfI1T/r+2E1ps9a7aXqAJRmfLZAKXbnKGO5aeVGHKmtxGw/odZEDDOis2uwq2tdUfQ==} + '@cspell/cspell-service-bus@10.5.2': + resolution: {integrity: sha512-SRJU7/dk0wGDaEp4v5VRG7WAxk8nueTIVqzC2uR2YjFSqYvOyGrvE0u2TDyD8j1H4dfam4WLcmCD7yCjl2hSuQ==} engines: {node: '>=22.18.0'} - '@cspell/cspell-types@10.4.1': - resolution: {integrity: sha512-FfaRrnrZ3xD09Tq6C49BdAZSx+tLM38Z60vFR/1+qQMQejUOHhv/lQ3UNN4I9z+P3BhmKutcLf8M8IOwlMfOtQ==} + '@cspell/cspell-types@10.5.2': + resolution: {integrity: sha512-vSxzSbGny4eCCWImCEzU2OhxUrNMOkl05KCDVBwkDKEb9JHIzGOeUddoRtgPA6O7e74VOIbzFwedGkJfoiLLxQ==} engines: {node: '>=22.18.0'} '@cspell/cspell-types@8.19.4': resolution: {integrity: sha512-ekMWuNlFiVGfsKhfj4nmc8JCA+1ZltwJgxiKgDuwYtR09ie340RfXFF6YRd2VTW5zN7l4F1PfaAaPklVz6utSg==} engines: {node: '>=18'} - '@cspell/cspell-worker@10.4.1': - resolution: {integrity: sha512-H6+jTNdXsb5NYRG0g29axVVVS3VHvtXCeggD3p0tRVnBF/SBJZVdsHkQJPFSSAjgMNXPq8S1zhEJzmQECG9G6A==} + '@cspell/cspell-worker@10.5.2': + resolution: {integrity: sha512-xO8MyZ4We5eGe5pfDJBrMUd7fU0j4HRUbtemnBE1Sc5ax2Ze/ucz5RZtOYRsRiY2gmZjDIWfc065HuMQx2r45g==} engines: {node: '>=22.18.0'} '@cspell/dict-ada@4.1.1': @@ -245,24 +245,24 @@ packages: '@cspell/dict-zig@1.0.0': resolution: {integrity: sha512-XibBIxBlVosU06+M6uHWkFeT0/pW5WajDRYdXG2CgHnq85b0TI/Ks0FuBJykmsgi2CAD3Qtx8UHFEtl/DSFnAQ==} - '@cspell/dynamic-import@10.4.1': - resolution: {integrity: sha512-0TlwRH0VHL3atb2QC7l8PK0CRGNmVqRPCqL84rqWlEHrh1bOqvK+2EvMRnf9nSSx5IdS2rXZYibrSfcEY0cUqQ==} + '@cspell/dynamic-import@10.5.2': + resolution: {integrity: sha512-sXOxhv+NoLW9k9YPvsNULjugSkIt2/EPnBnuKLDFrdyG5F0MNcgIM3Y6j/u3OGbRNOD+2OIF+Exh/Lh4E4YVEA==} engines: {node: '>=22.18.0'} - '@cspell/filetypes@10.4.1': - resolution: {integrity: sha512-ztHYeAA/cKAJdX90xjVY+RjJN9im2POkY2wAztDQjOUtP+8qztWHtdk5mOBcRXv7Q93ivBY9N0ZmctakE3+A7Q==} + '@cspell/filetypes@10.5.2': + resolution: {integrity: sha512-AVkl2lf0jobYxXWqxRDAmR73hmAeyEIV8DfdW7xeheC5vZ9SrbzgWhtk3AMtPLCuDGkCEoNvi4ahcDsu3IwQ4A==} engines: {node: '>=22.18.0'} - '@cspell/rpc@10.4.1': - resolution: {integrity: sha512-rkNS7F1q+aofcex3lun2YzxMybx2pUXgVB1mFRC7LOQhrFOqs85FYg0Absc2sKr2QmedckgWj3Du91ZJn0eChA==} + '@cspell/rpc@10.5.2': + resolution: {integrity: sha512-4EBIBqUlaRE8NuwA8MmUR2HsqjlX3anRFiy7Sr+gNwso/njPnqKr6EeTxFapGZOR+ShrwN3dL8En7ROJtyD/kg==} engines: {node: '>=22.18.0'} - '@cspell/strong-weak-map@10.4.1': - resolution: {integrity: sha512-Bap/Gs0/G4NE6KQtT+dNvyGBC2iHws+5il/nvFUuZ1D5dLEK/SYeOuLCX/hdCvcPEF02kr8NxJfY7oK/w8YFiQ==} + '@cspell/strong-weak-map@10.5.2': + resolution: {integrity: sha512-8+uJw+DZnN84/Cd1urbb5ETp+2LDX71Xa+gjyrgZne74VRy02oXIC1etk+GwQMpjOe+iE6TQC/hfw/DIlsQ9sg==} engines: {node: '>=22.18.0'} - '@cspell/url@10.4.1': - resolution: {integrity: sha512-QoFi7+fMsBMz9l1wULNcVfyih2DarTv9Z+QKkQGuC/a1Xq70Veoh/JRtczDoOXCAsgutX12VHlHtu9nPRhahoQ==} + '@cspell/url@10.5.2': + resolution: {integrity: sha512-Uu02E4n52vivBApl8kLh16+9F6VMNIZheU3G44yg7yZoXyh1R7qtwvyTWtvBfuV091ENSh85EirI4ws4kmJudg==} engines: {node: '>=22.18.0'} '@docspring/cspell-lockfile-dicts@1.2.0': @@ -270,15 +270,15 @@ packages: engines: {node: '>=14.0.0'} hasBin: true - '@isaacs/nonrecursive-glob-match@1.0.3': - resolution: {integrity: sha512-SI7kyKHq4XXDRozw+r9GlRZkia1ZkFrpLW98r2IC2Bpr8YkFGE3fvjzmxCG0x78A++69HmDNrDvSMYBZmHGpKA==} + '@isaacs/nonrecursive-glob-match@1.1.0': + resolution: {integrity: sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==} '@streetsidesoftware/unindent@1.0.1': resolution: {integrity: sha512-ZXfg7MT3AT9ZOq/hgzbqNc01zVPG+PFkr+kbB2OHlMcNrtvK10ZPkNgy38MqTErjNeajh4VG1sSSv5zIyjOXxg==} engines: {node: '>=22.18.0'} - ansi-regex@6.5.0: - resolution: {integrity: sha512-zhvbbbdt1kbw7EJ9OQoxmQcuaNR9P5kTj7e/YdmOSU10aHWbycofJxA6jKfoEy3vlLdctOF9ZHaxLtmSm998wQ==} + ansi-regex@6.6.0: + resolution: {integrity: sha512-XZ5apbzreCbXSKwPjJstu8R0zOi247w3XYwWxtwBXgpZrCyc1Ka7p9/xY0A9/diMewmHbEKz+FIraWaEWjlN5g==} engines: {node: '>=12'} array-timsort@1.0.3: @@ -308,52 +308,52 @@ packages: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} engines: {node: '>=14'} - commander@15.0.0: - resolution: {integrity: sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==} + commander@15.1.0: + resolution: {integrity: sha512-cgnQ88TRrWcC7pVq46RzJVRMktu3W2RcbnoidnfBsl1bmDCBwJS/udcIZpKoCrbAYYaCqsz1yZCVIgbIaU3ddQ==} engines: {node: '>=22.12.0'} comment-json@5.0.0: resolution: {integrity: sha512-uiqLcOiVDJtBP8WGkZHEP+FZIhTzP1dxvn59EfoYUi9gqupjrBWVQkO2atDrbnKPwLeotFYDsuNb26uBMqB+hw==} engines: {node: '>= 6'} - cspell-config-lib@10.4.1: - resolution: {integrity: sha512-g6XYIdwwIlvakGsIaBtddakSXe35DIwREDptBxLhf0rcIdMv0n4Ii9BluaX+RgzMzRavkBlLS19quNLl80g+LA==} + cspell-config-lib@10.5.2: + resolution: {integrity: sha512-FJyqkD3eMGjxGSEiXW5V2ayCI/1su/9OHEKBNPq7YvkIb1HXVe27w1up/CXjE8fNSPet9YRz1xTeS6NcRY6mCA==} engines: {node: '>=22.18.0'} - cspell-dictionary@10.4.1: - resolution: {integrity: sha512-o9aIAsY0R+MMBbhFEF7aP77NaNETdp1YbZTRN0Xt4JsXQzjX9CMSXOm7WepRVk4Cf9DSSBdyhOYVbECu+2T0wg==} + cspell-dictionary@10.5.2: + resolution: {integrity: sha512-mmnvKDVZdbusX6P+wGY+HMiZGvpLbz/kJfWTXsWtWWhEHqoB22cqGXigWaS0lHtYJyoNXJ+SkqO/wvRXfL8C7Q==} engines: {node: '>=22.18.0'} - cspell-gitignore@10.4.1: - resolution: {integrity: sha512-YGX9WrxBOma0zNbR8RrVQWmtVJzHMy71ouljbJ/iC8HHTFwaVUlKEFMzvpSYLTAMSMVpa1Cc+9HpUjCcxiyOaA==} + cspell-gitignore@10.5.2: + resolution: {integrity: sha512-O+2jqfFwIxJ4MY26eE6JpR7Hz4bRegOdlTeclCm/4Q/8Oi+ajnsnruCDXI/Kt4oM/3gCPEY4ZB6HhcFKUaWPHQ==} engines: {node: '>=22.18.0'} hasBin: true - cspell-glob@10.4.1: - resolution: {integrity: sha512-bgLVOtD1sDSE0NxTXva6A9HSoxPhet4y709czloJ2bEDb0FNLl+kKJl2hEX0GtMztaNuLWK8nmb9y4RiJbON1Q==} + cspell-glob@10.5.2: + resolution: {integrity: sha512-dxzd26V9ppHk1NYImqMwF8hZ5bxyLCaLX+35uxua2QUWXTsg0YAMdmLD2A0XKr9manfryBaeVp0RltKsqCGCHw==} engines: {node: '>=22.18.0'} - cspell-grammar@10.4.1: - resolution: {integrity: sha512-LqXg57TQp/7UPH2XJC6WZTfTLvV0iP+8Ox0Gkyo0tFr+ijBWBB2KnPGEX1udtzZqaRpGokT2xi5rB3zO/lAxgg==} + cspell-grammar@10.5.2: + resolution: {integrity: sha512-wvNktzzcF/yz3WzyaD1cM7QRkSUO01fqWp/XsAakwVtY46v3VA/Ifob6Nbq0RYPyxXMTMK6v7btm2Fx5nfXtHQ==} engines: {node: '>=22.18.0'} hasBin: true - cspell-io@10.4.1: - resolution: {integrity: sha512-4AtNoBOFDHKDul2teL+PsmvZlIM+U1uWxFVGmzCtP4xVENKm1WlgwOoSSsQVvZDBlMRLjkWbsHJAKIR3f97wfg==} + cspell-io@10.5.2: + resolution: {integrity: sha512-VhNKpbHHGxkDF7O4NWZni/e6HfNzSDsd+VKtJKs5qEmX5NBFcfLwc2/I5N7AxQPTU+vBlSx0LPNoCGWQxAgrnA==} engines: {node: '>=22.18.0'} - cspell-lib@10.4.1: - resolution: {integrity: sha512-mX9UfN3hpcfdbqLWYIzLiJ81W2dhcgJfBDo3H1YAPK+yXZobSxtHeyQQBBapJ6Ca84U2R6AWNjuSjCneeISogg==} + cspell-lib@10.5.2: + resolution: {integrity: sha512-D9WeCDj+ZmHz2Hu+H/Gc6C7PYhsVchJvIXTA8X/sOrG+kvXnsYF6eGcOJV1HGhVGxJpJ3CzFcTWqXUixYdh1ow==} engines: {node: '>=22.18.0'} - cspell-trie-lib@10.4.1: - resolution: {integrity: sha512-MOxZ3b2MLNfRWXz1Seh6xXGvUclMxA9h11tCBj6+Y0pd+7KtNk7YMlzmHIGOnbF9W5YZNtA2bMuYbVlefcOa1w==} + cspell-trie-lib@10.5.2: + resolution: {integrity: sha512-cyvmveYXmKxkBVGVO/HzITnuKBqgR1fpFZXqYIRUoz5F8VbVFO0jKOVsFma+cFytWv2e2bQgcRyn3WX8kHNeRw==} engines: {node: '>=22.18.0'} peerDependencies: - '@cspell/cspell-types': 10.4.1 + '@cspell/cspell-types': 10.5.2 - cspell@10.4.1: - resolution: {integrity: sha512-/6r9R7Pv78VFuD4uKogu2g6SG+Lms78sLBesgEPR8YJ/VEbEYAz6cbXv86m3FMlqWJdccvnG6WiPNt2Ce8SZAw==} + cspell@10.5.2: + resolution: {integrity: sha512-PUfaJuF58PNok13Xo3aoCrIOCCEcLzV4W0pUK630taMmnbl8OzRths6ya9ooZ6gmJF8Y0zaAZt5IV+Dx27GHlA==} engines: {node: '>=22.18.0'} hasBin: true @@ -386,8 +386,8 @@ packages: resolution: {integrity: sha512-omMVniXEXpdx/vKxGnPRoO2394Otlze28TyxECbFVyoSpZ9H3EO7lemjcB12OpQJzRW4e5tt/dL1rOxry6aMHg==} engines: {node: '>=20'} - glob@14.0.3: - resolution: {integrity: sha512-A1vjIwC3qpdCso45Iw127gnp7sPhqgY8lUQhDrArIs+GbmfaaVPFuoyy7WyLT9EPZCRZ7j7aLdwUhQmHWesEow==} + glob@14.0.6: + resolution: {integrity: sha512-OwXjVP2svY5EyLY75Vek96C8qK43gqrt4xsZ+qSILdnaEiJPXkd62mcfUSNx/TQErQRdu5uM5kF67sfONragKw==} engines: {node: 18 || 20 || >=22} global-directory@5.0.0: @@ -409,52 +409,52 @@ packages: resolution: {integrity: sha512-4SrR7AdnY11LHfDKTZY1u6Ga3RuxZdl3YKWWShO5iyuG5h8QS4GD2tOb04peBJ5I7pXbR+CGBNEhTcwK+FzN3g==} engines: {node: '>=20'} - jscpd-darwin-arm64@5.4.2: - resolution: {integrity: sha512-EGoPYQZqESW2kJfxKZrUYsYWhzq2Irk6sBQQWZ7VPAGj2wwk3n8HtDP2FnJOiHWZtSz55I8zQWldzIrD55B5Vw==} + jscpd-darwin-arm64@5.4.3: + resolution: {integrity: sha512-2Zu6FrML6exhznj4hryUrnfVRM6dmfH0N7nldeY09cs7fA2TRQD+xzo5wA7SIqzhRDaUo0CBPBNVJz/XFmUEbg==} cpu: [arm64] os: [darwin] - jscpd-darwin-x64@5.4.2: - resolution: {integrity: sha512-/bz/rgoahqeK0p5r+KjeTTS59d7bZpMxD7hQ4CaQ0qKZWBZIyu7hRdExzJ7/KrCEJ5cmRogvXX1jhFqldYLNXw==} + jscpd-darwin-x64@5.4.3: + resolution: {integrity: sha512-Y4KykQqxMtVEV3pdjtfYbzONCmLOEgAyX8d2fUbwLW+uH/IZqUVCIwB3LrgCVv4Y+b/7mbOsdrGuIragTGpC/Q==} cpu: [x64] os: [darwin] - jscpd-linux-arm64-gnu@5.4.2: - resolution: {integrity: sha512-YW/eX+mOYZmT/A3QEARYmJQoVQNV/cfecKCobNXZcD3mE57drpKHmJnvuL9uS85z0cUKWGCM57JVkVz6Y9oxxw==} + jscpd-linux-arm64-gnu@5.4.3: + resolution: {integrity: sha512-08d2DKt9BELglfZj0ZfhEs7I4gxiAk9Iflgjnsd0z4pB1OjWA4+DGDbfWmGOf6W2sVMDpwkVoa5Q5DWaOMPyoA==} cpu: [arm64] os: [linux] libc: [glibc] - jscpd-linux-arm64-musl@5.4.2: - resolution: {integrity: sha512-jOLTO8YVRz65NaeYNeXoIf13yOPWhbM61xKXpv51DXQ2BXce6XfgPaJVeDCOM5s+8mt6aDtq0BZ8zptNeqGuIw==} + jscpd-linux-arm64-musl@5.4.3: + resolution: {integrity: sha512-YbgJ7tQzztL441UCKX6UVN6n8zXc7eEwuJ4MHCdFtTf5w6EGpfFDi7+lgBi+MtwampG2k1PoltCYYiRZyPg4/g==} cpu: [arm64] os: [linux] libc: [musl] - jscpd-linux-x64-gnu@5.4.2: - resolution: {integrity: sha512-eAmKLxx+pIOEX4lZ342CCCjL5bvf+a3gdmaaVHXiGIx2Zr3zKkF32YkfuN2sCvCui5I/wnely80XsRvVVFO47Q==} + jscpd-linux-x64-gnu@5.4.3: + resolution: {integrity: sha512-BbL0HypadbjpxNfK/KY4CfpD4sCd2zf9HpFnGwwOjdryjdTG098isft/95BiS/XvZjVT3p6lwLf5ToI97OoqCg==} cpu: [x64] os: [linux] libc: [glibc] - jscpd-linux-x64-musl@5.4.2: - resolution: {integrity: sha512-ers9YFscD6DrmhyjBDXo/L+yBKcclHdWTFLMulYVGLcoGRKfBFhmK08MI3ajN/GMmCpJu7rkDYKL3egdfE8OIw==} + jscpd-linux-x64-musl@5.4.3: + resolution: {integrity: sha512-0DlkzVDuuZ83JRZMOc4Fd2tBFKIrtXDHkHvxdF6d4HK+b954PZxuKhwBMArg76CtVSOQcuiICd/zxU9HtdT+mg==} cpu: [x64] os: [linux] libc: [musl] - jscpd-windows-arm64-msvc@5.4.2: - resolution: {integrity: sha512-kOhVw4cVhN8T9jr3OVThB3pPpbff0ITHTwpJ/+4EGzMkbf0y6QtPpHDzRgiHJj7u1FSTBXTI6VhPhDUhT/os1g==} + jscpd-windows-arm64-msvc@5.4.3: + resolution: {integrity: sha512-BUD8kCzLyXUomw3vWRDbaBcIPByX6yU3VyqsKSf7/sjzr8y9ZmTRcn0cwmCV2WChrzD5JF4HeQl+hZlb7+s8lg==} cpu: [arm64] os: [win32] - jscpd-windows-x64-msvc@5.4.2: - resolution: {integrity: sha512-BuR5DCV7F/G5ukMEIzCrz43ea5C0t0ALcP7v+opOWefoi4aiQYCEmtoRwfXMM/zjOmNYmvJBDDfeH05U9uuzEg==} + jscpd-windows-x64-msvc@5.4.3: + resolution: {integrity: sha512-qYSVGZE2WP0NNdZU1S8DsfcCDpjwKSExvsUd86c4Vx9eWwZdw1i+V7h/9FWazo3PxEa+FzPLsCD5YjVawaarRA==} cpu: [x64] os: [win32] - jscpd@5.4.2: - resolution: {integrity: sha512-bxZ1ObA4NyWBcM7Zh+QoGrdcMovbCxrDofFaLo2Lwgk/Axe/e45VYu8EM+mpPx2CpU/QGCoktONRnaRZl8Yq2w==} + jscpd@5.4.3: + resolution: {integrity: sha512-2Ult/j407sgAx4Z8kW4nOB3wfGwvtyKyPN9XE+tbvNEP/QemBN8pijKtG6zC+8nfMuIiiWjNcez7VZo5ZjJRtA==} engines: {node: '>=18'} hasBin: true @@ -462,9 +462,9 @@ packages: resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==} engines: {node: 20 || >=22} - minimatch@11.0.3: - resolution: {integrity: sha512-iny/40PEGkNJQ5/Pv6z3nm6FbRAby32GeZRjCUJk2WnNDbgPSTcdI+DDvLqsgBdD4cD5sMtMheqPPnehCCa8Nw==} - engines: {node: 18 || 20 || >=22} + minimatch@11.0.9: + resolution: {integrity: sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==} + engines: {node: 20 || >=22} minipass@7.1.3: resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} @@ -478,8 +478,8 @@ packages: resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} engines: {node: '>=12'} - prettier@3.9.10: - resolution: {integrity: sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==} + prettier@3.10.1: + resolution: {integrity: sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==} engines: {node: '>=14'} hasBin: true @@ -517,7 +517,7 @@ packages: snapshots: - '@cspell/cspell-bundled-dicts@10.4.1': + '@cspell/cspell-bundled-dicts@10.5.2': dependencies: '@cspell/dict-ada': 4.1.1 '@cspell/dict-al': 1.1.1 @@ -579,27 +579,27 @@ snapshots: '@cspell/dict-vue': 3.0.5 '@cspell/dict-zig': 1.0.0 - '@cspell/cspell-json-reporter@10.4.1': + '@cspell/cspell-json-reporter@10.5.2': dependencies: - '@cspell/cspell-types': 10.4.1 + '@cspell/cspell-types': 10.5.2 - '@cspell/cspell-performance-monitor@10.4.1': {} + '@cspell/cspell-performance-monitor@10.5.2': {} - '@cspell/cspell-pipe@10.4.1': {} + '@cspell/cspell-pipe@10.5.2': {} - '@cspell/cspell-resolver@10.4.1': + '@cspell/cspell-resolver@10.5.2': dependencies: global-directory: 5.0.0 - '@cspell/cspell-service-bus@10.4.1': {} + '@cspell/cspell-service-bus@10.5.2': {} - '@cspell/cspell-types@10.4.1': {} + '@cspell/cspell-types@10.5.2': {} '@cspell/cspell-types@8.19.4': {} - '@cspell/cspell-worker@10.4.1': + '@cspell/cspell-worker@10.5.2': dependencies: - cspell-lib: 10.4.1 + cspell-lib: 10.5.2 '@cspell/dict-ada@4.1.1': {} @@ -728,31 +728,31 @@ snapshots: '@cspell/dict-zig@1.0.0': {} - '@cspell/dynamic-import@10.4.1': + '@cspell/dynamic-import@10.5.2': dependencies: - '@cspell/url': 10.4.1 + '@cspell/url': 10.5.2 import-meta-resolve: 4.2.0 - '@cspell/filetypes@10.4.1': {} + '@cspell/filetypes@10.5.2': {} - '@cspell/rpc@10.4.1': {} + '@cspell/rpc@10.5.2': {} - '@cspell/strong-weak-map@10.4.1': {} + '@cspell/strong-weak-map@10.5.2': {} - '@cspell/url@10.4.1': {} + '@cspell/url@10.5.2': {} '@docspring/cspell-lockfile-dicts@1.2.0': dependencies: '@cspell/cspell-types': 8.19.4 commander: 10.0.1 - glob: 14.0.3 + glob: 14.0.6 yaml: 2.9.1 - '@isaacs/nonrecursive-glob-match@1.0.3': {} + '@isaacs/nonrecursive-glob-match@1.1.0': {} '@streetsidesoftware/unindent@1.0.1': {} - ansi-regex@6.5.0: {} + ansi-regex@6.6.0: {} array-timsort@1.0.3: {} @@ -772,67 +772,67 @@ snapshots: commander@10.0.1: {} - commander@15.0.0: {} + commander@15.1.0: {} comment-json@5.0.0: dependencies: array-timsort: 1.0.3 esprima: 4.0.1 - cspell-config-lib@10.4.1: + cspell-config-lib@10.5.2: dependencies: - '@cspell/cspell-types': 10.4.1 + '@cspell/cspell-types': 10.5.2 comment-json: 5.0.0 smol-toml: 1.9.1 yaml: 2.9.1 - cspell-dictionary@10.4.1: + cspell-dictionary@10.5.2: dependencies: - '@cspell/cspell-performance-monitor': 10.4.1 - '@cspell/cspell-pipe': 10.4.1 - '@cspell/cspell-types': 10.4.1 - cspell-trie-lib: 10.4.1(@cspell/cspell-types@10.4.1) + '@cspell/cspell-performance-monitor': 10.5.2 + '@cspell/cspell-pipe': 10.5.2 + '@cspell/cspell-types': 10.5.2 + cspell-trie-lib: 10.5.2(@cspell/cspell-types@10.5.2) fast-equals: 6.2.2 - cspell-gitignore@10.4.1: + cspell-gitignore@10.5.2: dependencies: - '@cspell/url': 10.4.1 - cspell-glob: 10.4.1 - cspell-io: 10.4.1 + '@cspell/url': 10.5.2 + cspell-glob: 10.5.2 + cspell-io: 10.5.2 - cspell-glob@10.4.1: + cspell-glob@10.5.2: dependencies: - '@cspell/url': 10.4.1 + '@cspell/url': 10.5.2 picomatch: 4.0.7 - cspell-grammar@10.4.1: + cspell-grammar@10.5.2: dependencies: - '@cspell/cspell-pipe': 10.4.1 - '@cspell/cspell-types': 10.4.1 + '@cspell/cspell-pipe': 10.5.2 + '@cspell/cspell-types': 10.5.2 - cspell-io@10.4.1: + cspell-io@10.5.2: dependencies: - '@cspell/cspell-service-bus': 10.4.1 - '@cspell/url': 10.4.1 + '@cspell/cspell-service-bus': 10.5.2 + '@cspell/url': 10.5.2 - cspell-lib@10.4.1: + cspell-lib@10.5.2: dependencies: - '@cspell/cspell-bundled-dicts': 10.4.1 - '@cspell/cspell-performance-monitor': 10.4.1 - '@cspell/cspell-pipe': 10.4.1 - '@cspell/cspell-resolver': 10.4.1 - '@cspell/cspell-types': 10.4.1 - '@cspell/dynamic-import': 10.4.1 - '@cspell/filetypes': 10.4.1 - '@cspell/rpc': 10.4.1 - '@cspell/strong-weak-map': 10.4.1 - '@cspell/url': 10.4.1 - cspell-config-lib: 10.4.1 - cspell-dictionary: 10.4.1 - cspell-glob: 10.4.1 - cspell-grammar: 10.4.1 - cspell-io: 10.4.1 - cspell-trie-lib: 10.4.1(@cspell/cspell-types@10.4.1) + '@cspell/cspell-bundled-dicts': 10.5.2 + '@cspell/cspell-performance-monitor': 10.5.2 + '@cspell/cspell-pipe': 10.5.2 + '@cspell/cspell-resolver': 10.5.2 + '@cspell/cspell-types': 10.5.2 + '@cspell/dynamic-import': 10.5.2 + '@cspell/filetypes': 10.5.2 + '@cspell/rpc': 10.5.2 + '@cspell/strong-weak-map': 10.5.2 + '@cspell/url': 10.5.2 + cspell-config-lib: 10.5.2 + cspell-dictionary: 10.5.2 + cspell-glob: 10.5.2 + cspell-grammar: 10.5.2 + cspell-io: 10.5.2 + cspell-trie-lib: 10.5.2(@cspell/cspell-types@10.5.2) env-paths: 4.0.0 gensequence: 8.0.8 import-fresh: 4.0.1 @@ -841,30 +841,30 @@ snapshots: vscode-uri: 3.2.0 xdg-basedir: 5.1.0 - cspell-trie-lib@10.4.1(@cspell/cspell-types@10.4.1): + cspell-trie-lib@10.5.2(@cspell/cspell-types@10.5.2): dependencies: - '@cspell/cspell-types': 10.4.1 + '@cspell/cspell-types': 10.5.2 - cspell@10.4.1: + cspell@10.5.2: dependencies: - '@cspell/cspell-json-reporter': 10.4.1 - '@cspell/cspell-performance-monitor': 10.4.1 - '@cspell/cspell-pipe': 10.4.1 - '@cspell/cspell-types': 10.4.1 - '@cspell/cspell-worker': 10.4.1 - '@cspell/dynamic-import': 10.4.1 - '@cspell/url': 10.4.1 + '@cspell/cspell-json-reporter': 10.5.2 + '@cspell/cspell-performance-monitor': 10.5.2 + '@cspell/cspell-pipe': 10.5.2 + '@cspell/cspell-types': 10.5.2 + '@cspell/cspell-worker': 10.5.2 + '@cspell/dynamic-import': 10.5.2 + '@cspell/url': 10.5.2 '@streetsidesoftware/unindent': 1.0.1 - ansi-regex: 6.5.0 + ansi-regex: 6.6.0 chalk: 6.0.1 chalk-template: 1.1.3 - commander: 15.0.0 - cspell-config-lib: 10.4.1 - cspell-dictionary: 10.4.1 - cspell-gitignore: 10.4.1 - cspell-glob: 10.4.1 - cspell-io: 10.4.1 - cspell-lib: 10.4.1 + commander: 15.1.0 + cspell-config-lib: 10.5.2 + cspell-dictionary: 10.5.2 + cspell-gitignore: 10.5.2 + cspell-glob: 10.5.2 + cspell-io: 10.5.2 + cspell-lib: 10.5.2 flatted: 3.4.4 semver: 7.8.6 tinyglobby: 0.2.17 @@ -885,9 +885,9 @@ snapshots: gensequence@8.0.8: {} - glob@14.0.3: + glob@14.0.6: dependencies: - minimatch: 11.0.3 + minimatch: 11.0.9 minipass: 7.1.3 path-scurry: 3.0.0 @@ -903,46 +903,46 @@ snapshots: is-safe-filename@0.1.1: {} - jscpd-darwin-arm64@5.4.2: + jscpd-darwin-arm64@5.4.3: optional: true - jscpd-darwin-x64@5.4.2: + jscpd-darwin-x64@5.4.3: optional: true - jscpd-linux-arm64-gnu@5.4.2: + jscpd-linux-arm64-gnu@5.4.3: optional: true - jscpd-linux-arm64-musl@5.4.2: + jscpd-linux-arm64-musl@5.4.3: optional: true - jscpd-linux-x64-gnu@5.4.2: + jscpd-linux-x64-gnu@5.4.3: optional: true - jscpd-linux-x64-musl@5.4.2: + jscpd-linux-x64-musl@5.4.3: optional: true - jscpd-windows-arm64-msvc@5.4.2: + jscpd-windows-arm64-msvc@5.4.3: optional: true - jscpd-windows-x64-msvc@5.4.2: + jscpd-windows-x64-msvc@5.4.3: optional: true - jscpd@5.4.2: + jscpd@5.4.3: optionalDependencies: - jscpd-darwin-arm64: 5.4.2 - jscpd-darwin-x64: 5.4.2 - jscpd-linux-arm64-gnu: 5.4.2 - jscpd-linux-arm64-musl: 5.4.2 - jscpd-linux-x64-gnu: 5.4.2 - jscpd-linux-x64-musl: 5.4.2 - jscpd-windows-arm64-msvc: 5.4.2 - jscpd-windows-x64-msvc: 5.4.2 + jscpd-darwin-arm64: 5.4.3 + jscpd-darwin-x64: 5.4.3 + jscpd-linux-arm64-gnu: 5.4.3 + jscpd-linux-arm64-musl: 5.4.3 + jscpd-linux-x64-gnu: 5.4.3 + jscpd-linux-x64-musl: 5.4.3 + jscpd-windows-arm64-msvc: 5.4.3 + jscpd-windows-x64-msvc: 5.4.3 lru-cache@11.5.3: {} - minimatch@11.0.3: + minimatch@11.0.9: dependencies: - '@isaacs/nonrecursive-glob-match': 1.0.3 + '@isaacs/nonrecursive-glob-match': 1.1.0 brace-expansion: 5.0.12 minipass@7.1.3: {} @@ -954,7 +954,7 @@ snapshots: picomatch@4.0.7: {} - prettier@3.9.10: {} + prettier@3.10.1: {} resolve-from@5.0.0: {} From 17d69d06af7e70c9a17a438983d0a68701e4587c Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Wed, 2 Dec 2026 12:40:19 +1300 Subject: [PATCH 3/3] Update ruby/setup-ruby to 1.343.0 and actions/setup-go to 7.1.0 --- .github/workflows/deploy-docs.yml | 2 +- .github/workflows/rails-main.yml | 2 +- .github/workflows/release.yml | 8 ++++---- .github/workflows/test.yml | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index b67d0107..225573b7 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -49,7 +49,7 @@ jobs: persist-credentials: false - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version' bundler-cache: true diff --git a/.github/workflows/rails-main.yml b/.github/workflows/rails-main.yml index cd9116ee..ea08e5bd 100644 --- a/.github/workflows/rails-main.yml +++ b/.github/workflows/rails-main.yml @@ -23,7 +23,7 @@ jobs: run: rm -f Gemfile.lock .ruby-version - name: Setup Ruby 4.0.1 - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '4.0.1' bundler-cache: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eedefaa4..dcefc6ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,7 +114,7 @@ jobs: # No bundler cache in release jobs: a cache is shared with other runs, and gem build needs no bundle - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version' @@ -171,7 +171,7 @@ jobs: name: gem - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: ruby @@ -196,7 +196,7 @@ jobs: # No bundler cache in release jobs: a cache is shared with other runs - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version' @@ -216,7 +216,7 @@ jobs: run: ruby scripts/export_provider_catalog.rb - name: Setup Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 with: go-version: '1.22' cache: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd04178b..875c6fee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: persist-credentials: false - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version' # Install all gems (both test and development) @@ -107,7 +107,7 @@ jobs: persist-credentials: false - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version' bundler-cache: true @@ -134,7 +134,7 @@ jobs: persist-credentials: false - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version' bundler-cache: true @@ -183,7 +183,7 @@ jobs: persist-credentials: false - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version' bundler-cache: true @@ -242,7 +242,7 @@ jobs: run: rm -f Gemfile.lock - name: Setup Ruby 4.0.1 - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '4.0.1' bundler-cache: true @@ -325,7 +325,7 @@ jobs: run: rm -f Gemfile.lock - name: Setup Ruby ${{ matrix.ruby }} - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true @@ -346,7 +346,7 @@ jobs: persist-credentials: false - name: Setup Ruby - uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 with: ruby-version: '.ruby-version'