Class: Jekyll::Stevenson
- Inherits:
-
Logger
- Object
- Logger
- Jekyll::Stevenson
- Defined in:
- lib/jekyll/stevenson.rb
Instance Method Summary collapse
- #add(severity, message = nil, progname = nil) ⇒ Object
- #close ⇒ Object
-
#error(progname = nil, &block) ⇒ Object
Log an
ERROR
message. -
#initialize ⇒ Stevenson
constructor
A new instance of Stevenson.
-
#warn(progname = nil, &block) ⇒ Object
Log a
WARN
message.
Constructor Details
#initialize ⇒ Stevenson
Returns a new instance of Stevenson.
5 6 7 8 9 10 |
# File 'lib/jekyll/stevenson.rb', line 5 def initialize formatter = proc do |_, _, _, msg| msg.to_s end super($stdout, :formatter => formatter) end |
Instance Method Details
#add(severity, message = nil, progname = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jekyll/stevenson.rb', line 12 def add(severity, = nil, progname = nil) severity ||= UNKNOWN @logdev = logdevice(severity) return true if @logdev.nil? || severity < @level progname ||= @progname if .nil? if block_given? = yield else = progname progname = @progname end end @logdev.puts( (format_severity(severity), Time.now, progname, ) ) true end |
#close ⇒ Object
43 44 45 |
# File 'lib/jekyll/stevenson.rb', line 43 def close # No LogDevice in use end |
#error(progname = nil, &block) ⇒ Object
Log an ERROR
message
39 40 41 |
# File 'lib/jekyll/stevenson.rb', line 39 def error(progname = nil, &block) add(ERROR, nil, progname.red, &block) end |
#warn(progname = nil, &block) ⇒ Object
Log a WARN
message
34 35 36 |
# File 'lib/jekyll/stevenson.rb', line 34 def warn(progname = nil, &block) add(WARN, nil, progname.yellow, &block) end |