(Level minimum)
| 159 | } |
| 160 | |
| 161 | private static void enable(Level minimum) { |
| 162 | Level level = effectiveLevel(SELENIUM_LOGGER); |
| 163 | if (level.intValue() > minimum.intValue()) { |
| 164 | SELENIUM_LOGGER.setLevel(minimum); |
| 165 | level = minimum; |
| 166 | } |
| 167 | |
| 168 | Handler handler = installedHandler; |
| 169 | if (handler == null || !isAttached(handler)) { |
| 170 | if (handler != null) { |
| 171 | handler.close(); |
| 172 | } |
| 173 | handler = new ConsoleHandler(); |
| 174 | // Leave INFO and above to the existing handlers so those records are not printed twice. |
| 175 | handler.setFilter(record -> record.getLevel().intValue() < Level.INFO.intValue()); |
| 176 | SELENIUM_LOGGER.addHandler(handler); |
| 177 | installedHandler = handler; |
| 178 | } |
| 179 | handler.setLevel(level); |
| 180 | } |
| 181 | |
| 182 | private static boolean isAttached(Handler handler) { |
| 183 | return Arrays.asList(SELENIUM_LOGGER.getHandlers()).contains(handler); |
no test coverage detected