lib/logdna.rb in logdna-1.4.2 vs lib/logdna.rb in logdna-1.5.0
- old
+ new
@@ -1,30 +1,32 @@
# frozen_string_literal: true
require "logger"
require "socket"
require "uri"
-require_relative "logdna/client.rb"
-require_relative "logdna/resources.rb"
-require_relative "logdna/version.rb"
+require_relative "logdna/client"
+require_relative "logdna/resources"
+require_relative "logdna/version"
module Logdna
class ValidURLRequired < ArgumentError; end
+
class MaxLengthExceeded < ArgumentError; end
class Ruby < ::Logger
# uncomment line below and line 3 to enforce singleton
# include Singleton
Logger::TRACE = 5
attr_accessor :app, :env, :meta
def initialize(key, opts = {})
+ super(nil, nil, nil)
@app = opts[:app] || "default"
@log_level = opts[:level] || "INFO"
@env = opts[:env]
@meta = opts[:meta]
- @internal_logger = Logger.new(STDOUT)
+ @internal_logger = Logger.new($stdout)
@internal_logger.level = Logger::DEBUG
endpoint = opts[:endpoint] || Resources::ENDPOINT
hostname = opts[:hostname] || Socket.gethostname
if hostname.size > Resources::MAX_INPUT_LENGTH || @app.size > Resources::MAX_INPUT_LENGTH
@@ -123,13 +125,9 @@
@internal_logger.debug("datetime_format not supported in LogDNA logger")
false
end
def close
- @client&.exitout
- end
-
- at_exit do
@client&.exitout
end
end
end