Class: Bridgetown::Rack::Logger

Inherits:
LogWriter
  • Object
show all
Defined in:
bridgetown-core/lib/bridgetown-core/rack/logger.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LogWriter

#close, #error, #warn

Constructor Details

#initialize(*_args) ⇒ Logger

Returns a new instance of Logger.



27
28
29
30
# File 'bridgetown-core/lib/bridgetown-core/rack/logger.rb', line 27

def initialize(*_args)
  super()
  enable_prefix
end

Class Method Details

.message_with_prefix(msg) ⇒ Object



9
10
11
12
13
# File 'bridgetown-core/lib/bridgetown-core/rack/logger.rb', line 9

def self.message_with_prefix(msg)
  #        return if msg.include?("/_bridgetown/live_reload")

  "\e[35m[Server]\e[0m #{msg}"
end

Instance Method Details

#add(severity, message = nil, progname = nil) ⇒ Object



21
22
23
24
25
# File 'bridgetown-core/lib/bridgetown-core/rack/logger.rb', line 21

def add(severity, message = nil, progname = nil)
  return if progname&.include?("/_bridgetown/live_reload")

  super
end

#enable_prefixObject



15
16
17
18
19
# File 'bridgetown-core/lib/bridgetown-core/rack/logger.rb', line 15

def enable_prefix
  @formatter = proc do |_, _, _, msg|
    self.class.message_with_prefix(msg)
  end
end