1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #2300 from burns/warn_invalid_args

[core] log warning for unrecognized arguments
This commit is contained in:
Wesley Beary 2013-10-21 10:15:14 -07:00
commit cb8acae792
2 changed files with 5 additions and 6 deletions

View file

@ -17,20 +17,19 @@ module Fog
end end
def self.debug(message) def self.debug(message)
self.write(:debug, "[light_black][DEBUG] #{message}[/]\n") self.write(:debug, "[light_black][fog][DEBUG] #{message}[/]\n")
end end
def self.deprecation(message) def self.deprecation(message)
self.write(:deprecation, "[yellow][DEPRECATION] #{message}[/]\n") self.write(:deprecation, "[yellow][fog][DEPRECATION] #{message}[/]\n")
end end
def self.warning(message) def self.warning(message)
self.write(:warning, "[yellow][WARNING] #{message}[/]\n") self.write(:warning, "[yellow][fog][WARNING] #{message}[/]\n")
end end
def self.write(key, value) def self.write(key, value)
if channel = @channels[key] if channel = @channels[key]
value.gsub(Formatador::INDENT_REGEX, '')
message = if channel.tty? message = if channel.tty?
value.gsub(Formatador::PARSE_REGEX) { "\e[#{Formatador::STYLES[$1.to_sym]}m" }.gsub(Formatador::INDENT_REGEX, '') value.gsub(Formatador::PARSE_REGEX) { "\e[#{Formatador::STYLES[$1.to_sym]}m" }.gsub(Formatador::INDENT_REGEX, '')
else else

View file

@ -211,7 +211,7 @@ module Fog
unless recognizes.empty? unless recognizes.empty?
unrecognized = options.keys - requirements - recognized unrecognized = options.keys - requirements - recognized
unless unrecognized.empty? unless unrecognized.empty?
raise ArgumentError, "Unrecognized arguments: #{unrecognized.join(', ')}" Fog::Logger.warning("Unrecognized arguments: #{unrecognized.join(', ')}")
end end
end end
end end