Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Logging can be turned off.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed Dec 30, 2008
1 parent 211e988 commit 9908421
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/paperclip.rb
Expand Up @@ -49,6 +49,8 @@ class << self
# Provides configurability to Paperclip. There are a number of options available, such as:
# * whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of
# an uploaded image. Defaults to true.
# * log: Logs progress to the Rails log. Uses ActiveRecord's logger, so honors
# log levels, etc. Defaults to true.
# * command_path: Defines the path at which to find the command line
# programs if they are not visible to Rails the system's search path. Defaults to
# nil, which uses the first executable found in the user's search path.
Expand All @@ -57,7 +59,8 @@ def options
@options ||= {
:whiny_thumbnails => true,
:image_magick_path => nil,
:command_path => nil
:command_path => nil,
:log => true
}
end

Expand Down
6 changes: 5 additions & 1 deletion lib/paperclip/attachment.rb
Expand Up @@ -256,7 +256,11 @@ def logger
end

def log message
logger.info("[paperclip] #{message}")
logger.info("[paperclip] #{message}") if logging?
end

def logging?
Paperclip.options[:log]
end

def valid_assignment? file #:nodoc:
Expand Down

0 comments on commit 9908421

Please sign in to comment.