larryzhao
larryzhao

Reputation: 3213

Paperclip processor - How to use paperclip logger in my own processor?

I am trying to write my own paperclip processor, but how should I log to the paperclip logger?

I tried the following, log 'here is the processor' doesn't put out anything. How should I do that?

module Paperclip
  class MyProcessor < Processor
    include Paperclip::Logger

    def initialize(file, options = {}, attachment = nil)
      super
      @format         = options[:format]
      @current_format = File.extname(@file.path)
      @basename       = File.basename(@file.path, @current_format)
    end

    def make
      log 'here is the processor'
    end
  end
end

Upvotes: 2

Views: 650

Answers (2)

John Kloian
John Kloian

Reputation: 1474

If, in your processor you need to log, the log method is part of the Paperclip module

Paperclip.log "Log something"

https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/logger.rb

Upvotes: 2

flooooo
flooooo

Reputation: 709

Maybe you need to call it this way:

def make
  logger.log 'here is the processor'
end

No possibility to test it here - so cannot promise you anything. :)

Upvotes: 1

Related Questions