// Path: src/main/java/nodebox/Log.java
// public class Log {
//     private static final Logger LOGGER = java.util.logging.Logger.getGlobal();
// 
//     static {
//         try {
//             // Initialize logging directory
//             AppDirs.ensureUserLogDir();
//             File logDir = AppDirs.getUserLogDir();
// 
//             // Initialize file logging
//             FileHandler handler = new FileHandler(logDir.getAbsolutePath() + "/nodebox-%u.log");
//             handler.setFormatter(new SimpleFormatter());
//             LOGGER.addHandler(handler);
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public static void info(String message) {
//         LOGGER.log(Level.INFO, message);
//     }
// 
//     public static void warn(String message) {
//         LOGGER.log(Level.WARNING, message);
//     }
// 
//     public static void warn(String message, Throwable t) {
//         LOGGER.log(Level.WARNING, message, t);
//     }
// 
//     public static void error(String message) {
//         LOGGER.log(Level.SEVERE, message);
//     }
// 
//     public static void error(String message, Throwable t) {
//         LOGGER.log(Level.SEVERE, message, t);
//     }
// 
// }


import nodebox.Log;
import nodebox.ui.Theme;
import org.python.util.PythonInterpreter;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import static com.google.common.base.Preconditions.checkNotNull;
            }
        });
        messagesDocument = consoleMessages.getDocument();
        JScrollPane messagesScroll = new JScrollPane(consoleMessages, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        messagesScroll.setBorder(BorderFactory.createEmptyBorder());

        consolePrompt = new JTextField();
        consolePrompt.setFont(Theme.EDITOR_FONT);
        Keymap defaultKeymap = JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP);
        Keymap keymap = JTextComponent.addKeymap(null, defaultKeymap);
        keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), new EnterAction());
        keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), new HistoryUpAction());
        keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), new HistoryDownAction());
        consolePrompt.setKeymap(keymap);
        consolePrompt.setBorder(new PromptBorder());

        setLayout(new BorderLayout());
        add(messagesScroll, BorderLayout.CENTER);
        add(consolePrompt, BorderLayout.SOUTH);

        interpreter = new PythonInterpreter();
        consolePrompt.requestFocus();
        addFocusListener(this);
        addWindowListener(this);
    }

    private void addMessage(String s, AttributeSet attributes) {
        try {
            messagesDocument.insertString(messagesDocument.getLength(), s, attributes);
        } catch (BadLocationException e) {
// Path: src/main/java/nodebox/Log.java
// public class Log {
//     private static final Logger LOGGER = java.util.logging.Logger.getGlobal();
// 
//     static {
//         try {
//             // Initialize logging directory
//             AppDirs.ensureUserLogDir();
//             File logDir = AppDirs.getUserLogDir();
// 
//             // Initialize file logging
//             FileHandler handler = new FileHandler(logDir.getAbsolutePath() + "/nodebox-%u.log");
//             handler.setFormatter(new SimpleFormatter());
//             LOGGER.addHandler(handler);
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public static void info(String message) {
//         LOGGER.log(Level.INFO, message);
//     }
// 
//     public static void warn(String message) {
//         LOGGER.log(Level.WARNING, message);
//     }
// 
//     public static void warn(String message, Throwable t) {
//         LOGGER.log(Level.WARNING, message, t);
//     }
// 
//     public static void error(String message) {
//         LOGGER.log(Level.SEVERE, message);
//     }
// 
//     public static void error(String message, Throwable t) {
//         LOGGER.log(Level.SEVERE, message, t);
//     }
// 
// }


// Path: src/main/java/nodebox/client/Console.java
import nodebox.Log;
import nodebox.ui.Theme;
import org.python.util.PythonInterpreter;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import static com.google.common.base.Preconditions.checkNotNull;

            }
        });
        messagesDocument = consoleMessages.getDocument();
        JScrollPane messagesScroll = new JScrollPane(consoleMessages, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        messagesScroll.setBorder(BorderFactory.createEmptyBorder());

        consolePrompt = new JTextField();
        consolePrompt.setFont(Theme.EDITOR_FONT);
        Keymap defaultKeymap = JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP);
        Keymap keymap = JTextComponent.addKeymap(null, defaultKeymap);
        keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), new EnterAction());
        keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), new HistoryUpAction());
        keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), new HistoryDownAction());
        consolePrompt.setKeymap(keymap);
        consolePrompt.setBorder(new PromptBorder());

        setLayout(new BorderLayout());
        add(messagesScroll, BorderLayout.CENTER);
        add(consolePrompt, BorderLayout.SOUTH);

        interpreter = new PythonInterpreter();
        consolePrompt.requestFocus();
        addFocusListener(this);
        addWindowListener(this);
    }

    private void addMessage(String s, AttributeSet attributes) {
        try {
            messagesDocument.insertString(messagesDocument.getLength(), s, attributes);
        } catch (BadLocationException e) {
            Log.warn("addMessage: bad location (" + s + ")", e);