lib/chef-api.rb in chef-api-0.2.0 vs lib/chef-api.rb in chef-api-0.2.1
- old
+ new
@@ -1,17 +1,20 @@
require 'json'
+require 'logify'
require 'pathname'
require 'chef-api/version'
+# Do not inflate JSON objects
+JSON.create_id = nil
+
module ChefAPI
autoload :Boolean, 'chef-api/boolean'
autoload :Configurable, 'chef-api/configurable'
autoload :Connection, 'chef-api/connection'
autoload :Defaults, 'chef-api/defaults'
autoload :Error, 'chef-api/errors'
autoload :ErrorCollection, 'chef-api/error_collection'
- autoload :Logger, 'chef-api/logger'
autoload :Resource, 'chef-api/resource'
autoload :Schema, 'chef-api/schema'
autoload :Util, 'chef-api/util'
autoload :Validator, 'chef-api/validator'
@@ -22,10 +25,32 @@
class << self
include ChefAPI::Configurable
#
+ # Set the log level.
+ #
+ # @example Set the log level to :info
+ # ChefAPI.log_level = :info
+ #
+ # @param [Symbol] level
+ # the log level to set
+ #
+ def log_level=(level)
+ Logify.level = level
+ end
+
+ #
+ # Get the current log level.
+ #
+ # @return [Symbol]
+ #
+ def log_level
+ Logify.level
+ end
+
+ #
# The source root of the ChefAPI gem. This is useful when requiring files
# that are relative to the root of the project.
#
# @return [Pathname]
#
@@ -64,13 +89,9 @@
def respond_to_missing?(m, include_private = false)
connection.respond_to?(m) || super
end
end
end
-
-require 'i18n'
-I18n.enforce_available_locales = false
-I18n.load_path << Dir[ChefAPI.root.join('locales', '*.yml').to_s]
# Load the initial default values
ChefAPI.setup