lib/instana/base.rb in instana-1.9.5 vs lib/instana/base.rb in instana-1.9.6
- old
+ new
@@ -1,7 +1,7 @@
+require "logger"
require "instana/version"
-require 'instana/logger'
require "instana/util"
require "instana/helpers"
module Instana
class << self
@@ -43,7 +43,28 @@
end
end
end
# Setup the logger as early as possible
-::Instana.logger = ::Instana::XLogger.new(STDOUT)
+
+# Default Logger outputs to STDOUT
+::Instana.logger = Logger.new(STDOUT)
+
+# Can instead log to a file that is rotated every 10M
+# ::Instana.logger = Logger.new("instana.log", 10, 1073741824)
+
+if ENV.key?('INSTANA_GEM_TEST')
+ ::Instana.logger.level = Logger::DEBUG
+elsif ENV.key?('INSTANA_GEM_DEV') || ENV.key?('INSTANA_DEBUG')
+ ::Instana.logger.level = Logger::DEBUG
+elsif ENV.key?('INSTANA_QUIET')
+ ::Instana.logger.level = Logger::FATAL
+else
+ ::Instana.logger.level = Logger::WARN
+end
+
+::Instana.logger.formatter = proc do |severity, datetime, progname, msg|
+ "#{datetime}: #{severity.rjust(5)} Instana: #{progname} #{msg}\n"
+end
+
+
::Instana.logger.info "Stan is on the scene. Starting Instana instrumentation version #{::Instana::VERSION}"