Skip to content

Commit 9d00826

Browse files
committed
[logging] don't log when APPOPTICS_DEBUG_LEVEL == -1
this reflects oboe's logging behavior, -1 means disabled (manually tested) AO-10683
1 parent fc48eb3 commit 9d00826

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/appoptics_apm/config.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,14 @@ def self.check_env_vars
7474
unless (0..6).include?(AppOpticsAPM::Config[:debug_level])
7575
AppOpticsAPM::Config[:debug_level] = nil
7676
end
77-
# let's use the same debug level for ruby as well
78-
debug_level = ENV['APPOPTICS_DEBUG_LEVEL'] || AppOpticsAPM::Config[:debug_level] || 3
79-
AppOpticsAPM.logger.level = [4 - debug_level.to_i, 0].max
77+
78+
# let's use the same debug level for ruby as well,
79+
debug_level = ENV['APPOPTICS_DEBUG_LEVEL'].to_i || AppOpticsAPM::Config[:debug_level] || 3
80+
if debug_level < 0
81+
AppOpticsAPM.logger.level = 6 # there should be no logging if APPOPTICS_DEBUG_LEVEL == -1
82+
else
83+
AppOpticsAPM.logger.level = [4 - debug_level, 0].max
84+
end
8085

8186
# the verbose setting is only relevant for ruby, ENV['APPOPTICS_GEM_VERBOSE'] overrides
8287
if ENV.key?('APPOPTICS_GEM_VERBOSE')

0 commit comments

Comments
 (0)