lib/fluent/plugin/out_logentries.rb in fluent-plugin-logentries-0.0.5 vs lib/fluent/plugin/out_logentries.rb in fluent-plugin-logentries-0.1.0

- old
+ new

@@ -9,24 +9,18 @@ config_param :host, :string config_param :port, :integer, :default => 80 config_param :path, :string def configure(conf) - @port = conf['port'] - @host = conf['host'] - @path = conf['path'] - super end def start super end def shutdown - client.close - super end def client @_socket ||= TCPSocket.new @host, @port @@ -39,14 +33,15 @@ # Scan a given directory for logentries tokens def generate_token(path) tokens = {} - Dir[path << "*.token"].each do |file| + Dir[path + "*.token"].each do |file| key = File.basename(file, ".token") #remove path/extension from filename #read the first line, remove unwanted char and close it tokens[key] = File.open(file, &:readline).gsub(/\r\n|\r|\n/, '') end + tokens end # returns the correct token to use for a given tag def get_token(tag, tokens)