Here you can find the source of error(final BundleContext b, final String msg, final Throwable t)
Parameter | Description |
---|---|
b | BundleContext |
msg | String |
t | Throwable |
public static void error(final BundleContext b, final String msg, final Throwable t)
//package com.java2s; //License from project: Apache License import org.osgi.framework.BundleContext; import org.slf4j.Logger; import static org.slf4j.LoggerFactory.getLogger; public class Main { /**/*ww w .j a va2 s. c o m*/ * Logs the message to the bundle's error level. * * @param b {@link BundleContext} * @param msg {@link String} */ public static void error(final BundleContext b, final String msg) { final String symbolicName = b.getBundle().getSymbolicName(); final Logger log = getLogger(symbolicName); log.error(prefix(b, msg)); } /** * Logs the message to the bundle's error level. * * @param b {@link BundleContext} * @param msg {@link String} * @param t {@link Throwable} */ public static void error(final BundleContext b, final String msg, final Throwable t) { final String symbolicName = b.getBundle().getSymbolicName(); final Logger log = getLogger(symbolicName); log.error(prefix(b, msg), t); } /** * Prefixes string {@code s} with the format:<br/> * {@code <symbolicName>: <s>} * * @param b {@link BundleContext} * @param s {@link String} * @return {@link String} */ public static String prefix(final BundleContext b, final String s) { if (s == null) throw new NullPointerException("s cannot be null"); return b.getBundle().getSymbolicName().concat(": ".concat(s)); } }