(Level minimum)
| 146 | } |
| 147 | |
| 148 | private static void enable(Level minimum) { |
| 149 | Level level = effectiveLevel(SELENIUM_LOGGER); |
| 150 | if (level.intValue() > minimum.intValue()) { |
| 151 | SELENIUM_LOGGER.setLevel(minimum); |
| 152 | level = minimum; |
| 153 | } |
| 154 | |
| 155 | Handler handler = installedHandler; |
| 156 | if (handler == null || !isAttached(handler)) { |
| 157 | if (handler != null) { |
| 158 | handler.close(); |
| 159 | } |
| 160 | handler = new ConsoleHandler(); |
| 161 | // Leave INFO and above to the existing handlers so those records are not printed twice. |
| 162 | handler.setFilter(record -> record.getLevel().intValue() < Level.INFO.intValue()); |
| 163 | SELENIUM_LOGGER.addHandler(handler); |
| 164 | installedHandler = handler; |
| 165 | } |
| 166 | handler.setLevel(level); |
| 167 | } |
| 168 | |
| 169 | private static boolean isAttached(Handler handler) { |
| 170 | return Arrays.asList(SELENIUM_LOGGER.getHandlers()).contains(handler); |
no test coverage detected