Parent

Methods

Yell::Formatter

The Formatter provides a handle to configure your log message style.

Constants

LegacyTable

For standard formatted backwards compatibility

PatternMatcher
Table

Attributes

date_pattern[R]
pattern[R]

Public Class Methods

new( *args, &block ) click to toggle source

Initializes a new +Yell::Formatter+.

Upon initialization it defines a format method. `format` takes a {Yell::Event} instance as agument in order to apply for desired log message formatting.

@example Blank formatter

Formatter.new

@example Formatter with a message pattern

Formatter.new("%d [%5L] %p : %m")

@example Formatter with a message and date pattern

Formatter.new("%d [%5L] %p : %m", "%D %H:%M:%S.%L")

@example Formatter with a message modifier

Formatter.new do |f|
  f.modify(Hash) { |h| "Hash: #{h.inspect}" }
end
# File lib/yell/formatter.rb, line 107
def initialize( *args, &block )
  builder = Builder.new(*args, &block)

  @pattern = builder.pattern
  @date_pattern = builder.date_pattern
  @modifier = builder.modifier

  define_date_method!
  define_call_method!
end

Public Instance Methods

inspect() click to toggle source

Get a pretty string

# File lib/yell/formatter.rb, line 119
def inspect
  "#<#{self.class.name} pattern: #{@pattern.inspect}, date_pattern: #{@date_pattern.inspect}>"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.