Use centralized Logger and add instrument methods

This commit is contained in:
Thomas Reynolds 2012-07-15 11:04:45 -07:00
parent 95339dad23
commit de6d7980ac
15 changed files with 126 additions and 61 deletions

View file

@ -46,6 +46,9 @@ module Middleman::CoreExtensions
end
class FrontmatterManager
attr_reader :app
delegate :logger, :to => :app
def initialize(app)
@app = app
@cache = {}
@ -84,7 +87,7 @@ module Middleman::CoreExtensions
begin
data = YAML.load($1)
rescue *YAML_ERRORS => e
puts "YAML Exception: #{e.message}"
logger.error "YAML Exception: #{e.message}"
return false
end
@ -107,7 +110,7 @@ module Middleman::CoreExtensions
json = ($1+$2).sub(";;;", "{").sub(";;;", "}")
data = ActiveSupport::JSON.decode(json)
rescue => e
puts "JSON Exception: #{e.message}"
logger.error "JSON Exception: #{e.message}"
return false
end