./lib/le/host.rb in le-1.8.1 vs ./lib/le/host.rb in le-1.9

- old
+ new

@@ -1,43 +1,35 @@ -#!/usr/bin/env ruby -# coding: utf-8 - -# -# Logentries Ruby monitoring agent -# Copyright 2010,2011 Logentries, Jlizard -# Mark Lacomber <marklacomber@gmail.com> -# - module Le module Host - - # Creates a new Logentries host, based on a user-key and location of destination file on logentries, - # both must be provided correctly for a connection to be made. def self.new(key, location, local) - Le::Host::HTTPS.new(key, location, local) + Le::Host::HTTP.new(key, location, local) end - module HelperMethods - + module InstanceMethods def formatter proc do |severity, datetime, progname, msg| - message = "#{datetime} " - message << format_message(msg, severity) - end - end + message = "#{datetime} " + message << format_message(msg, severity) + end + end - def format_message(msg_in, severity) - msg_out = "" - msg_out << "severity=#{severity}, " + def format_message(message_in, severity) + message_in = message_in.lstrip - msg_out << msg_in - - msg_out + message_out = "" + message_out = "severity=#{severity}, " + case message_in + when String + message_out << message_in + else + message_out << message_in.inspect + end + message_out end end end end -require File.join(File.dirname(__FILE__), 'host', 'https') +require File.join(File.dirname(__FILE__), 'host', 'http')