Logstash plugin use @logger in new class

New to logstash plugins here. How do you pass the @logger reference into another class within a plugin? The example below but trying to call another class outside and logging cause a failure.

class SecondClass
	@logger.warn("This line causes an error")
end

class LogStash::Filters::ExamplePlugin < LogStash::Filters::Base
...
snip
...

def callSecondClass
  @logger.info("logger works within this class")
  SecondClass
end  

Got it. Had to pull in the logger module

require "logstash/util/loggable"

class SecondClass
        include LogStash::Util::Loggable
	logger.warn("This line causes an error")
end

class LogStash::Filters::ExamplePlugin < LogStash::Filters::Base
...
snip
...

def callSecondClass
  @logger.info("logger works within this class")
  SecondClass
end 

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.