Skip to content

Commit

Permalink
Tag all logged messages through Makara's logger with [Makara]
Browse files Browse the repository at this point in the history
  • Loading branch information
rosa committed Mar 20, 2018
1 parent c8029b0 commit 5b1f0a7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/makara/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Cache
class << self

def store=(store)
Logging::Logger.log deprecation_warning, :warn
Makara::Logging::Logger.log deprecation_warning, :warn
end

private
Expand Down
4 changes: 2 additions & 2 deletions lib/makara/config_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def database_from_path
# NOTE: Does not use ENV['DATABASE_URL']
def self.merge_and_resolve_default_url_config(config)
if ENV['DATABASE_URL']
Logging::Logger.log "Please rename DATABASE_URL to use in the database.yml", :warn
Makara::Logging::Logger.log "Please rename DATABASE_URL to use in the database.yml", :warn
end
return config unless config.key?(:url)
url = config[:url]
Expand Down Expand Up @@ -203,7 +203,7 @@ def sanitize_id(id)

id.gsub(/[\|:]/, '').tap do |sanitized_id|
if sanitized_id.size != id.size
Logging::Logger.log "Proxy id '#{id}' changed to '#{sanitized_id}'", :warn
Makara::Logging::Logger.log "Proxy id '#{id}' changed to '#{sanitized_id}'", :warn
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/makara/error_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def handle(connection)

def gracefully(connection, e)
err = Makara::Errors::BlacklistConnection.new(connection, e)
::Makara::Logging::Logger.log("[Makara] Gracefully handling: #{err}")
::Makara::Logging::Logger.log("Gracefully handling: #{err}")
raise err
end


def harshly(e)
::Makara::Logging::Logger.log("[Makara] Harshly handling: #{e}\n#{e.backtrace.join("\n\t")}")
::Makara::Logging::Logger.log("Harshly handling: #{e}\n#{e.backtrace.join("\n\t")}")
raise e
end

Expand Down
2 changes: 1 addition & 1 deletion lib/makara/logging/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Logger
class << self

def log(msg, format = :error)
logger.send(format, msg) if logger
logger.send(format, "[Makara] #{msg}") if logger
end

def logger
Expand Down

0 comments on commit 5b1f0a7

Please sign in to comment.