Class: ChromeLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/chrome_logger.rb,
lib/chrome_logger/console.rb,
lib/chrome_logger/railtie.rb,
lib/chrome_logger/version.rb,
lib/chrome_logger/serializer.rb

Defined Under Namespace

Classes: Console, Railtie, Serializer

Constant Summary collapse

DEFAULT_ENV_NAME =
'console'
HEADER =
'X-ChromeLogger-Data'
VERSION =
"0.1.2"

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ChromeLogger

Returns a new instance of ChromeLogger.



16
17
18
# File 'lib/chrome_logger.rb', line 16

def initialize( app )
  @app = app
end

Class Attribute Details

.env_nameObject

Returns the value of attribute env_name.



12
13
14
# File 'lib/chrome_logger.rb', line 12

def env_name
  @env_name
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



6
7
8
# File 'lib/chrome_logger.rb', line 6

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
25
# File 'lib/chrome_logger.rb', line 20

def call( env )
  env[ env_name ] = Console.new
  status , headers , response = app.call env
  headers[ HEADER ] = Serializer.serialize env[ env_name ]
  [ status , headers , response ]
end

#env_nameObject



27
28
29
# File 'lib/chrome_logger.rb', line 27

def env_name
  self.class.env_name
end