public void log(ServiceReference sr, int level, String message, Throwable exception) {

        switch (level) {
        case LOG_DEBUG:
            if (delegate.isDebugEnabled()) {
                delegate.debug(createMessage(sr, message), exception);
            }
            break;
        case LOG_ERROR:
            if (delegate.isErrorEnabled()) {
                delegate.error(createMessage(sr, message), exception);
            }
            break;
        case LOG_INFO:
            if (delegate.isInfoEnabled()) {
                delegate.info(createMessage(sr, message), exception);
            }
            break;
        case LOG_WARNING:
            if (delegate.isWarnEnabled()) {
                delegate.warn(createMessage(sr, message), exception);
            }
            break;
        default:
            break;
        }
    }
Formats the log message to indicate the service sending it, if known.

@param sr the ServiceReference sending the message.
@param message The message to log.
@return The formatted log message.
osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceImpl.java