roast-ai 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -0
  3. data/.github/workflows/ci.yaml +1 -0
  4. data/.gitignore +0 -26
  5. data/.rubocop.yml +13 -0
  6. data/.rubocop_todo.yml +21 -0
  7. data/CHANGELOG.md +37 -0
  8. data/Gemfile +4 -0
  9. data/Gemfile.lock +43 -1
  10. data/bin/rubocop +27 -0
  11. data/bin/spoom +27 -0
  12. data/bin/srb +27 -0
  13. data/bin/srb-rbi +27 -0
  14. data/bin/tapioca +27 -0
  15. data/docs/INSTRUMENTATION.md +3 -3
  16. data/dsl/simple.rb +10 -0
  17. data/examples/retry/workflow.yml +23 -0
  18. data/lib/roast/dsl/executor.rb +26 -0
  19. data/lib/roast/dsl.rb +7 -0
  20. data/lib/roast/errors.rb +1 -0
  21. data/lib/roast/factories/api_provider_factory.rb +1 -0
  22. data/lib/roast/helpers/function_caching_interceptor.rb +3 -0
  23. data/lib/roast/helpers/logger.rb +6 -9
  24. data/lib/roast/helpers/metadata_access.rb +1 -0
  25. data/lib/roast/helpers/minitest_coverage_runner.rb +1 -0
  26. data/lib/roast/helpers/path_resolver.rb +8 -18
  27. data/lib/roast/helpers/prompt_loader.rb +3 -2
  28. data/lib/roast/helpers/timeout_handler.rb +3 -5
  29. data/lib/roast/initializers.rb +1 -0
  30. data/lib/roast/resources/api_resource.rb +4 -3
  31. data/lib/roast/resources/base_resource.rb +1 -0
  32. data/lib/roast/resources/directory_resource.rb +1 -0
  33. data/lib/roast/resources/file_resource.rb +1 -0
  34. data/lib/roast/resources/none_resource.rb +1 -0
  35. data/lib/roast/resources/url_resource.rb +2 -1
  36. data/lib/roast/resources.rb +1 -2
  37. data/lib/roast/services/context_threshold_checker.rb +1 -0
  38. data/lib/roast/services/token_counting_service.rb +1 -0
  39. data/lib/roast/tools/apply_diff.rb +1 -0
  40. data/lib/roast/tools/ask_user.rb +1 -0
  41. data/lib/roast/tools/bash.rb +1 -0
  42. data/lib/roast/tools/cmd.rb +1 -0
  43. data/lib/roast/tools/coding_agent.rb +1 -0
  44. data/lib/roast/tools/context_summarizer.rb +1 -0
  45. data/lib/roast/tools/grep.rb +1 -0
  46. data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -0
  47. data/lib/roast/tools/read_file.rb +1 -0
  48. data/lib/roast/tools/search_file.rb +1 -0
  49. data/lib/roast/tools/swarm.rb +1 -0
  50. data/lib/roast/tools/update_files.rb +1 -0
  51. data/lib/roast/tools/write_file.rb +1 -0
  52. data/lib/roast/tools.rb +2 -0
  53. data/lib/roast/value_objects/api_token.rb +1 -0
  54. data/lib/roast/value_objects/step_name.rb +1 -0
  55. data/lib/roast/value_objects/uri_base.rb +1 -0
  56. data/lib/roast/value_objects/workflow_path.rb +1 -0
  57. data/lib/roast/value_objects.rb +1 -0
  58. data/lib/roast/version.rb +2 -1
  59. data/lib/roast/workflow/agent_step.rb +1 -0
  60. data/lib/roast/workflow/api_configuration.rb +1 -0
  61. data/lib/roast/workflow/base_iteration_step.rb +1 -0
  62. data/lib/roast/workflow/base_step.rb +1 -0
  63. data/lib/roast/workflow/base_workflow.rb +1 -0
  64. data/lib/roast/workflow/case_executor.rb +1 -0
  65. data/lib/roast/workflow/case_step.rb +1 -0
  66. data/lib/roast/workflow/command_executor.rb +1 -0
  67. data/lib/roast/workflow/conditional_executor.rb +1 -0
  68. data/lib/roast/workflow/conditional_step.rb +1 -0
  69. data/lib/roast/workflow/configuration.rb +9 -0
  70. data/lib/roast/workflow/configuration_loader.rb +4 -1
  71. data/lib/roast/workflow/context_manager.rb +1 -0
  72. data/lib/roast/workflow/context_path_resolver.rb +1 -0
  73. data/lib/roast/workflow/dot_access_hash.rb +1 -0
  74. data/lib/roast/workflow/each_step.rb +1 -0
  75. data/lib/roast/workflow/error_handler.rb +39 -3
  76. data/lib/roast/workflow/expression_evaluator.rb +1 -0
  77. data/lib/roast/workflow/expression_utils.rb +1 -0
  78. data/lib/roast/workflow/file_state_repository.rb +2 -1
  79. data/lib/roast/workflow/input_executor.rb +1 -0
  80. data/lib/roast/workflow/input_step.rb +1 -0
  81. data/lib/roast/workflow/interpolator.rb +2 -1
  82. data/lib/roast/workflow/iteration_executor.rb +1 -0
  83. data/lib/roast/workflow/llm_boolean_coercer.rb +1 -0
  84. data/lib/roast/workflow/metadata_manager.rb +1 -0
  85. data/lib/roast/workflow/output_handler.rb +1 -0
  86. data/lib/roast/workflow/output_manager.rb +1 -0
  87. data/lib/roast/workflow/parallel_executor.rb +1 -0
  88. data/lib/roast/workflow/prompt_step.rb +1 -0
  89. data/lib/roast/workflow/repeat_step.rb +1 -0
  90. data/lib/roast/workflow/replay_handler.rb +1 -0
  91. data/lib/roast/workflow/resource_resolver.rb +2 -6
  92. data/lib/roast/workflow/session_manager.rb +1 -0
  93. data/lib/roast/workflow/shell_script_step.rb +1 -0
  94. data/lib/roast/workflow/sqlite_state_repository.rb +1 -0
  95. data/lib/roast/workflow/state_manager.rb +1 -0
  96. data/lib/roast/workflow/state_repository.rb +1 -0
  97. data/lib/roast/workflow/state_repository_factory.rb +4 -2
  98. data/lib/roast/workflow/step_completion_reporter.rb +1 -0
  99. data/lib/roast/workflow/step_executor_coordinator.rb +17 -6
  100. data/lib/roast/workflow/step_executor_factory.rb +1 -0
  101. data/lib/roast/workflow/step_executor_registry.rb +2 -3
  102. data/lib/roast/workflow/step_executor_with_reporting.rb +1 -0
  103. data/lib/roast/workflow/step_executors/base_step_executor.rb +1 -0
  104. data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -0
  105. data/lib/roast/workflow/step_executors/parallel_step_executor.rb +1 -0
  106. data/lib/roast/workflow/step_executors/string_step_executor.rb +1 -0
  107. data/lib/roast/workflow/step_factory.rb +1 -0
  108. data/lib/roast/workflow/step_finder.rb +1 -0
  109. data/lib/roast/workflow/step_loader.rb +1 -0
  110. data/lib/roast/workflow/step_name_extractor.rb +1 -0
  111. data/lib/roast/workflow/step_runner.rb +1 -0
  112. data/lib/roast/workflow/step_type_resolver.rb +1 -0
  113. data/lib/roast/workflow/validation_command.rb +1 -0
  114. data/lib/roast/workflow/validator.rb +1 -0
  115. data/lib/roast/workflow/validators/base_validator.rb +1 -0
  116. data/lib/roast/workflow/validators/dependency_validator.rb +1 -0
  117. data/lib/roast/workflow/validators/linting_validator.rb +1 -0
  118. data/lib/roast/workflow/validators/schema_validator.rb +1 -0
  119. data/lib/roast/workflow/validators/step_collector.rb +1 -0
  120. data/lib/roast/workflow/validators/validation_orchestrator.rb +1 -0
  121. data/lib/roast/workflow/workflow_context.rb +1 -0
  122. data/lib/roast/workflow/workflow_execution_context.rb +1 -0
  123. data/lib/roast/workflow/workflow_executor.rb +2 -1
  124. data/lib/roast/workflow/workflow_initializer.rb +16 -1
  125. data/lib/roast/workflow/workflow_runner.rb +66 -55
  126. data/lib/roast/workflow.rb +1 -0
  127. data/lib/roast/workflow_diagram_generator.rb +3 -2
  128. data/lib/roast.rb +23 -8
  129. data/sorbet/config +8 -0
  130. data/sorbet/rbi/dsl/.gitattributes +1 -0
  131. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  132. data/sorbet/rbi/gems/.gitattributes +1 -0
  133. data/sorbet/rbi/gems/activesupport@8.0.2.rbi +19107 -0
  134. data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
  135. data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
  136. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  137. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
  138. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +62 -0
  139. data/sorbet/rbi/gems/cgi@0.5.0.rbi +2961 -0
  140. data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +568 -0
  141. data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +1991 -0
  142. data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
  143. data/sorbet/rbi/gems/coderay@1.1.3.rbi +9 -0
  144. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11657 -0
  145. data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
  146. data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
  147. data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +972 -0
  148. data/sorbet/rbi/gems/dotenv@3.1.8.rbi +295 -0
  149. data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
  150. data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +672 -0
  151. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +1894 -0
  152. data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +659 -0
  153. data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +781 -0
  154. data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +1127 -0
  155. data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +3727 -0
  156. data/sorbet/rbi/gems/dry-types@1.8.3.rbi +3969 -0
  157. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  158. data/sorbet/rbi/gems/event_stream_parser@1.0.0.rbi +49 -0
  159. data/sorbet/rbi/gems/faraday-multipart@1.1.1.rbi +283 -0
  160. data/sorbet/rbi/gems/faraday-net_http@3.4.1.rbi +147 -0
  161. data/sorbet/rbi/gems/faraday-retry@2.3.2.rbi +9 -0
  162. data/sorbet/rbi/gems/faraday@2.13.1.rbi +2977 -0
  163. data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +1588 -0
  164. data/sorbet/rbi/gems/ffi@1.17.2.rbi +9 -0
  165. data/sorbet/rbi/gems/formatador@1.1.0.rbi +9 -0
  166. data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +102 -0
  167. data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +402 -0
  168. data/sorbet/rbi/gems/guard@2.19.1.rbi +2283 -0
  169. data/sorbet/rbi/gems/hashdiff@1.2.0.rbi +355 -0
  170. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2359 -0
  171. data/sorbet/rbi/gems/json-schema@5.1.1.rbi +1466 -0
  172. data/sorbet/rbi/gems/json@2.12.2.rbi +2051 -0
  173. data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
  174. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +9 -0
  175. data/sorbet/rbi/gems/listen@3.9.0.rbi +1206 -0
  176. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  177. data/sorbet/rbi/gems/lumberjack@1.2.10.rbi +1830 -0
  178. data/sorbet/rbi/gems/method_source@1.1.0.rbi +9 -0
  179. data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +136 -0
  180. data/sorbet/rbi/gems/mime-types@3.7.0.rbi +1342 -0
  181. data/sorbet/rbi/gems/minitest-rg@5.3.0.rbi +160 -0
  182. data/sorbet/rbi/gems/minitest@5.25.5.rbi +1640 -0
  183. data/sorbet/rbi/gems/mocha@2.7.1.rbi +12 -0
  184. data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +244 -0
  185. data/sorbet/rbi/gems/nenv@0.3.0.rbi +147 -0
  186. data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
  187. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  188. data/sorbet/rbi/gems/notiffany@0.1.3.rbi +1079 -0
  189. data/sorbet/rbi/gems/open_router@0.3.3.rbi +230 -0
  190. data/sorbet/rbi/gems/ostruct@0.6.2.rbi +354 -0
  191. data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
  192. data/sorbet/rbi/gems/parser@3.3.8.0.rbi +5535 -0
  193. data/sorbet/rbi/gems/prism@1.4.0.rbi +41732 -0
  194. data/sorbet/rbi/gems/pry@0.15.2.rbi +9 -0
  195. data/sorbet/rbi/gems/public_suffix@6.0.2.rbi +936 -0
  196. data/sorbet/rbi/gems/racc@1.8.1.rbi +158 -0
  197. data/sorbet/rbi/gems/rack@2.2.17.rbi +5659 -0
  198. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +9 -0
  199. data/sorbet/rbi/gems/raix@1.0.2.rbi +1104 -0
  200. data/sorbet/rbi/gems/rake@13.3.0.rbi +3036 -0
  201. data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +9 -0
  202. data/sorbet/rbi/gems/rb-inotify@0.11.1.rbi +9 -0
  203. data/sorbet/rbi/gems/rbi@0.3.6.rbi +6893 -0
  204. data/sorbet/rbi/gems/rbs@3.9.4.rbi +6978 -0
  205. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +9 -0
  206. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
  207. data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +9 -0
  208. data/sorbet/rbi/gems/rubocop-shopify@2.17.1.rbi +9 -0
  209. data/sorbet/rbi/gems/rubocop@1.77.0.rbi +9 -0
  210. data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +1333 -0
  211. data/sorbet/rbi/gems/ruby-openai@8.1.0.rbi +758 -0
  212. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +9 -0
  213. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
  214. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  215. data/sorbet/rbi/gems/shellany@0.0.1.rbi +102 -0
  216. data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
  217. data/sorbet/rbi/gems/sqlite3@2.7.0.rbi +1900 -0
  218. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
  219. data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
  220. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
  221. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +9 -0
  222. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +9 -0
  223. data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
  224. data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
  225. data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
  226. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  227. data/sorbet/rbi/gems/yard@0.9.37.rbi +18492 -0
  228. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1429 -0
  229. data/sorbet/tapioca/config.yml +13 -0
  230. data/sorbet/tapioca/require.rb +36 -0
  231. metadata +114 -2
  232. data/lib/roast/workflow/configuration_parser.rb +0 -54
@@ -0,0 +1,1830 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `lumberjack` gem.
5
+ # Please instead update this file by running `bin/tapioca gem lumberjack`.
6
+
7
+
8
+ # source://lumberjack//lib/lumberjack.rb#9
9
+ module Lumberjack
10
+ class << self
11
+ # Contexts can be used to store tags that will be attached to all log entries in the block.
12
+ #
13
+ # If this method is called with a block, it will set a logging context for the scope of a block.
14
+ # If there is already a context in scope, a new one will be created that inherits
15
+ # all the tags of the parent context.
16
+ #
17
+ # Otherwise, it will return the current context. If one doesn't exist, it will return a new one
18
+ # but that context will not be in any scope.
19
+ #
20
+ # @return [Lumberjack::Context] The current context if called without a block.
21
+ #
22
+ # source://lumberjack//lib/lumberjack.rb#64
23
+ def context(&block); end
24
+
25
+ # Return true if inside a context block.
26
+ #
27
+ # @return [Boolean]
28
+ #
29
+ # source://lumberjack//lib/lumberjack.rb#90
30
+ def context?; end
31
+
32
+ # Return the tags from the current context or nil if there are no tags.
33
+ #
34
+ # @return [Hash, nil]
35
+ #
36
+ # source://lumberjack//lib/lumberjack.rb#97
37
+ def context_tags; end
38
+
39
+ # Set tags on the current context
40
+ #
41
+ # @param tags [Hash] The tags to set.
42
+ # @return [void]
43
+ #
44
+ # source://lumberjack//lib/lumberjack.rb#106
45
+ def tag(tags); end
46
+
47
+ # Define a unit of work within a block. Within the block supplied to this
48
+ # method, calling +unit_of_work_id+ will return the same value that can
49
+ # This can then be used for tying together log entries.
50
+ #
51
+ # You can specify the id for the unit of work if desired. If you don't supply
52
+ # it, a 12 digit hexidecimal number will be automatically generated for you.
53
+ #
54
+ # For the common use case of treating a single web request as a unit of work, see the
55
+ # Lumberjack::Rack::UnitOfWork class.
56
+ #
57
+ # @param id [String] The id for the unit of work.
58
+ # @return [void]
59
+ #
60
+ # source://lumberjack//lib/lumberjack.rb#39
61
+ def unit_of_work(id = T.unsafe(nil)); end
62
+
63
+ # Get the UniqueIdentifier for the current unit of work.
64
+ #
65
+ # @return [String, nil] The id for the current unit of work.
66
+ #
67
+ # source://lumberjack//lib/lumberjack.rb#50
68
+ def unit_of_work_id; end
69
+
70
+ # Set the context to use within a block.
71
+ #
72
+ # @param context [Lumberjack::Context] The context to use within the block.
73
+ # @return [Object] The result of the block.
74
+ #
75
+ # source://lumberjack//lib/lumberjack.rb#77
76
+ def use_context(context, &block); end
77
+ end
78
+ end
79
+
80
+ # A context is used to store tags that are then added to all log entries within a block.
81
+ #
82
+ # source://lumberjack//lib/lumberjack/context.rb#5
83
+ class Lumberjack::Context
84
+ # @param parent_context [Context] A parent context to inherit tags from.
85
+ # @return [Context] a new instance of Context
86
+ #
87
+ # source://lumberjack//lib/lumberjack/context.rb#9
88
+ def initialize(parent_context = T.unsafe(nil)); end
89
+
90
+ # Get a context tag.
91
+ #
92
+ # @param key [String, Symbol] The tag key.
93
+ # @return [Object] The tag value.
94
+ #
95
+ # source://lumberjack//lib/lumberjack/context.rb#28
96
+ def [](key); end
97
+
98
+ # Set a context tag.
99
+ #
100
+ # @param key [String, Symbol] The tag key.
101
+ # @param value [Object] The tag value.
102
+ # @return [void]
103
+ #
104
+ # source://lumberjack//lib/lumberjack/context.rb#37
105
+ def []=(key, value); end
106
+
107
+ # Clear all the context data.
108
+ #
109
+ # @return [void]
110
+ #
111
+ # source://lumberjack//lib/lumberjack/context.rb#44
112
+ def reset; end
113
+
114
+ # Set tags on the context.
115
+ #
116
+ # @param tags [Hash] The tags to set.
117
+ # @return [void]
118
+ #
119
+ # source://lumberjack//lib/lumberjack/context.rb#18
120
+ def tag(tags); end
121
+
122
+ # Returns the value of attribute tags.
123
+ #
124
+ # source://lumberjack//lib/lumberjack/context.rb#6
125
+ def tags; end
126
+ end
127
+
128
+ # This is an abstract class for logging devices. Subclasses must implement the +write+ method and
129
+ # may implement the +close+ and +flush+ methods if applicable.
130
+ #
131
+ # source://lumberjack//lib/lumberjack/device.rb#6
132
+ class Lumberjack::Device
133
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#110
134
+ def cleanup_files!; end
135
+
136
+ # Subclasses may implement this method to close the device.
137
+ #
138
+ # @return [void]
139
+ #
140
+ # source://lumberjack//lib/lumberjack/device.rb#26
141
+ def close; end
142
+
143
+ # Subclasses may implement this method to get the format for log timestamps.
144
+ #
145
+ # @return [String] The format for log timestamps.
146
+ #
147
+ # source://lumberjack//lib/lumberjack/device.rb#47
148
+ def datetime_format; end
149
+
150
+ # Subclasses may implement this method to set a format for log timestamps.
151
+ #
152
+ # @param format [String] The format for log timestamps.
153
+ # @return [void]
154
+ #
155
+ # source://lumberjack//lib/lumberjack/device.rb#54
156
+ def datetime_format=(format); end
157
+
158
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#121
159
+ def do_once(file); end
160
+
161
+ # Subclasses may implement this method to flush any buffers used by the device.
162
+ #
163
+ # @return [void]
164
+ #
165
+ # source://lumberjack//lib/lumberjack/device.rb#41
166
+ def flush; end
167
+
168
+ # Subclasses may implement this method to reopen the device.
169
+ #
170
+ # @param logdev [Object] The log device to use.
171
+ # @return [void]
172
+ #
173
+ # source://lumberjack//lib/lumberjack/device.rb#34
174
+ def reopen(logdev = T.unsafe(nil)); end
175
+
176
+ # Subclasses must implement this method to write a LogEntry.
177
+ #
178
+ # @param entry [Lumberjack::LogEntry] The entry to write.
179
+ # @raise [NotImplementedError]
180
+ # @return [void]
181
+ #
182
+ # source://lumberjack//lib/lumberjack/device.rb#19
183
+ def write(entry); end
184
+ end
185
+
186
+ # This log device will append entries to a file and roll the file periodically by date. Files
187
+ # are rolled at midnight and can be rolled daily, weekly, or monthly. Archive file names will
188
+ # have the date appended to them in the format ".YYYY-MM-DD" for daily, ".week-of-YYYY-MM-DD" for weekly
189
+ # and ".YYYY-MM" for monthly. It is not guaranteed that log messages will break exactly on the
190
+ # roll period as buffered entries will always be written to the same file.
191
+ #
192
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#12
193
+ class Lumberjack::Device::DateRollingLogFile < ::Lumberjack::Device::RollingLogFile
194
+ # Create a new logging device to the specified file. The period to roll the file is specified
195
+ # with the :roll option which may contain a value of :daily, :weekly,
196
+ # or :monthly.
197
+ #
198
+ # @param path [String, Pathname] The path to the log file.
199
+ # @param options [Hash] The options for the device.
200
+ # @return [DateRollingLogFile] a new instance of DateRollingLogFile
201
+ #
202
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#19
203
+ def initialize(path, options = T.unsafe(nil)); end
204
+
205
+ # The date based suffix for file.
206
+ #
207
+ # @return [String]
208
+ #
209
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#34
210
+ def archive_file_suffix; end
211
+
212
+ # Check if the file should be rolled.
213
+ #
214
+ # @return [Boolean]
215
+ #
216
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#48
217
+ def roll_file?; end
218
+
219
+ protected
220
+
221
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#69
222
+ def after_roll; end
223
+ end
224
+
225
+ # This is a logging device that appends log entries to a file.
226
+ #
227
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#8
228
+ class Lumberjack::Device::LogFile < ::Lumberjack::Device::Writer
229
+ # Create a logger to the file at +path+. Options are passed through to the Writer constructor.
230
+ #
231
+ # @param path [String, Pathname] The path to the log file.
232
+ # @param options [Hash] The options for the device.
233
+ # @return [LogFile] a new instance of LogFile
234
+ #
235
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#18
236
+ def initialize(path, options = T.unsafe(nil)); end
237
+
238
+ # The absolute path of the file being logged to.
239
+ #
240
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#12
241
+ def path; end
242
+
243
+ # Reopen the log file.
244
+ #
245
+ # @param logdev [Object] not used
246
+ # @return [void]
247
+ #
248
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#28
249
+ def reopen(logdev = T.unsafe(nil)); end
250
+
251
+ private
252
+
253
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#35
254
+ def file_stream; end
255
+ end
256
+
257
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#9
258
+ Lumberjack::Device::LogFile::EXTERNAL_ENCODING = T.let(T.unsafe(nil), String)
259
+
260
+ # This is a logging device that forward log entries to multiple other devices.
261
+ #
262
+ # source://lumberjack//lib/lumberjack/device/multi.rb#6
263
+ class Lumberjack::Device::Multi < ::Lumberjack::Device
264
+ # @param devices [Array<Lumberjack::Device>] The devices to write to.
265
+ # @return [Multi] a new instance of Multi
266
+ #
267
+ # source://lumberjack//lib/lumberjack/device/multi.rb#8
268
+ def initialize(*devices); end
269
+
270
+ # source://lumberjack//lib/lumberjack/device/multi.rb#24
271
+ def close; end
272
+
273
+ # source://lumberjack//lib/lumberjack/device/multi.rb#36
274
+ def datetime_format; end
275
+
276
+ # source://lumberjack//lib/lumberjack/device/multi.rb#40
277
+ def datetime_format=(format); end
278
+
279
+ # source://lumberjack//lib/lumberjack/device/multi.rb#18
280
+ def flush; end
281
+
282
+ # source://lumberjack//lib/lumberjack/device/multi.rb#30
283
+ def reopen(logdev = T.unsafe(nil)); end
284
+
285
+ # source://lumberjack//lib/lumberjack/device/multi.rb#12
286
+ def write(entry); end
287
+ end
288
+
289
+ # This is a logging device that produces no output. It can be useful in
290
+ # testing environments when log file output is not useful.
291
+ #
292
+ # source://lumberjack//lib/lumberjack/device/null.rb#7
293
+ class Lumberjack::Device::Null < ::Lumberjack::Device
294
+ # @return [Null] a new instance of Null
295
+ #
296
+ # source://lumberjack//lib/lumberjack/device/null.rb#8
297
+ def initialize(*args); end
298
+
299
+ # source://lumberjack//lib/lumberjack/device/null.rb#11
300
+ def write(entry); end
301
+ end
302
+
303
+ # This is an abstract class for a device that appends entries to a file and periodically archives
304
+ # the existing file and starts a one. Subclasses must implement the roll_file? and archive_file_suffix
305
+ # methods.
306
+ #
307
+ # The :keep option can be used to specify a maximum number of rolled log files to keep.
308
+ # Older files will be deleted based on the time they were created. The default is to keep all files.
309
+ #
310
+ # The :min_roll_check option can be used to specify the number of seconds between checking
311
+ # the file to determine if it needs to be rolled. The default is to check at most once per second.
312
+ #
313
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#14
314
+ class Lumberjack::Device::RollingLogFile < ::Lumberjack::Device::LogFile
315
+ # @return [RollingLogFile] a new instance of RollingLogFile
316
+ #
317
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#18
318
+ def initialize(path, options = T.unsafe(nil)); end
319
+
320
+ # Returns a suffix that will be appended to the file name when it is archived.. The suffix should
321
+ # change after it is time to roll the file. The log file will be renamed when it is rolled.
322
+ #
323
+ # @raise [NotImplementedError]
324
+ #
325
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#34
326
+ def archive_file_suffix; end
327
+
328
+ # Returns the value of attribute keep.
329
+ #
330
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#16
331
+ def keep; end
332
+
333
+ # Sets the attribute keep
334
+ #
335
+ # @param value the value to set the attribute keep to.
336
+ #
337
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#16
338
+ def keep=(_arg0); end
339
+
340
+ # Returns the value of attribute path.
341
+ #
342
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#15
343
+ def path; end
344
+
345
+ # Roll the log file by renaming it to the archive file name and then re-opening a stream to the log
346
+ # file path. Rolling a file is safe in multi-threaded or multi-process environments.
347
+ #
348
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#45
349
+ def roll_file!; end
350
+
351
+ # Return +true+ if the file should be rolled.
352
+ #
353
+ # @raise [NotImplementedError]
354
+ # @return [Boolean]
355
+ #
356
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#39
357
+ def roll_file?; end
358
+
359
+ protected
360
+
361
+ # This method will be called after a file has been rolled. Subclasses can
362
+ # implement code to reset the state of the device. This method is thread safe.
363
+ #
364
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#73
365
+ def after_roll; end
366
+
367
+ # Handle rolling the file before flushing.
368
+ #
369
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#77
370
+ def before_flush; end
371
+
372
+ private
373
+
374
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#96
375
+ def reopen_file; end
376
+ end
377
+
378
+ # This is a log device that appends entries to a file and rolls the file when it reaches a specified
379
+ # size threshold. When a file is rolled, it will have an number extension appended to the file name.
380
+ # For example, if the log file is named production.log, the first time it is rolled it will be renamed
381
+ # production.log.1, then production.log.2, etc.
382
+ #
383
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#9
384
+ class Lumberjack::Device::SizeRollingLogFile < ::Lumberjack::Device::RollingLogFile
385
+ # Create an new log device to the specified file. The maximum size of the log file is specified with
386
+ # the :max_size option. The unit can also be specified: "32K", "100M", "2G" are all valid.
387
+ #
388
+ # @return [SizeRollingLogFile] a new instance of SizeRollingLogFile
389
+ #
390
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#14
391
+ def initialize(path, options = T.unsafe(nil)); end
392
+
393
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#38
394
+ def archive_file_suffix; end
395
+
396
+ # Returns the value of attribute max_size.
397
+ #
398
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#10
399
+ def max_size; end
400
+
401
+ # @return [Boolean]
402
+ #
403
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#42
404
+ def roll_file?; end
405
+
406
+ protected
407
+
408
+ # Calculate the next archive file name extension.
409
+ #
410
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#51
411
+ def next_archive_number; end
412
+ end
413
+
414
+ # This logging device writes log entries as strings to an IO stream. By default, messages will be buffered
415
+ # and written to the stream in a batch when the buffer is full or when +flush+ is called.
416
+ #
417
+ # Subclasses can implement a +before_flush+ method if they have logic to execute before flushing the log.
418
+ # If it is implemented, it will be called before every flush inside a mutex lock.
419
+ #
420
+ # source://lumberjack//lib/lumberjack/device/writer.rb#10
421
+ class Lumberjack::Device::Writer < ::Lumberjack::Device
422
+ # Create a new device to write log entries to a stream. Entries are converted to strings
423
+ # using a Template. The template can be specified using the :template option. This can
424
+ # either be a Proc or a string that will compile into a Template object.
425
+ #
426
+ # If the template is a Proc, it should accept an LogEntry as its only argument and output a string.
427
+ #
428
+ # If the template is a template string, it will be used to create a Template. The
429
+ # :additional_lines and :time_format options will be passed through to the
430
+ # Template constuctor.
431
+ #
432
+ # The default template is "[:time :severity :progname(:pid) #:unit_of_work_id] :message"
433
+ # with additional lines formatted as "\n [#:unit_of_work_id] :message". The unit of
434
+ # work id will only appear if it is present.
435
+ #
436
+ # The size of the internal buffer in bytes can be set by providing :buffer_size (defaults to 32K).
437
+ #
438
+ # @param stream [IO] The stream to write log entries to.
439
+ # @param options [Hash] The options for the device.
440
+ # @return [Writer] a new instance of Writer
441
+ #
442
+ # source://lumberjack//lib/lumberjack/device/writer.rb#66
443
+ def initialize(stream, options = T.unsafe(nil)); end
444
+
445
+ # The size of the internal buffer. Defaults to 32K.
446
+ #
447
+ # source://lumberjack//lib/lumberjack/device/writer.rb#15
448
+ def buffer_size; end
449
+
450
+ # Set the buffer size in bytes. The device will only be physically written to when the buffer size
451
+ # is exceeded.
452
+ #
453
+ # @param value [Integer] The size of the buffer in bytes.
454
+ # @return [void]
455
+ #
456
+ # source://lumberjack//lib/lumberjack/device/writer.rb#86
457
+ def buffer_size=(value); end
458
+
459
+ # Close the underlying stream.
460
+ #
461
+ # @return [void]
462
+ #
463
+ # source://lumberjack//lib/lumberjack/device/writer.rb#119
464
+ def close; end
465
+
466
+ # Get the datetime format.
467
+ #
468
+ # @return [String] The datetime format.
469
+ #
470
+ # source://lumberjack//lib/lumberjack/device/writer.rb#139
471
+ def datetime_format; end
472
+
473
+ # Set the datetime format.
474
+ #
475
+ # @param format [String] The datetime format.
476
+ # @return [void]
477
+ #
478
+ # source://lumberjack//lib/lumberjack/device/writer.rb#147
479
+ def datetime_format=(format); end
480
+
481
+ # Flush the underlying stream.
482
+ #
483
+ # @return [void]
484
+ #
485
+ # source://lumberjack//lib/lumberjack/device/writer.rb#127
486
+ def flush; end
487
+
488
+ # Write an entry to the stream. The entry will be converted into a string using the defined template.
489
+ #
490
+ # @param entry [LogEntry, String] The entry to write to the stream.
491
+ # @return [void]
492
+ #
493
+ # source://lumberjack//lib/lumberjack/device/writer.rb#95
494
+ def write(entry); end
495
+
496
+ protected
497
+
498
+ # Get the underlying stream.
499
+ #
500
+ # source://lumberjack//lib/lumberjack/device/writer.rb#159
501
+ def stream; end
502
+
503
+ # Set the underlying stream.
504
+ #
505
+ # source://lumberjack//lib/lumberjack/device/writer.rb#156
506
+ def stream=(_arg0); end
507
+
508
+ private
509
+
510
+ # source://lumberjack//lib/lumberjack/device/writer.rb#163
511
+ def write_to_stream(lines); end
512
+ end
513
+
514
+ # Internal buffer to batch writes to the stream.
515
+ #
516
+ # source://lumberjack//lib/lumberjack/device/writer.rb#18
517
+ class Lumberjack::Device::Writer::Buffer
518
+ # @return [Buffer] a new instance of Buffer
519
+ #
520
+ # source://lumberjack//lib/lumberjack/device/writer.rb#21
521
+ def initialize; end
522
+
523
+ # source://lumberjack//lib/lumberjack/device/writer.rb#26
524
+ def <<(string); end
525
+
526
+ # source://lumberjack//lib/lumberjack/device/writer.rb#42
527
+ def clear; end
528
+
529
+ # @return [Boolean]
530
+ #
531
+ # source://lumberjack//lib/lumberjack/device/writer.rb#31
532
+ def empty?; end
533
+
534
+ # source://lumberjack//lib/lumberjack/device/writer.rb#35
535
+ def pop!; end
536
+
537
+ # source://lumberjack//lib/lumberjack/device/writer.rb#19
538
+ def size; end
539
+ end
540
+
541
+ # source://lumberjack//lib/lumberjack/device/writer.rb#12
542
+ Lumberjack::Device::Writer::DEFAULT_ADDITIONAL_LINES_TEMPLATE = T.let(T.unsafe(nil), String)
543
+
544
+ # source://lumberjack//lib/lumberjack/device/writer.rb#11
545
+ Lumberjack::Device::Writer::DEFAULT_FIRST_LINE_TEMPLATE = T.let(T.unsafe(nil), String)
546
+
547
+ # This class controls the conversion of log entry messages into a loggable format. This allows you
548
+ # to log any object you want and have the logging system deal with converting it into a string.
549
+ #
550
+ # Formats are added to a Formatter by associating them with a class using the +add+ method. Formats
551
+ # are any object that responds to the +call+ method.
552
+ #
553
+ # By default, all object will be converted to strings using their inspect method except for Strings
554
+ # and Exceptions. Strings are not converted and Exceptions are converted using the ExceptionFormatter.
555
+ #
556
+ # Enumerable objects (including Hash and Array) will call the formatter recursively for each element.
557
+ #
558
+ # source://lumberjack//lib/lumberjack/formatter.rb#14
559
+ class Lumberjack::Formatter
560
+ # @return [Formatter] a new instance of Formatter
561
+ #
562
+ # source://lumberjack//lib/lumberjack/formatter.rb#37
563
+ def initialize; end
564
+
565
+ # Add a formatter for a class. The formatter can be specified as either an object
566
+ # that responds to the +call+ method or as a symbol representing one of the predefined
567
+ # formatters, or as a block to the method call.
568
+ #
569
+ # The predefined formatters are:
570
+ # - :date_time
571
+ # - :exception
572
+ # - :id
573
+ # - :inspect
574
+ # - :object
575
+ # - :pretty_print
576
+ # - :string
577
+ # - :strip
578
+ # - :structured
579
+ # - :truncate
580
+ #
581
+ # You can add multiple classes at once by passing an array of classes.
582
+ #
583
+ # You can also pass class names as strings instead of the classes themselves. This can
584
+ # help avoid loading dependency issues. This applies only to classes; modules cannot be
585
+ # passed in as strings.
586
+ #
587
+ # @example
588
+ #
589
+ # # Use a predefined formatter
590
+ # formatter.add(MyClass, :pretty_print)
591
+ #
592
+ # # Pass in a formatter object
593
+ # formatter.add(MyClass, Lumberjack::Formatter::PrettyPrintFormatter.new)
594
+ #
595
+ # # Use a block
596
+ # formatter.add(MyClass){|obj| obj.humanize}
597
+ #
598
+ # # Add statements can be chained together
599
+ # formatter.add(MyClass, :pretty_print).add(YourClass){|obj| obj.humanize}
600
+ # @param klass [Class, Module, String, Array<Class, Module, String>] The class or module to add a formatter for.
601
+ # @param formatter [Symbol, Class, String, #call] The formatter to use for the class.
602
+ # If a symbol is passed in, it will be used to load one of the predefined formatters.
603
+ # If a class is passed in, it will be initialized with the args passed in.
604
+ # Otherwise, the object will be used as the formatter and must respond to call method.
605
+ # @param args [Array] Arguments to pass to the formatter when it is initialized.
606
+ # @return [self] Returns itself so that add statements can be chained together.
607
+ # @yield [obj] A block that will be used as the formatter for the class.
608
+ # @yieldparam obj [Object] The object to format.
609
+ # @yieldreturn [String] The formatted string.
610
+ #
611
+ # source://lumberjack//lib/lumberjack/formatter.rb#93
612
+ def add(klass, formatter = T.unsafe(nil), *args, &block); end
613
+
614
+ # Compatibility with the Logger::Formatter signature. This method will just convert the message
615
+ # object to a string and ignores the other parameters.
616
+ #
617
+ # @param severity [Integer, String, Symbol] The severity of the message.
618
+ # @param timestamp [Time] The time the message was logged.
619
+ # @param progname [String] The name of the program logging the message.
620
+ # @param msg [Object] The message object to format.
621
+ #
622
+ # source://lumberjack//lib/lumberjack/formatter.rb#175
623
+ def call(severity, timestamp, progname, msg); end
624
+
625
+ # Remove all formatters including the default formatter. Can be chained to add method calls.
626
+ #
627
+ # @return [self] Returns itself so that clear statements can be chained together.
628
+ #
629
+ # source://lumberjack//lib/lumberjack/formatter.rb#149
630
+ def clear; end
631
+
632
+ # Format a message object by applying all formatters attached to it.
633
+ #
634
+ # @param message [Object] The message object to format.
635
+ # @return [Object] The formatted object.
636
+ #
637
+ # source://lumberjack//lib/lumberjack/formatter.rb#159
638
+ def format(message); end
639
+
640
+ # Remove the formatter associated with a class. Remove statements can be chained together.
641
+ #
642
+ # You can remove multiple classes at once by passing an array of classes.
643
+ #
644
+ # You can also pass class names as strings instead of the classes themselves. This can
645
+ # help avoid loading dependency issues. This applies only to classes; modules cannot be
646
+ # passed in as strings.
647
+ #
648
+ # @param klass [Class, Module, String, Array<Class, Module, String>] The class or module to remove the formatters for.
649
+ # @return [self] Returns itself so that remove statements can be chained together.
650
+ #
651
+ # source://lumberjack//lib/lumberjack/formatter.rb#134
652
+ def remove(klass); end
653
+
654
+ private
655
+
656
+ # Find the formatter for a class by looking it up using the class hierarchy.
657
+ #
658
+ # source://lumberjack//lib/lumberjack/formatter.rb#182
659
+ def formatter_for(klass); end
660
+
661
+ class << self
662
+ # Returns a new empty formatter with no mapping. For historical reasons, a formatter
663
+ # is initialized with mappings to help output objects as strings. This will return one
664
+ # without the default mappings.
665
+ #
666
+ # @return [Lumberjack::Formatter] a new empty formatter
667
+ #
668
+ # source://lumberjack//lib/lumberjack/formatter.rb#32
669
+ def empty; end
670
+ end
671
+ end
672
+
673
+ # Format a Date, Time, or DateTime object. If you don't specify a format in the constructor,
674
+ # it will use the ISO-8601 format.
675
+ #
676
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#7
677
+ class Lumberjack::Formatter::DateTimeFormatter
678
+ # @param format [String] The format to use when formatting the date/time object.
679
+ # @return [DateTimeFormatter] a new instance of DateTimeFormatter
680
+ #
681
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#11
682
+ def initialize(format = T.unsafe(nil)); end
683
+
684
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#15
685
+ def call(obj); end
686
+
687
+ # Returns the value of attribute format.
688
+ #
689
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#8
690
+ def format; end
691
+ end
692
+
693
+ # Format an exception including the backtrace. You can specify an object that
694
+ # responds to `call` as a backtrace cleaner. The exception backtrace will be
695
+ # passed to this object and the returned array is what will be logged. You can
696
+ # use this to clean out superfluous lines.
697
+ #
698
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#9
699
+ class Lumberjack::Formatter::ExceptionFormatter
700
+ # @param backtrace_cleaner [#call] An object that responds to `call` and takes
701
+ # an array of strings (the backtrace) and returns an array of strings (the
702
+ # @return [ExceptionFormatter] a new instance of ExceptionFormatter
703
+ #
704
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#14
705
+ def initialize(backtrace_cleaner = T.unsafe(nil)); end
706
+
707
+ # Returns the value of attribute backtrace_cleaner.
708
+ #
709
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#10
710
+ def backtrace_cleaner; end
711
+
712
+ # Sets the attribute backtrace_cleaner
713
+ #
714
+ # @param value the value to set the attribute backtrace_cleaner to.
715
+ #
716
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#10
717
+ def backtrace_cleaner=(_arg0); end
718
+
719
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#18
720
+ def call(exception); end
721
+
722
+ private
723
+
724
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#30
725
+ def clean_backtrace(trace); end
726
+ end
727
+
728
+ # Format an object that has an id as a hash with keys for class and id. This formatter is useful
729
+ # as a default formatter for objects pulled from a data store. By default it will use :id as the
730
+ # id attribute.
731
+ #
732
+ # source://lumberjack//lib/lumberjack/formatter/id_formatter.rb#8
733
+ class Lumberjack::Formatter::IdFormatter
734
+ # @param id_attribute [Symbol, String] The attribute to use as the id.
735
+ # @return [IdFormatter] a new instance of IdFormatter
736
+ #
737
+ # source://lumberjack//lib/lumberjack/formatter/id_formatter.rb#10
738
+ def initialize(id_attribute = T.unsafe(nil)); end
739
+
740
+ # source://lumberjack//lib/lumberjack/formatter/id_formatter.rb#14
741
+ def call(obj); end
742
+ end
743
+
744
+ # Format an object by calling +inspect+ on it.
745
+ #
746
+ # source://lumberjack//lib/lumberjack/formatter/inspect_formatter.rb#6
747
+ class Lumberjack::Formatter::InspectFormatter
748
+ # source://lumberjack//lib/lumberjack/formatter/inspect_formatter.rb#7
749
+ def call(obj); end
750
+ end
751
+
752
+ # No-op formatter that just returns the object itself.
753
+ #
754
+ # source://lumberjack//lib/lumberjack/formatter/object_formatter.rb#6
755
+ class Lumberjack::Formatter::ObjectFormatter
756
+ # source://lumberjack//lib/lumberjack/formatter/object_formatter.rb#7
757
+ def call(obj); end
758
+ end
759
+
760
+ # Format an object with it's pretty print method.
761
+ #
762
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#9
763
+ class Lumberjack::Formatter::PrettyPrintFormatter
764
+ # Create a new formatter. The maximum width of the message can be specified with the width
765
+ # parameter (defaults to 79 characters).
766
+ #
767
+ # @param width [Integer] The maximum width of the message.
768
+ # @return [PrettyPrintFormatter] a new instance of PrettyPrintFormatter
769
+ #
770
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#16
771
+ def initialize(width = T.unsafe(nil)); end
772
+
773
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#20
774
+ def call(obj); end
775
+
776
+ # Returns the value of attribute width.
777
+ #
778
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#10
779
+ def width; end
780
+
781
+ # Sets the attribute width
782
+ #
783
+ # @param value the value to set the attribute width to.
784
+ #
785
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#10
786
+ def width=(_arg0); end
787
+ end
788
+
789
+ # Format an object by calling `to_s` on it.
790
+ #
791
+ # source://lumberjack//lib/lumberjack/formatter/string_formatter.rb#6
792
+ class Lumberjack::Formatter::StringFormatter
793
+ # source://lumberjack//lib/lumberjack/formatter/string_formatter.rb#7
794
+ def call(obj); end
795
+ end
796
+
797
+ # Format an object by calling `to_s` on it and stripping leading and trailing whitespace.
798
+ #
799
+ # source://lumberjack//lib/lumberjack/formatter/strip_formatter.rb#6
800
+ class Lumberjack::Formatter::StripFormatter
801
+ # source://lumberjack//lib/lumberjack/formatter/strip_formatter.rb#7
802
+ def call(obj); end
803
+ end
804
+
805
+ # Dereference arrays and hashes and recursively call formatters on each element.
806
+ #
807
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#8
808
+ class Lumberjack::Formatter::StructuredFormatter
809
+ # @param formatter [Formatter] The formatter to call on each element
810
+ # in the structure.
811
+ # @return [StructuredFormatter] a new instance of StructuredFormatter
812
+ #
813
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#14
814
+ def initialize(formatter = T.unsafe(nil)); end
815
+
816
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#18
817
+ def call(obj); end
818
+
819
+ private
820
+
821
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#24
822
+ def call_with_references(obj, references); end
823
+
824
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#50
825
+ def with_object_reference(obj, references); end
826
+ end
827
+
828
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#9
829
+ class Lumberjack::Formatter::StructuredFormatter::RecusiveReferenceError < ::StandardError; end
830
+
831
+ # Truncate a string object to a specific length. This is useful
832
+ # for formatting messages when there is a limit on the number of
833
+ # characters that can be logged per message. This formatter should
834
+ # only be used when necessary since it is a lossy formatter.
835
+ #
836
+ # When a string is truncated, it will have a unicode ellipsis
837
+ # character (U+2026) appended to the end of the string.
838
+ #
839
+ # source://lumberjack//lib/lumberjack/formatter/truncate_formatter.rb#12
840
+ class Lumberjack::Formatter::TruncateFormatter
841
+ # @param length [Integer] The maximum length of the string (defaults to 32K)
842
+ # @return [TruncateFormatter] a new instance of TruncateFormatter
843
+ #
844
+ # source://lumberjack//lib/lumberjack/formatter/truncate_formatter.rb#14
845
+ def initialize(length = T.unsafe(nil)); end
846
+
847
+ # source://lumberjack//lib/lumberjack/formatter/truncate_formatter.rb#18
848
+ def call(obj); end
849
+ end
850
+
851
+ # source://lumberjack//lib/lumberjack.rb#10
852
+ Lumberjack::LINE_SEPARATOR = T.let(T.unsafe(nil), String)
853
+
854
+ # An entry in a log is a data structure that captures the log message as well as
855
+ # information about the system that logged the message.
856
+ #
857
+ # source://lumberjack//lib/lumberjack/log_entry.rb#6
858
+ class Lumberjack::LogEntry
859
+ # Create a new log entry.
860
+ #
861
+ # @param time [Time] The time the log entry was created.
862
+ # @param severity [Integer, String] The severity of the log entry.
863
+ # @param message [String] The message to log.
864
+ # @param progname [String] The name of the program that created the log entry.
865
+ # @param pid [Integer] The process id of the program that created the log entry.
866
+ # @param tags [Hash] A hash of tags to associate with the log entry.
867
+ # @return [LogEntry] a new instance of LogEntry
868
+ #
869
+ # source://lumberjack//lib/lumberjack/log_entry.rb#21
870
+ def initialize(time, severity, message, progname, pid, tags); end
871
+
872
+ # source://lumberjack//lib/lumberjack/log_entry.rb#43
873
+ def inspect; end
874
+
875
+ # Returns the value of attribute message.
876
+ #
877
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
878
+ def message; end
879
+
880
+ # Sets the attribute message
881
+ #
882
+ # @param value the value to set the attribute message to.
883
+ #
884
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
885
+ def message=(_arg0); end
886
+
887
+ # Returns the value of attribute pid.
888
+ #
889
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
890
+ def pid; end
891
+
892
+ # Sets the attribute pid
893
+ #
894
+ # @param value the value to set the attribute pid to.
895
+ #
896
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
897
+ def pid=(_arg0); end
898
+
899
+ # Returns the value of attribute progname.
900
+ #
901
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
902
+ def progname; end
903
+
904
+ # Sets the attribute progname
905
+ #
906
+ # @param value the value to set the attribute progname to.
907
+ #
908
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
909
+ def progname=(_arg0); end
910
+
911
+ # Returns the value of attribute severity.
912
+ #
913
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
914
+ def severity; end
915
+
916
+ # Sets the attribute severity
917
+ #
918
+ # @param value the value to set the attribute severity to.
919
+ #
920
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
921
+ def severity=(_arg0); end
922
+
923
+ # source://lumberjack//lib/lumberjack/log_entry.rb#35
924
+ def severity_label; end
925
+
926
+ # Return the tag with the specified name.
927
+ #
928
+ # source://lumberjack//lib/lumberjack/log_entry.rb#62
929
+ def tag(name); end
930
+
931
+ # Returns the value of attribute tags.
932
+ #
933
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
934
+ def tags; end
935
+
936
+ # Sets the attribute tags
937
+ #
938
+ # @param value the value to set the attribute tags to.
939
+ #
940
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
941
+ def tags=(_arg0); end
942
+
943
+ # Returns the value of attribute time.
944
+ #
945
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
946
+ def time; end
947
+
948
+ # Sets the attribute time
949
+ #
950
+ # @param value the value to set the attribute time to.
951
+ #
952
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
953
+ def time=(_arg0); end
954
+
955
+ # source://lumberjack//lib/lumberjack/log_entry.rb#39
956
+ def to_s; end
957
+
958
+ # Deprecated - backward compatibility with 1.0 API
959
+ #
960
+ # source://lumberjack//lib/lumberjack/log_entry.rb#48
961
+ def unit_of_work_id; end
962
+
963
+ # Deprecated - backward compatibility with 1.0 API
964
+ #
965
+ # source://lumberjack//lib/lumberjack/log_entry.rb#53
966
+ def unit_of_work_id=(value); end
967
+
968
+ private
969
+
970
+ # source://lumberjack//lib/lumberjack/log_entry.rb#68
971
+ def tags_to_s; end
972
+ end
973
+
974
+ # source://lumberjack//lib/lumberjack/log_entry.rb#9
975
+ Lumberjack::LogEntry::TIME_FORMAT = T.let(T.unsafe(nil), String)
976
+
977
+ # source://lumberjack//lib/lumberjack/log_entry.rb#11
978
+ Lumberjack::LogEntry::UNIT_OF_WORK_ID = T.let(T.unsafe(nil), String)
979
+
980
+ # Logger is a thread safe logging object. It has a compatible API with the Ruby
981
+ # standard library Logger class, the Log4r gem, and ActiveSupport::BufferedLogger.
982
+ #
983
+ # === Example
984
+ #
985
+ # logger = Lumberjack::Logger.new
986
+ # logger.info("Starting processing")
987
+ # logger.debug("Processing options #{options.inspect}")
988
+ # logger.fatal("OMG the application is on fire!")
989
+ #
990
+ # Log entries are written to a logging Device if their severity meets or exceeds the log level.
991
+ #
992
+ # Devices may use buffers internally and the log entries are not guaranteed to be written until you call
993
+ # the +flush+ method. Sometimes this can result in problems when trying to track down extraordinarily
994
+ # long running sections of code since it is likely that none of the messages logged before the long
995
+ # running code will appear in the log until the entire process finishes. You can set the +:flush_seconds+
996
+ # option on the constructor to force the device to be flushed periodically. This will create a new
997
+ # monitoring thread, but its use is highly recommended.
998
+ #
999
+ # Each log entry records the log message and severity along with the time it was logged, the
1000
+ # program name, process id, and unit of work id. The message will be converted to a string, but
1001
+ # otherwise, it is up to the device how these values are recorded. Messages are converted to strings
1002
+ # using a Formatter associated with the logger.
1003
+ #
1004
+ # source://lumberjack//lib/lumberjack/logger.rb#27
1005
+ class Lumberjack::Logger
1006
+ include ::Lumberjack::Severity
1007
+
1008
+ # Create a new logger to log to a Device.
1009
+ #
1010
+ # The +device+ argument can be in any one of several formats.
1011
+ #
1012
+ # If it is a Device object, that object will be used.
1013
+ # If it has a +write+ method, it will be wrapped in a Device::Writer class.
1014
+ # If it is :null, it will be a Null device that won't record any output.
1015
+ # Otherwise, it will be assumed to be file path and wrapped in a Device::LogFile class.
1016
+ #
1017
+ # This method can take the following options:
1018
+ #
1019
+ # * :level - The logging level below which messages will be ignored.
1020
+ # * :formatter - The formatter to use for outputting messages to the log.
1021
+ # * :datetime_format - The format to use for log timestamps.
1022
+ # * :tag_formatter - The TagFormatter to use for formatting tags.
1023
+ # * :progname - The name of the program that will be recorded with each log entry.
1024
+ # * :flush_seconds - The maximum number of seconds between flush calls.
1025
+ # * :roll - If the log device is a file path, it will be a Device::DateRollingLogFile if this is set.
1026
+ # * :max_size - If the log device is a file path, it will be a Device::SizeRollingLogFile if this is set.
1027
+ #
1028
+ # All other options are passed to the device constuctor.
1029
+ #
1030
+ # @param device [Lumberjack::Device, Object, Symbol, String] The device to log to.
1031
+ # @param options [Hash] The options for the logger.
1032
+ # @return [Logger] a new instance of Logger
1033
+ #
1034
+ # source://lumberjack//lib/lumberjack/logger.rb#69
1035
+ def initialize(device = T.unsafe(nil), options = T.unsafe(nil)); end
1036
+
1037
+ # Add a message when the severity is not known.
1038
+ #
1039
+ # @param msg [Object] The message to log.
1040
+ # @return [void]
1041
+ #
1042
+ # source://lumberjack//lib/lumberjack/logger.rb#417
1043
+ def <<(msg); end
1044
+
1045
+ # ::Logger compatible method to add a log entry.
1046
+ #
1047
+ # @param severity [Integer, Symbol, String] The severity of the message.
1048
+ # @param message [Object] The message to log.
1049
+ # @param progname [String] The name of the program that is logging the message.
1050
+ # @return [void]
1051
+ #
1052
+ # source://lumberjack//lib/lumberjack/logger.rb#229
1053
+ def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end
1054
+
1055
+ # Add a message to the log with a given severity. The message can be either
1056
+ # passed in the +message+ argument or supplied with a block. This method
1057
+ # is not normally called. Instead call one of the helper functions
1058
+ # +fatal+, +error+, +warn+, +info+, or +debug+.
1059
+ #
1060
+ # The severity can be passed in either as one of the Severity constants,
1061
+ # or as a Severity label.
1062
+ #
1063
+ # @example
1064
+ #
1065
+ # logger.add_entry(Logger::ERROR, exception)
1066
+ # logger.add_entry(Logger::INFO, "Request completed")
1067
+ # logger.add_entry(:warn, "Request took a long time")
1068
+ # logger.add_entry(Logger::DEBUG){"Start processing with options #{options.inspect}"}
1069
+ # @param severity [Integer, Symbol, String] The severity of the message.
1070
+ # @param message [Object] The message to log.
1071
+ # @param progname [String] The name of the program that is logging the message.
1072
+ # @param tags [Hash] The tags to add to the log entry.
1073
+ # @return [void]
1074
+ #
1075
+ # source://lumberjack//lib/lumberjack/logger.rb#188
1076
+ def add_entry(severity, message, progname = T.unsafe(nil), tags = T.unsafe(nil)); end
1077
+
1078
+ # Close the logging device.
1079
+ #
1080
+ # @return [void]
1081
+ #
1082
+ # source://lumberjack//lib/lumberjack/logger.rb#255
1083
+ def close; end
1084
+
1085
+ # Returns +true+ if the logging device is closed.
1086
+ #
1087
+ # @return [Boolean] +true+ if the logging device is closed.
1088
+ #
1089
+ # source://lumberjack//lib/lumberjack/logger.rb#264
1090
+ def closed?; end
1091
+
1092
+ # Get the timestamp format on the device if it has one.
1093
+ #
1094
+ # @return [String, nil] The timestamp format or nil if the device doesn't support it.
1095
+ #
1096
+ # source://lumberjack//lib/lumberjack/logger.rb#91
1097
+ def datetime_format; end
1098
+
1099
+ # Set the timestamp format on the device if it is supported.
1100
+ #
1101
+ # @param format [String] The timestamp format.
1102
+ # @return [void]
1103
+ #
1104
+ # source://lumberjack//lib/lumberjack/logger.rb#99
1105
+ def datetime_format=(format); end
1106
+
1107
+ # Log a +DEBUG+ message. The message can be passed in either the +message+ argument or in a block.
1108
+ #
1109
+ # @param message_or_progname_or_tags [Object] The message to log or progname
1110
+ # if the message is passed in a block.
1111
+ # @param progname_or_tags [String, Hash] The name of the program that is logging the message or tags
1112
+ # if the message is passed in a block.
1113
+ # @return [void]
1114
+ #
1115
+ # source://lumberjack//lib/lumberjack/logger.rb#383
1116
+ def debug(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1117
+
1118
+ # Set the log level to debug.
1119
+ #
1120
+ # @return [void]
1121
+ #
1122
+ # source://lumberjack//lib/lumberjack/logger.rb#397
1123
+ def debug!; end
1124
+
1125
+ # Return +true+ if +DEBUG+ messages are being logged.
1126
+ #
1127
+ # @return [Boolean]
1128
+ #
1129
+ # source://lumberjack//lib/lumberjack/logger.rb#390
1130
+ def debug?; end
1131
+
1132
+ # The device being written to
1133
+ #
1134
+ # source://lumberjack//lib/lumberjack/logger.rb#40
1135
+ def device; end
1136
+
1137
+ # The device being written to
1138
+ #
1139
+ # source://lumberjack//lib/lumberjack/logger.rb#40
1140
+ def device=(_arg0); end
1141
+
1142
+ # Log an +ERROR+ message. The message can be passed in either the +message+ argument or in a block.
1143
+ #
1144
+ # @param message_or_progname_or_tags [Object] The message to log or progname
1145
+ # if the message is passed in a block.
1146
+ # @param progname_or_tags [String, Hash] The name of the program that is logging the message or tags
1147
+ # if the message is passed in a block.
1148
+ # @return [void]
1149
+ #
1150
+ # source://lumberjack//lib/lumberjack/logger.rb#308
1151
+ def error(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1152
+
1153
+ # Set the log level to error.
1154
+ #
1155
+ # @return [void]
1156
+ #
1157
+ # source://lumberjack//lib/lumberjack/logger.rb#322
1158
+ def error!; end
1159
+
1160
+ # Return +true+ if +ERROR+ messages are being logged.
1161
+ #
1162
+ # @return [Boolean]
1163
+ #
1164
+ # source://lumberjack//lib/lumberjack/logger.rb#315
1165
+ def error?; end
1166
+
1167
+ # Log a +FATAL+ message. The message can be passed in either the +message+ argument or in a block.
1168
+ #
1169
+ # @param message_or_progname_or_tags [Object] The message to log or progname
1170
+ # if the message is passed in a block.
1171
+ # @param progname_or_tags [String, Hash] The name of the program that is logging the message or tags
1172
+ # if the message is passed in a block.
1173
+ # @return [void]
1174
+ #
1175
+ # source://lumberjack//lib/lumberjack/logger.rb#283
1176
+ def fatal(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1177
+
1178
+ # Set the log level to fatal.
1179
+ #
1180
+ # @return [void]
1181
+ #
1182
+ # source://lumberjack//lib/lumberjack/logger.rb#297
1183
+ def fatal!; end
1184
+
1185
+ # Return +true+ if +FATAL+ messages are being logged.
1186
+ #
1187
+ # @return [Boolean]
1188
+ #
1189
+ # source://lumberjack//lib/lumberjack/logger.rb#290
1190
+ def fatal?; end
1191
+
1192
+ # Flush the logging device. Messages are not guaranteed to be written until this method is called.
1193
+ #
1194
+ # @return [void]
1195
+ #
1196
+ # source://lumberjack//lib/lumberjack/logger.rb#246
1197
+ def flush; end
1198
+
1199
+ # Get the Lumberjack::Formatter used to format objects for logging as messages.
1200
+ #
1201
+ # @return [Lumberjack::Formatter] The formatter.
1202
+ #
1203
+ # source://lumberjack//lib/lumberjack/logger.rb#145
1204
+ def formatter; end
1205
+
1206
+ # Set the Lumberjack::Formatter used to format objects for logging as messages.
1207
+ #
1208
+ # @param value [Lumberjack::Formatter, Object] The formatter to use.
1209
+ # @return [void]
1210
+ #
1211
+ # source://lumberjack//lib/lumberjack/logger.rb#138
1212
+ def formatter=(value); end
1213
+
1214
+ # Log an +INFO+ message. The message can be passed in either the +message+ argument or in a block.
1215
+ #
1216
+ # @param message_or_progname_or_tags [Object] The message to log or progname
1217
+ # if the message is passed in a block.
1218
+ # @param progname_or_tags [String] The name of the program that is logging the message or tags
1219
+ # if the message is passed in a block.
1220
+ # @return [void]
1221
+ #
1222
+ # source://lumberjack//lib/lumberjack/logger.rb#358
1223
+ def info(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1224
+
1225
+ # Set the log level to info.
1226
+ #
1227
+ # @return [void]
1228
+ #
1229
+ # source://lumberjack//lib/lumberjack/logger.rb#372
1230
+ def info!; end
1231
+
1232
+ # Return +true+ if +INFO+ messages are being logged.
1233
+ #
1234
+ # @return [Boolean]
1235
+ #
1236
+ # source://lumberjack//lib/lumberjack/logger.rb#365
1237
+ def info?; end
1238
+
1239
+ # The time that the device was last flushed.
1240
+ #
1241
+ # source://lumberjack//lib/lumberjack/logger.rb#31
1242
+ def last_flushed_at; end
1243
+
1244
+ # Get the level of severity of entries that are logged. Entries with a lower
1245
+ # severity level will be ignored.
1246
+ #
1247
+ # @return [Integer] The severity level.
1248
+ #
1249
+ # source://lumberjack//lib/lumberjack/logger.rb#109
1250
+ def level; end
1251
+
1252
+ # Set the log level using either an integer level like Logger::INFO or a label like
1253
+ # :info or "info"
1254
+ #
1255
+ # @param value [Integer, Symbol, String] The severity level.
1256
+ # @return [void]
1257
+ #
1258
+ # source://lumberjack//lib/lumberjack/logger.rb#120
1259
+ def level=(value); end
1260
+
1261
+ # ::Logger compatible method to add a log entry.
1262
+ #
1263
+ # @param severity [Integer, Symbol, String] The severity of the message.
1264
+ # @param message [Object] The message to log.
1265
+ # @param progname [String] The name of the program that is logging the message.
1266
+ # @return [void]
1267
+ #
1268
+ # source://lumberjack//lib/lumberjack/logger.rb#229
1269
+ def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end
1270
+
1271
+ # Get the program name associated with log messages.
1272
+ #
1273
+ # @return [String]
1274
+ #
1275
+ # source://lumberjack//lib/lumberjack/logger.rb#460
1276
+ def progname; end
1277
+
1278
+ # Set the name of the program to attach to log entries.
1279
+ #
1280
+ # source://lumberjack//lib/lumberjack/logger.rb#37
1281
+ def progname=(_arg0); end
1282
+
1283
+ # Remove a tag from the current tag context. If this is called inside a block to a
1284
+ # call to `tag`, the tags will only be removed for the duration of that block. Otherwise
1285
+ # they will be removed from the global tags.
1286
+ #
1287
+ # @param tag_names [Array<String, Symbol>] The tags to remove.
1288
+ # @return [void]
1289
+ #
1290
+ # source://lumberjack//lib/lumberjack/logger.rb#493
1291
+ def remove_tag(*tag_names); end
1292
+
1293
+ # Reopen the logging device.
1294
+ #
1295
+ # @param logdev [Object] passed through to the logging device.
1296
+ #
1297
+ # source://lumberjack//lib/lumberjack/logger.rb#271
1298
+ def reopen(logdev = T.unsafe(nil)); end
1299
+
1300
+ # Set the program name that is associated with log messages. If a block
1301
+ # is given, the program name will be valid only within the block.
1302
+ #
1303
+ # @param value [String] The program name to use.
1304
+ # @return [void]
1305
+ #
1306
+ # source://lumberjack//lib/lumberjack/logger.rb#449
1307
+ def set_progname(value, &block); end
1308
+
1309
+ # Get the level of severity of entries that are logged. Entries with a lower
1310
+ # severity level will be ignored.
1311
+ #
1312
+ # @return [Integer] The severity level.
1313
+ #
1314
+ # source://lumberjack//lib/lumberjack/logger.rb#109
1315
+ def sev_threshold; end
1316
+
1317
+ # Set the log level using either an integer level like Logger::INFO or a label like
1318
+ # :info or "info"
1319
+ #
1320
+ # @param value [Integer, Symbol, String] The severity level.
1321
+ # @return [void]
1322
+ #
1323
+ # source://lumberjack//lib/lumberjack/logger.rb#120
1324
+ def sev_threshold=(value); end
1325
+
1326
+ # Silence the logger by setting a new log level inside a block. By default, only +ERROR+ or +FATAL+
1327
+ # messages will be logged.
1328
+ #
1329
+ # @example
1330
+ #
1331
+ # logger.level = Logger::INFO
1332
+ # logger.silence do
1333
+ # do_something # Log level inside the block is +ERROR+
1334
+ # end
1335
+ # @param temporary_level [Integer, String, Symbol] The log level to use inside the block.
1336
+ # @return [Object] The result of the block.
1337
+ #
1338
+ # source://lumberjack//lib/lumberjack/logger.rb#433
1339
+ def silence(temporary_level = T.unsafe(nil), &block); end
1340
+
1341
+ # Set +silencer+ to false to disable silencing the log.
1342
+ #
1343
+ # source://lumberjack//lib/lumberjack/logger.rb#34
1344
+ def silencer; end
1345
+
1346
+ # Set +silencer+ to false to disable silencing the log.
1347
+ #
1348
+ # source://lumberjack//lib/lumberjack/logger.rb#34
1349
+ def silencer=(_arg0); end
1350
+
1351
+ # Set a hash of tags on logger. If a block is given, the tags will only be set
1352
+ # for the duration of the block. If this method is called inside such a block,
1353
+ # the tags will only be defined on the tags in that block. When the parent block
1354
+ # exits, all the tags will be reverted. If there is no block, then the tags will
1355
+ # be defined as global and apply to all log statements.
1356
+ #
1357
+ # @param tags [Hash] The tags to set.
1358
+ # @return [void]
1359
+ #
1360
+ # source://lumberjack//lib/lumberjack/logger.rb#472
1361
+ def tag(tags, &block); end
1362
+
1363
+ # The TagFormatter used for formatting tags for output
1364
+ #
1365
+ # source://lumberjack//lib/lumberjack/logger.rb#43
1366
+ def tag_formatter; end
1367
+
1368
+ # The TagFormatter used for formatting tags for output
1369
+ #
1370
+ # source://lumberjack//lib/lumberjack/logger.rb#43
1371
+ def tag_formatter=(_arg0); end
1372
+
1373
+ # Enable this logger to function like an ActiveSupport::TaggedLogger. This will make the logger
1374
+ # API compatible with ActiveSupport::TaggedLogger and is provided as a means of compatibility
1375
+ # with other libraries that assume they can call the `tagged` method on a logger to add tags.
1376
+ #
1377
+ # The tags added with this method are just strings so they are stored in the logger tags
1378
+ # in an array under the "tagged" tag. So calling `logger.tagged("foo", "bar")` will result
1379
+ # in tags `{"tagged" => ["foo", "bar"]}`.
1380
+ #
1381
+ # @return [Lumberjack::Logger] self.
1382
+ #
1383
+ # source://lumberjack//lib/lumberjack/logger.rb#163
1384
+ def tagged_logger!; end
1385
+
1386
+ # Return all tags in scope on the logger including global tags set on the Lumberjack
1387
+ # context, tags set on the logger, and tags set on the current block for the logger.
1388
+ #
1389
+ # @return [Hash]
1390
+ #
1391
+ # source://lumberjack//lib/lumberjack/logger.rb#506
1392
+ def tags; end
1393
+
1394
+ # Log a message when the severity is not known. Unknown messages will always appear in the log.
1395
+ # The message can be passed in either the +message+ argument or in a block.
1396
+ #
1397
+ # @param message_or_progname_or_tags [Object] The message to log or progname
1398
+ # if the message is passed in a block.
1399
+ # @param progname_or_tags [String, Hash] The name of the program that is logging the message or tags
1400
+ # if the message is passed in a block.
1401
+ # @return [void]
1402
+ #
1403
+ # source://lumberjack//lib/lumberjack/logger.rb#409
1404
+ def unknown(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1405
+
1406
+ # Remove all tags on the current logger and logging context within a block.
1407
+ # You can still set new block scoped tags within theuntagged block and provide
1408
+ # tags on individual log methods.
1409
+ #
1410
+ # @return [void]
1411
+ #
1412
+ # source://lumberjack//lib/lumberjack/logger.rb#521
1413
+ def untagged(&block); end
1414
+
1415
+ # Log a +WARN+ message. The message can be passed in either the +message+ argument or in a block.
1416
+ #
1417
+ # @param message_or_progname_or_tags [Object] The message to log or progname
1418
+ # if the message is passed in a block.
1419
+ # @param progname_or_tags [String, Hash] The name of the program that is logging the message or tags
1420
+ # if the message is passed in a block.
1421
+ # @return [void]
1422
+ #
1423
+ # source://lumberjack//lib/lumberjack/logger.rb#333
1424
+ def warn(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1425
+
1426
+ # Set the log level to warn.
1427
+ #
1428
+ # @return [void]
1429
+ #
1430
+ # source://lumberjack//lib/lumberjack/logger.rb#347
1431
+ def warn!; end
1432
+
1433
+ # Return +true+ if +WARN+ messages are being logged.
1434
+ #
1435
+ # @return [Boolean]
1436
+ #
1437
+ # source://lumberjack//lib/lumberjack/logger.rb#340
1438
+ def warn?; end
1439
+
1440
+ # Adjust the log level during the block execution for the current Fiber only.
1441
+ #
1442
+ # @param severity [Integer, Symbol, String] The severity level.
1443
+ # @return [Object] The result of the block.
1444
+ #
1445
+ # source://lumberjack//lib/lumberjack/logger.rb#130
1446
+ def with_level(severity, &block); end
1447
+
1448
+ private
1449
+
1450
+ # Dereference arguments to log calls so we can have methods with compatibility with ::Logger
1451
+ #
1452
+ # source://lumberjack//lib/lumberjack/logger.rb#539
1453
+ def call_add_entry(severity, message_or_progname_or_tags, progname_or_tags, &block); end
1454
+
1455
+ # Create a thread that will periodically call flush.
1456
+ #
1457
+ # source://lumberjack//lib/lumberjack/logger.rb#627
1458
+ def create_flusher_thread(flush_seconds); end
1459
+
1460
+ # Open a logging device.
1461
+ #
1462
+ # source://lumberjack//lib/lumberjack/logger.rb#596
1463
+ def open_device(device, options); end
1464
+
1465
+ # Set a local value for a thread tied to this object within a block.
1466
+ #
1467
+ # source://lumberjack//lib/lumberjack/logger.rb#585
1468
+ def push_thread_local_value(name, value); end
1469
+
1470
+ # Set a local value for a thread tied to this object.
1471
+ #
1472
+ # source://lumberjack//lib/lumberjack/logger.rb#564
1473
+ def set_thread_local_value(name, value); end
1474
+
1475
+ # Get a local value for a thread tied to this object.
1476
+ #
1477
+ # source://lumberjack//lib/lumberjack/logger.rb#579
1478
+ def thread_local_value(name); end
1479
+
1480
+ # source://lumberjack//lib/lumberjack/logger.rb#617
1481
+ def write_to_device(entry); end
1482
+ end
1483
+
1484
+ # source://lumberjack//lib/lumberjack/rack.rb#4
1485
+ module Lumberjack::Rack; end
1486
+
1487
+ # Middleware to create a global context for Lumberjack for the scope of a rack request.
1488
+ #
1489
+ # source://lumberjack//lib/lumberjack/rack/context.rb#6
1490
+ class Lumberjack::Rack::Context
1491
+ # @return [Context] a new instance of Context
1492
+ #
1493
+ # source://lumberjack//lib/lumberjack/rack/context.rb#7
1494
+ def initialize(app); end
1495
+
1496
+ # source://lumberjack//lib/lumberjack/rack/context.rb#11
1497
+ def call(env); end
1498
+ end
1499
+
1500
+ # Support for using the Rails ActionDispatch request id in the log.
1501
+ # The format is expected to be a random UUID and only the first chunk is used for terseness
1502
+ # if the abbreviated argument is true.
1503
+ #
1504
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#8
1505
+ class Lumberjack::Rack::RequestId
1506
+ # @return [RequestId] a new instance of RequestId
1507
+ #
1508
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#11
1509
+ def initialize(app, abbreviated = T.unsafe(nil)); end
1510
+
1511
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#16
1512
+ def call(env); end
1513
+ end
1514
+
1515
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#9
1516
+ Lumberjack::Rack::RequestId::REQUEST_ID = T.let(T.unsafe(nil), String)
1517
+
1518
+ # source://lumberjack//lib/lumberjack/rack/unit_of_work.rb#5
1519
+ class Lumberjack::Rack::UnitOfWork
1520
+ # @return [UnitOfWork] a new instance of UnitOfWork
1521
+ #
1522
+ # source://lumberjack//lib/lumberjack/rack/unit_of_work.rb#6
1523
+ def initialize(app); end
1524
+
1525
+ # source://lumberjack//lib/lumberjack/rack/unit_of_work.rb#10
1526
+ def call(env); end
1527
+ end
1528
+
1529
+ # The standard severity levels for logging messages.
1530
+ #
1531
+ # source://lumberjack//lib/lumberjack/severity.rb#5
1532
+ module Lumberjack::Severity
1533
+ class << self
1534
+ # Coerce a value to a severity level.
1535
+ #
1536
+ # @param value [Integer, String, Symbol] The value to coerce.
1537
+ # @return [Integer] The severity level.
1538
+ #
1539
+ # source://lumberjack//lib/lumberjack/severity.rb#37
1540
+ def coerce(value); end
1541
+
1542
+ # Convert a severity label to a level.
1543
+ #
1544
+ # @param label [String, Symbol] The severity label to convert.
1545
+ # @return [Integer] The severity level.
1546
+ #
1547
+ # source://lumberjack//lib/lumberjack/severity.rb#29
1548
+ def label_to_level(label); end
1549
+
1550
+ # Convert a severity level to a label.
1551
+ #
1552
+ # @param severity [Integer] The severity level to convert.
1553
+ # @return [String] The severity label.
1554
+ #
1555
+ # source://lumberjack//lib/lumberjack/severity.rb#21
1556
+ def level_to_label(severity); end
1557
+ end
1558
+ end
1559
+
1560
+ # Backward compatibilty with 1.0 API
1561
+ #
1562
+ # source://lumberjack//lib/lumberjack/severity.rb#7
1563
+ Lumberjack::Severity::DEBUG = T.let(T.unsafe(nil), Integer)
1564
+
1565
+ # source://lumberjack//lib/lumberjack/severity.rb#10
1566
+ Lumberjack::Severity::ERROR = T.let(T.unsafe(nil), Integer)
1567
+
1568
+ # source://lumberjack//lib/lumberjack/severity.rb#11
1569
+ Lumberjack::Severity::FATAL = T.let(T.unsafe(nil), Integer)
1570
+
1571
+ # source://lumberjack//lib/lumberjack/severity.rb#8
1572
+ Lumberjack::Severity::INFO = T.let(T.unsafe(nil), Integer)
1573
+
1574
+ # source://lumberjack//lib/lumberjack/severity.rb#14
1575
+ Lumberjack::Severity::SEVERITY_LABELS = T.let(T.unsafe(nil), Array)
1576
+
1577
+ # source://lumberjack//lib/lumberjack/severity.rb#12
1578
+ Lumberjack::Severity::UNKNOWN = T.let(T.unsafe(nil), Integer)
1579
+
1580
+ # source://lumberjack//lib/lumberjack/severity.rb#9
1581
+ Lumberjack::Severity::WARN = T.let(T.unsafe(nil), Integer)
1582
+
1583
+ # Class for formatting tags. You can register a default formatter and tag
1584
+ # name specific formatters. Formatters can be either `Lumberjack::Formatter`
1585
+ # objects or any object that responds to `call`.
1586
+ #
1587
+ # tag_formatter = Lumberjack::TagFormatter.new.default(Lumberjack::Formatter.new)
1588
+ # tag_formatter.add(["password", "email"]) { |value| "***" }
1589
+ # tag_formatter.add("finished_at", Lumberjack::Formatter::DateTimeFormatter.new("%Y-%m-%dT%H:%m:%S%z"))
1590
+ #
1591
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#11
1592
+ class Lumberjack::TagFormatter
1593
+ # @return [TagFormatter] a new instance of TagFormatter
1594
+ #
1595
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#12
1596
+ def initialize; end
1597
+
1598
+ # Add a formatter for specific tag names. This can either be a Lumberjack::Formatter
1599
+ # or an object that responds to `call` or a block. The default formatter will not be
1600
+ # applied.
1601
+ #
1602
+ # @param names [String, Array<String>] The tag names to apply the formatter to.
1603
+ # @param formatter [Lumberjack::Formatter, #call, nil] The formatter to use.
1604
+ # If this is nil, then the block will be used as the formatter.
1605
+ # @return [Lumberjack::TagFormatter] self
1606
+ #
1607
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#46
1608
+ def add(names, formatter = T.unsafe(nil), &block); end
1609
+
1610
+ # Remove all formatters.
1611
+ #
1612
+ # @return [Lumberjack::TagFormatter] self
1613
+ #
1614
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#73
1615
+ def clear; end
1616
+
1617
+ # Add a default formatter applied to all tag values. This can either be a Lumberjack::Formatter
1618
+ # or an object that responds to `call` or a block.
1619
+ #
1620
+ # @param formatter [Lumberjack::Formatter, #call, nil] The formatter to use.
1621
+ # If this is nil, then the block will be used as the formatter.
1622
+ # @return [Lumberjack::TagFormatter] self
1623
+ #
1624
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#23
1625
+ def default(formatter = T.unsafe(nil), &block); end
1626
+
1627
+ # Format a hash of tags using the formatters
1628
+ #
1629
+ # @param tags [Hash] The tags to format.
1630
+ # @return [Hash] The formatted tags.
1631
+ #
1632
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#83
1633
+ def format(tags); end
1634
+
1635
+ # Remove formatters for specific tag names. The default formatter will still be applied.
1636
+ #
1637
+ # @param names [String, Array<String>] The tag names to remove the formatter from.
1638
+ # @return [Lumberjack::TagFormatter] self
1639
+ #
1640
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#63
1641
+ def remove(names); end
1642
+
1643
+ # Remove the default formatter.
1644
+ #
1645
+ # @return [Lumberjack::TagFormatter] self
1646
+ #
1647
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#33
1648
+ def remove_default; end
1649
+
1650
+ private
1651
+
1652
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#104
1653
+ def dereference_formatter(formatter); end
1654
+ end
1655
+
1656
+ # Methods to make Lumberjack::Logger API compatible with ActiveSupport::TaggedLogger.
1657
+ #
1658
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#8
1659
+ module Lumberjack::TaggedLoggerSupport
1660
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#62
1661
+ def clear_tags!; end
1662
+
1663
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#56
1664
+ def pop_tags(size = T.unsafe(nil)); end
1665
+
1666
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#52
1667
+ def push_tags(*tags); end
1668
+
1669
+ # Compatibility with ActiveSupport::TaggedLogging which only supports adding tags as strings.
1670
+ # If a tag looks like "key:value" or "key=value", it will be added as a key value pair.
1671
+ # Otherwise it will be appended to a list named "tagged".
1672
+ #
1673
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#43
1674
+ def tagged(*tags, &block); end
1675
+ end
1676
+
1677
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#9
1678
+ class Lumberjack::TaggedLoggerSupport::Formatter
1679
+ extend ::Forwardable
1680
+
1681
+ # @return [Formatter] a new instance of Formatter
1682
+ #
1683
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#13
1684
+ def initialize(formatter:, logger:); end
1685
+
1686
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#35
1687
+ def __formatter; end
1688
+
1689
+ # source://forwardable/1.3.3/forwardable.rb#231
1690
+ def clear_tags!(*args, **_arg1, &block); end
1691
+
1692
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#19
1693
+ def current_tags; end
1694
+
1695
+ # source://forwardable/1.3.3/forwardable.rb#231
1696
+ def pop_tags(*args, **_arg1, &block); end
1697
+
1698
+ # source://forwardable/1.3.3/forwardable.rb#231
1699
+ def push_tags(*args, **_arg1, &block); end
1700
+
1701
+ # source://forwardable/1.3.3/forwardable.rb#231
1702
+ def tagged(*args, **_arg1, &block); end
1703
+
1704
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#28
1705
+ def tags_text; end
1706
+ end
1707
+
1708
+ # Monkey patch for ActiveSupport::TaggedLogger so it doesn't blow up when
1709
+ # a Lumberjack logger is trying to be wrapped. This module will be automatically
1710
+ # included in ActiveSupport::TaggedLogger if activesupport is already loaded.
1711
+ #
1712
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#7
1713
+ module Lumberjack::TaggedLogging
1714
+ mixes_in_class_methods ::Lumberjack::TaggedLogging::ClassMethods
1715
+
1716
+ class << self
1717
+ # @private
1718
+ #
1719
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#9
1720
+ def included(base); end
1721
+ end
1722
+ end
1723
+
1724
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#14
1725
+ module Lumberjack::TaggedLogging::ClassMethods
1726
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#15
1727
+ def new(logger); end
1728
+ end
1729
+
1730
+ # source://lumberjack//lib/lumberjack/tags.rb#4
1731
+ class Lumberjack::Tags
1732
+ class << self
1733
+ # Ensure keys are strings and expand any values in a hash that are Proc's by calling them and replacing
1734
+ # the value with the result. This allows setting global tags with runtime values.
1735
+ #
1736
+ # @param hash [Hash] The hash to transform.
1737
+ # @return [Hash] The hash with string keys and expanded values.
1738
+ #
1739
+ # source://lumberjack//lib/lumberjack/tags.rb#31
1740
+ def expand_runtime_values(hash); end
1741
+
1742
+ # Transform hash keys to strings. This method exists for optimization and backward compatibility.
1743
+ # If a hash already has string keys, it will be returned as is.
1744
+ #
1745
+ # @param hash [Hash] The hash to transform.
1746
+ # @return [Hash] The hash with string keys.
1747
+ #
1748
+ # source://lumberjack//lib/lumberjack/tags.rb#11
1749
+ def stringify_keys(hash); end
1750
+ end
1751
+ end
1752
+
1753
+ # A template converts entries to strings. Templates can contain the following place holders to
1754
+ # reference log entry values:
1755
+ #
1756
+ # * :time
1757
+ # * :severity
1758
+ # * :progname
1759
+ # * :tags
1760
+ # * :message
1761
+ #
1762
+ # Any other words prefixed with a colon will be substituted with the value of the tag with that name.
1763
+ # If your tag name contains characters other than alpha numerics and the underscore, you must surround it
1764
+ # with curly brackets: `:{http.request-id}`.
1765
+ #
1766
+ # source://lumberjack//lib/lumberjack/template.rb#16
1767
+ class Lumberjack::Template
1768
+ # Create a new template from the markup. The +first_line+ argument is used to format only the first
1769
+ # line of a message. Additional lines will be added to the message unformatted. If you wish to format
1770
+ # the additional lines, use the :additional_lines options to specify a template. Note that you'll need
1771
+ # to provide the line separator character in this template if you want to keep the message on multiple lines.
1772
+ #
1773
+ # The time will be formatted as YYYY-MM-DDTHH:MM:SSS.SSS by default. If you wish to change the format, you
1774
+ # can specify the :time_format option which can be either a time format template as documented in
1775
+ # +Time#strftime+ or the values +:milliseconds+ or +:microseconds+ to use the standard format with the
1776
+ # specified precision.
1777
+ #
1778
+ # Messages will have white space stripped from both ends.
1779
+ #
1780
+ # @param first_line [String] The template to use to format the first line of a message.
1781
+ # @param options [Hash] The options for the template.
1782
+ # @return [Template] a new instance of Template
1783
+ #
1784
+ # source://lumberjack//lib/lumberjack/template.rb#36
1785
+ def initialize(first_line, options = T.unsafe(nil)); end
1786
+
1787
+ # Convert an entry into a string using the template.
1788
+ #
1789
+ # @param entry [Lumberjack::LogEntry] The entry to convert to a string.
1790
+ # @return [String] The entry converted to a string.
1791
+ #
1792
+ # source://lumberjack//lib/lumberjack/template.rb#68
1793
+ def call(entry); end
1794
+
1795
+ # Get the format used to format the time.
1796
+ #
1797
+ # @return [String]
1798
+ #
1799
+ # source://lumberjack//lib/lumberjack/template.rb#60
1800
+ def datetime_format; end
1801
+
1802
+ # Set the format used to format the time.
1803
+ #
1804
+ # @param format [String] The format to use to format the time.
1805
+ #
1806
+ # source://lumberjack//lib/lumberjack/template.rb#48
1807
+ def datetime_format=(format); end
1808
+
1809
+ private
1810
+
1811
+ # Compile the template string into a value that can be used with sprintf.
1812
+ #
1813
+ # source://lumberjack//lib/lumberjack/template.rb#118
1814
+ def compile(template); end
1815
+
1816
+ # source://lumberjack//lib/lumberjack/template.rb#98
1817
+ def tag_args(tags, tag_vars); end
1818
+ end
1819
+
1820
+ # source://lumberjack//lib/lumberjack/template.rb#19
1821
+ Lumberjack::Template::MICROSECOND_TIME_FORMAT = T.let(T.unsafe(nil), String)
1822
+
1823
+ # source://lumberjack//lib/lumberjack/template.rb#18
1824
+ Lumberjack::Template::MILLISECOND_TIME_FORMAT = T.let(T.unsafe(nil), String)
1825
+
1826
+ # source://lumberjack//lib/lumberjack/template.rb#20
1827
+ Lumberjack::Template::PLACEHOLDER_PATTERN = T.let(T.unsafe(nil), Regexp)
1828
+
1829
+ # source://lumberjack//lib/lumberjack/template.rb#17
1830
+ Lumberjack::Template::TEMPLATE_ARGUMENT_ORDER = T.let(T.unsafe(nil), Array)