logutil.java

来自「eclise rcp 项目,是非常好的学习源码」· Java 代码 · 共 44 行

JAVA
44
字号
/*******************************************************************************
 * Copyright (c) 2007 Siemens AG, KolbW@re
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Bernd Kolb - initial API and implementation
 *    Kai T鰀ter  - integration
 *******************************************************************************/

package com.siemens.ct.mp3m.utilities;

import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;

/**
 * A Utility class for logging
 */
public class LogUtil {

    public static void logError(String bundleID, Throwable t) {
        logError(bundleID, t.getMessage(), t);
    }

    public static void logError(String bundleID, String message, Throwable t) {
        log(bundleID, message, t, Status.ERROR, Status.OK);
    }

    public static void logError(String bundleID, String message) {
        logError(bundleID, message, null);
    }

    public static void log(String bundleID, String message, Throwable t, int serverity, int code) {
        if (bundleID == null) {
            bundleID = Activator.getDefault().getBundle().getSymbolicName();
        }
        Platform.getLog(Platform.getBundle(bundleID)).log(
                new Status(serverity, bundleID, code, message, t));
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?