Package com.aptana.shared_core

Examples of com.aptana.shared_core.SharedCorePlugin


    /**
     * @param errorLevel IStatus.[OK|INFO|WARNING|ERROR]
     * @return CoreException that can be thrown for the given log event
     */
    public static CoreException log(int errorLevel, String message, Throwable e) {
        SharedCorePlugin plugin = SharedCorePlugin.getDefault();
        String id;
        if (plugin == null) {
            id = "SharedCorePlugin";
        } else {
            id = plugin.getBundle().getSymbolicName();
        }

        Status s = new Status(errorLevel, id, errorLevel, message, e);
        CoreException coreException = new CoreException(s);

        Tuple<Integer, String> key = new Tuple<Integer, String>(errorLevel, message);
        synchronized (lastLoggedTime) {
            Long lastLoggedMillis = lastLoggedTime.get(key);
            long currentTimeMillis = System.currentTimeMillis();
            if (lastLoggedMillis != null) {
                if (currentTimeMillis < lastLoggedMillis + (20 * 1000)) {
                    //System.err.println("Skipped report of:"+message);
                    return coreException; //Logged in the last 20 seconds, so, just skip it for now
                }
            }
            lastLoggedTime.put(key, currentTimeMillis);
        }
        try {
            if (plugin != null) {
                plugin.getLog().log(s);
            } else {
                if (DEBUG_LEVEL <= errorLevel) {
                    System.err.println(message);
                    if (e != null) {
                        e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.aptana.shared_core.SharedCorePlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.