lib/logdna.rb in logdna-1.2.0 vs lib/logdna.rb in logdna-1.3.0
- old
+ new
@@ -19,15 +19,16 @@
@app = opts[:app] || 'default'
@level = opts[:level] || 'INFO'
@env = opts[:env]
@meta = opts[:meta]
@@client = nil unless defined? @@client
-
+
+ endpoint = opts[:endpoint] || Resources::ENDPOINT
hostname = opts[:hostname] || Socket.gethostname
ip = opts.key?(:ip) ? "&ip=#{opts[:ip]}" : ''
mac = opts.key?(:mac) ? "&mac=#{opts[:mac]}" : ''
- url = "#{Resources::ENDPOINT}?hostname=#{hostname}#{mac}#{ip}"
+ url = "#{endpoint}?hostname=#{hostname}#{mac}#{ip}"
begin
if (hostname.size > Resources::MAX_INPUT_LENGTH || @app.size > Resources::MAX_INPUT_LENGTH )
raise MaxLengthExceeded.new
end
@@ -81,9 +82,10 @@
@level = value
end
def log(msg=nil, opts={})
loggerExist?
+ message = msg
message = yield if msg.nil? && block_given?
@response = @@client.buffer(message, default_opts.merge(opts).merge({
timestamp: (Time.now.to_f * 1000).to_i
}))
'Saved'