./lib/le.rb in le-2.0 vs ./lib/le.rb in le-2.1

- old
+ new

@@ -1,14 +1,5 @@ -#!/usr/bin/env ruby -# coding: utf-8 - -# -# Logentries Ruby monitoring agent -# Copyright 2010,2011 Logentries, Jlizard -# Mark Lacomber <marklacomber@gmail.com> -# - require File.join(File.dirname(__FILE__), 'le', 'host') require 'logger' module Le @@ -18,21 +9,19 @@ self.checkParams(token) host = Le::Host.new(token, local) logger = Logger.new(host) - logger.formatter = host.formatter + if host.respond_to?(:formatter) + logger.formatter = host.formatter + end logger end def self.checkParams(token) - if token == nil - puts "\nLE: Incorrect token parameter for Logentries Plugin!\n" - end - - # Check if the key is valid UUID format - if (token =~ /\A(urn:uuid:)?[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i) == nil - puts "\nLE: It appears the LOGENTRIES_TOKEN you entered is invalid!\n" - end + # Check if the key is valid UUID format + if (token =~ /\A(urn:uuid:)?[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i) == nil + puts "\nLE: It appears the LOGENTRIES_TOKEN you entered is invalid!\n" + end end end