Module: NRSER::Log::Formatters::Mixin
- Included in:
- Color
- Defined in:
- lib/nrser/log/formatters/mixin.rb
Overview
A mix-in to include in SemanticLogger::Formatter::Default and subclasses to improve configurability.
Defined Under Namespace
Classes: BodyTokens, HeaderTokens, Tokens
Instance Method Summary collapse
-
#body(*tokens) ⇒ BodyTokens
Get or set the body section tokens.
-
#body=(tokens) ⇒ HeaderTokens
Set the body section format tokens.
-
#header(*tokens) ⇒ HeaderTokens
Get or set the header “tokens” - SemanticLogger::Formatters::Default method names in the order their responses should be joined to form the header section of formatted log messages (time, level, name, etc.).
-
#header=(tokens) ⇒ HeaderTokens
Set the header section format tokens.
Instance Method Details
#body(*tokens) ⇒ BodyTokens
Get or set the body section tokens.
Just like #header, which has details and examples, but for the “body” section of log messages (message, payload, exception).
213 214 215 216 217 218 219 |
# File 'lib/nrser/log/formatters/mixin.rb', line 213 def body *tokens if tokens.empty? @body ||= BodyTokens.new else @body = BodyTokens.new tokens end end |
#body=(tokens) ⇒ HeaderTokens
Set the body section format tokens.
See #header for details and examples of how the header works.
234 235 236 |
# File 'lib/nrser/log/formatters/mixin.rb', line 234 def body= tokens @body = BodyTokens.new tokens end |
#header(*tokens) ⇒ HeaderTokens
Get or set the header “tokens” - SemanticLogger::Formatters::Default method names in the order their responses should be joined to form the header section of formatted log messages (time, level, name, etc.).
172 173 174 175 176 177 178 |
# File 'lib/nrser/log/formatters/mixin.rb', line 172 def header *tokens if tokens.empty? @header ||= HeaderTokens.new else @header = HeaderTokens.new tokens end end |
#header=(tokens) ⇒ HeaderTokens
Set the header section format tokens.
See #header for details and examples of how the header works.
193 194 195 |
# File 'lib/nrser/log/formatters/mixin.rb', line 193 def header= tokens @header = HeaderTokens.new tokens end |