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

[core] separate loggers for deprecations/warnings

distinctly styles deprecations for clarity
gives better flexibility for redirecting logs
reduces possibility of missing deprecations because warnings are ignored
This commit is contained in:
geemus 2011-10-19 14:49:34 -05:00
parent b78e61d855
commit 34e6a1105c
55 changed files with 84 additions and 79 deletions

View file

@ -93,7 +93,7 @@ module Fog
class Real
def modify_image_attributes(*params)
Fog::Logger.warning("modify_image_attributes is deprecated, use modify_image_attribute instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("modify_image_attributes is deprecated, use modify_image_attribute instead [light_black](#{caller.first})[/]")
modify_image_attribute(*params)
end

View file

@ -56,7 +56,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('public-ip' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('public-ip' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end
self.filters = filters

View file

@ -51,7 +51,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('key-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('key-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'key-name' => [*filters]}
end
self.filters = filters

View file

@ -57,7 +57,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('group-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('group-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'group-name' => [*filters]}
end
self.filters = filters

View file

@ -57,7 +57,7 @@ module Fog
def all(filters = self.filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('instance-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end
self.filters = filters

View file

@ -19,7 +19,7 @@ module Fog
def all(filters = filters, options = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'snapshot-id' => [*filters]}
end
self.filters = filters

View file

@ -17,7 +17,7 @@ module Fog
def all(filters = self.filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'spot-instance-request-id' => [*filters]}
end
self.filters = filters

View file

@ -64,7 +64,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('volume-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('volume-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'volume-id' => [*filters]}
end
self.filters = filters

View file

@ -104,7 +104,7 @@ module Fog
def save(options = {})
requires :body, :directory, :key
if options != {}
Fog::Logger.warning("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
end
options['x-amz-acl'] ||= @acl if @acl
options['Cache-Control'] = cache_control if cache_control

View file

@ -28,7 +28,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html]
def authorize_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end
@ -46,7 +46,7 @@ module Fog
def authorize_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end

View file

@ -21,7 +21,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAddresses.html]
def describe_addresses(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -38,7 +38,7 @@ module Fog
def describe_addresses(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end

View file

@ -22,7 +22,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html]
def describe_availability_zones(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -39,7 +39,7 @@ module Fog
def describe_availability_zones(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end

View file

@ -60,7 +60,7 @@ module Fog
def describe_images(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_images with #{filters.class} param is deprecated, use describe_images('image-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_images with #{filters.class} param is deprecated, use describe_images('image-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'image-id' => [*filters]}
end

View file

@ -55,7 +55,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html]
def describe_instances(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end
params = {}
@ -81,7 +81,7 @@ module Fog
def describe_instances(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end

View file

@ -21,7 +21,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html]
def describe_key_pairs(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'key-name' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -38,7 +38,7 @@ module Fog
def describe_key_pairs(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'key-name' => [*filters]}
end

View file

@ -21,7 +21,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRegions.html]
def describe_regions(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'region-name' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -38,7 +38,7 @@ module Fog
def describe_regions(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'region-name' => [*filters]}
end

View file

@ -29,7 +29,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstances.html]
def describe_reserved_instances(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'reserved-instances-id' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)

View file

@ -31,7 +31,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html]
def describe_security_groups(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'group-name' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -48,7 +48,7 @@ module Fog
def describe_security_groups(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'group-name' => [*filters]}
end

View file

@ -27,11 +27,11 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html]
def describe_snapshots(filters = {}, options = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'snapshot-id' => [*filters]}
end
unless options.empty?
Fog::Logger.warning("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
end
for key in ['ExecutableBy', 'ImageId', 'Owner', 'RestorableBy']
@ -54,11 +54,11 @@ module Fog
def describe_snapshots(filters = {}, options = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'snapshot-id' => [*filters]}
end
unless options.empty?
Fog::Logger.warning("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
end
response = Excon::Response.new

View file

@ -31,7 +31,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVolumes.html]
def describe_volumes(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'volume-id' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -48,7 +48,7 @@ module Fog
def describe_volumes(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'volume-id' => [*filters]}
end

View file

@ -34,7 +34,7 @@ module Fog
end
def modify_instance_attributes(instance_id, attributes)
Fog::Logger.warning("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
Fog::Logger.deprecation("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
modify_instance_attribute(instance_id, attributes)
end

View file

@ -27,7 +27,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html]
def revoke_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end
@ -45,7 +45,7 @@ module Fog
def revoke_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end

View file

@ -29,7 +29,7 @@ module Fog
# * 'RequestId'
def get_attributes(domain_name, item_name, options = {})
if options.is_a?(Array)
Fog::Logger.warning("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
options = {'AttributeName' => options}
end
options['AttributeName'] ||= []
@ -49,7 +49,7 @@ module Fog
def get_attributes(domain_name, item_name, options = {})
if options.is_a?(Array)
Fog::Logger.warning("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
options['AttributeName'] ||= options if options.is_a?(Array)
end
options['AttributeName'] ||= []

View file

@ -23,7 +23,7 @@ module Fog
# * 'NextToken'<~String> - offset to start with if there are are more domains to list
def select(select_expression, options = {})
if options.is_a?(String)
Fog::Logger.warning("get_attributes with string next_token param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("get_attributes with string next_token param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
options = {'NextToken' => options}
end
options['NextToken'] ||= nil

View file

@ -18,7 +18,7 @@ module Fog
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
get_object_https_url(bucket_name, object_name, expires)
end
@ -27,7 +27,7 @@ module Fog
class Mock # :nodoc:all
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
get_object_https_url(bucket_name, object_name, expires)
end

View file

@ -76,7 +76,7 @@ module Fog
end
def url(params, expires)
Fog::Logger.warning("Fog::Storage::AWS => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::AWS => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
https_url(params, expires)
end

View file

@ -47,17 +47,17 @@ class AWS < Fog::Bin
when :auto_scaling
Fog::AWS::AutoScaling.new
when :cdn
Fog::Logger.warning("AWS[:cdn] is deprecated, use CDN[:aws] instead")
Fog::Logger.warning("AWS[:cdn] is not recommended, use CDN[:aws] for portability")
Fog::CDN.new(:provider => 'AWS')
when :cloud_formation
Fog::AWS::CloudFormation.new
when :cloud_watch
Fog::AWS::CloudWatch.new
when :compute
Fog::Logger.warning("AWS[:compute] is deprecated, use Compute[:aws] instead")
Fog::Logger.warning("AWS[:compute] is not recommended, use Comptue[:aws] for portability")
Fog::Compute.new(:provider => 'AWS')
when :dns
Fog::Logger.warning("AWS[:dns] is deprecated, use DNS[:aws] instead")
Fog::Logger.warning("AWS[:dns] is not recommended, use DNS[:aws] for portability")
Fog::DNS.new(:provider => 'AWS')
when :elasticache
Fog::AWS::Elasticache.new
@ -76,7 +76,7 @@ class AWS < Fog::Bin
when :sqs
Fog::AWS::SQS.new
when :storage
Fog::Logger.warning("AWS[:storage] is deprecated, use Storage[:aws] instead")
Fog::Logger.warning("AWS[:storage] is not recommended, use Storage[:aws] for portability")
Fog::Storage.new(:provider => 'AWS')
when :sns
Fog::AWS::SNS.new

View file

@ -16,10 +16,10 @@ class Bluebox < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Bluebox[:compute] is deprecated, use Compute[:bluebox] instead")
Fog::Logger.warning("Bluebox[:compute] is not recommended, use Compute[:bluebox] for portability")
Fog::Compute.new(:provider => 'Bluebox')
when :dns
Fog::Logger.warning("Bluebox[:storage] is deprecated, use Storage[:bluebox] instead")
Fog::Logger.warning("Bluebox[:dns] is not recommended, use DNS[:bluebox] for portability")
Fog::DNS.new(:provider => 'Bluebox')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

@ -14,7 +14,7 @@ class Brightbox < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Brightbox[:compute] is deprecated, use Compute[:brightbox] instead")
Fog::Logger.warning("Brightbox[:compute] is not recommended, use Compute[:brightbox] for portability")
Fog::Compute.new(:provider => 'Brightbox')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class DNSimple < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::Logger.warning("DNSimple[:dns] is deprecated, use Storage[:dnsimple] instead")
Fog::Logger.warning("DNSimple[:dns] is not recommended, use DNS[:dnsimple] for portability")
Fog::DNS.new(:provider => 'DNSimple')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class DNSMadeEasy < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::Logger.warning("DNSMadeEasy[:dns] is deprecated, use Storage[:dnsmadeeasy] instead")
Fog::Logger.warning("DNSMadeEasy[:dns] is not recommended, use DNS[:dnsmadeeasy] for portability")
Fog::DNS.new(:provider => 'DNSMadeEasy')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Ecloud < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Ecloud[:compute] is deprecated, use Compute[:ecloud] instead")
Fog::Logger.warning("Ecloud[:compute] is not recommended, use Compute[:ecloud] for portability")
Fog::Compute.new(:provider => 'Ecloud')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Glesys < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Glesys[:compute] is deprecated, use Compute[:glesys] instead[/]")
Fog::Logger.warning("Glesys[:compute] is not recommended, use Compute[:glesys] for portability")
Fog::Compute.new(:provider => 'Glesys')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

@ -14,7 +14,7 @@ class GoGrid < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("GoGrid[:compute] is deprecated, use Compute[:gogrid] instead")
Fog::Logger.warning("GoGrid[:compute] is not recommended, use Compute[:gogrid] for portability")
Fog::Compute.new(:provider => 'GoGrid')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Google < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :storage
Fog::Logger.warning("Google[:storage] is deprecated, use Storage[:google] instead")
Fog::Logger.warning("Google[:storage] is not recommended, use Storage[:google] for portability")
Fog::Storage.new(:provider => 'Google')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ module Libvirt # deviates from other bin stuff to accomodate gem
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Libvirt[:compute] is deprecated, use Compute[:libvirt] instead")
Fog::Logger.warning("Libvirt[:compute] is not recommended, use Compute[:libvirt] for portability")
Fog::Compute.new(:provider => 'Libvirt')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -16,10 +16,10 @@ class Linode < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Linode[:compute] is deprecated, use Compute[:linode] instead")
Fog::Logger.warning("Linode[:compute] is not recommended, use Compute[:linode] for portability")
Fog::Compute.new(:provider => 'Linode')
when :dns
Fog::Logger.warning("Linode[:storage] is deprecated, use Storage[:linode] instead")
Fog::Logger.warning("Linode[:dns] is not recommended, use DNS[:linode] for portability")
Fog::DNS.new(:provider => 'Linode')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Local < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :storage
Fog::Logger.warning("Local[:storage] is deprecated, use Storage[:local] instead")
Fog::Logger.warning("Local[:storage] is not recommended, use Storage[:local] for portability")
Fog::Storage.new(:provider => 'Local')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class NewServers < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("NewServers[:compute] is deprecated, use Compute[:newservers] instead")
Fog::Logger.warning("NewServers[:compute] is not recommended, use Compute[:newservers] for portability")
Fog::Compute.new(:provider => 'NewServers')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -16,10 +16,10 @@ class Ninefold < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Ninefold[:compute] is deprecated, use Compute[:ninefold] instead")
Fog::Logger.warning("Ninefold[:compute] is not recommended, use Compute[:ninefold] for portability")
Fog::Compute.new(:provider => 'Ninefold')
when :storage
Fog::Logger.warning("Ninefold[:storage] is deprecated, use Storage[:ninefold] instead")
Fog::Logger.warning("Ninefold[:storage] is not recommended, use Storage[:ninefold] for portability")
Fog::Storage.new(:provider => 'Ninefold')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

@ -14,7 +14,7 @@ class OpenStack < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("OpenStack[:compute] is deprecated, use Compute[:rackspace] instead")
Fog::Logger.warning("OpenStack[:compute] is not recommended, use Compute[:rackspace] for portability")
Fog::Compute.new(:provider => 'OpenStack')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -22,17 +22,17 @@ class Rackspace < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :cdn
Fog::Logger.warning("Rackspace[:cdn] is deprecated, use CDN[:rackspace] instead")
Fog::Logger.warning("Rackspace[:cdn] is not recommended, use CDN[:rackspace] for portability")
Fog::CDN.new(:provider => 'Rackspace')
when :compute
Fog::Logger.warning("Rackspace[:compute] is deprecated, use Compute[:rackspace] instead")
Fog::Logger.warning("Rackspace[:compute] is not recommended, use Compute[:rackspace] for portability")
Fog::Compute.new(:provider => 'Rackspace')
when :dns
Fog::DNS.new(:provider => 'Rackspace')
when :load_balancers
Fog::Rackspace::LoadBalancers.new
when :storage
Fog::Logger.warning("Rackspace[:storage] is deprecated, use Storage[:rackspace] instead")
Fog::Logger.warning("Rackspace[:storage] is not recommended, use Storage[:rackspace] for portability")
Fog::Storage.new(:provider => 'Rackspace')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -16,7 +16,7 @@ class Slicehost < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Slicehost[:compute] is deprecated, use Compute[:slicehost] instead")
Fog::Logger.warning("Slicehost[:compute] is not recommended, use Compute[:slicehost] for portability")
Fog::Compute.new(:provider => 'Slicehost')
when :dns
Fog::Logger.warning("Slicehost[:dns] is deprecated, use Storage[:slicehost] instead")

View file

@ -14,7 +14,7 @@ class StormOnDemand < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("StormOnDemand[:compute] is deprecated, use Compute[:stormondemand] instead")
Fog::Logger.warning("StormOnDemand[:compute] is not recommended, use Compute[:stormondemand] for portability")
Fog::Compute.new(:provider => 'StormOnDemand')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ module VirtualBox # deviates from other bin stuff to accomodate gem
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("VirtualBox[:compute] is deprecated, use Compute[:virtualbox] instead")
Fog::Logger.warning("VirtualBox[:compute] is not recommended, use Compute[:virtualbox] for portability")
Fog::Compute.new(:provider => 'VirtualBox')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ module Vmfusion # deviates from other bin stuff to accomodate gem
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Vmfusion[:compute] is deprecated, use Compute[:Vmfusion] instead")
Fog::Logger.warning("Vmfusion[:compute] is not recommended, use Compute[:vmfusion] for portability")
Fog::Compute.new(:provider => 'Vmfusion')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Voxel < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Voxel[:compute] is deprecated, use Compute[:voxel] instead")
Fog::Logger.warning("Voxel[:comupte] is not recommended, use Compute[:voxel]] for portability")
Fog::Compute.new(:provider => 'Voxel')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Zerigo < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::Logger.warning("Zerigo[:dns] is deprecated, use Storage[:zerigo] instead")
Fog::Logger.warning("Zerigo[:dns] is not recommended, use DNS[:zerigo] for portability")
Fog::DNS.new(:provider => 'Zerigo')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,7 +4,7 @@ module Fog
def deprecate(older, newer)
module_eval <<-EOS, __FILE__, __LINE__
def #{older}(*args)
Fog::Logger.warning("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
send(:#{newer}, *args)
end
EOS
@ -13,7 +13,7 @@ module Fog
def self_deprecate(older, newer)
module_eval <<-EOS, __FILE__, __LINE__
def self.#{older}(*args)
Fog::Logger.warning("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
send(:#{newer}, *args)
end
EOS

View file

@ -2,7 +2,8 @@ module Fog
class Logger
@channels = {
:warning => ::STDOUT
:deprecation => ::STDOUT,
:warning => ::STDOUT
}
def self.[](channel)
@ -17,6 +18,10 @@ module Fog
self.write(:debug, "[light_black][DEBUG] #{message}[/]")
end
def self.deprecation(message)
self.write(:deprecation, "[yellow][DEPRECATION] #{message}[/]")
end
def self.warning(message)
self.write(:warning, "[yellow][WARNING] #{message}[/]")
end

View file

@ -1061,7 +1061,7 @@ module Fog
end
def self.data_reset
Fog::Logger.warning("#{self} => #data_reset is deprecated, use #reset instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("#{self} => #data_reset is deprecated, use #reset instead [light_black](#{caller.first})[/]")
self.reset
end

View file

@ -106,7 +106,7 @@ module Fog
def save(options = {})
requires :body, :directory, :key
if options != {}
Fog::Logger.warning("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
end
options['x-goog-acl'] ||= @acl if @acl
options['Cache-Control'] = cache_control if cache_control

View file

@ -18,7 +18,7 @@ module Fog
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
get_object_https_url(bucket_name, object_name, expires)
end
@ -27,7 +27,7 @@ module Fog
class Mock # :nodoc:all
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
get_object_https_url(bucket_name, object_name, expires)
end

View file

@ -45,7 +45,7 @@ module Fog
end
def url(params, expires)
Fog::Logger.warning("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
https_url(params, expires)
end

View file

@ -15,7 +15,7 @@ module Fog
extend Fog::Terremark::Shared
def self.new(options={})
Fog::Logger.warning("Fog::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe [light_black](#{caller.first})[/]")
unless @required
shared_requires