Class: Cogger::Formatters::Simple

Inherits:
Abstract
  • Object
show all
Defined in:
lib/cogger/formatters/simple.rb

Overview

Formats simple templates that require minimal processing.

Constant Summary collapse

TEMPLATE =
"[%<id>s] %<message>s"

Constants inherited from Abstract

Abstract::NEW_LINE, Abstract::SANITIZERS

Instance Method Summary collapse

Constructor Details

#initialize(template = TEMPLATE) ⇒ Simple

Returns a new instance of Simple.



9
10
11
12
# File 'lib/cogger/formatters/simple.rb', line 9

def initialize template = TEMPLATE
  super()
  @template = template
end

Instance Method Details

#call(*input) ⇒ Object



14
15
16
17
18
19
# File 'lib/cogger/formatters/simple.rb', line 14

def call(*input)
  *, entry = input
  attributes = sanitize entry, :tagged

  format(template, attributes).tap(&:strip!) << NEW_LINE
end