void (String text, int line, Color fg, int depth) { if (text == null || text.isEmpty()) return; String inset = " ".repeat(depth); Document doc = myLog.getDocument(); SimpleAttributeSet attr = new SimpleAttributeSet(); StyleConstants.setFontFamily(attr, UIManager.getFont("Label.font").getFontName()); StyleConstants.setFontSize(attr, UIManager.getFont("Label.font").getSize()); StyleConstants.setForeground(attr, fg); try { doc.insertString(doc.getLength(), inset + text + "\n", attr); } catch (BadLocationException e) { LOG.error(e); } scrollToLast(); }