try {
// don't construct a Notification if there are no listeners.
if (getLogLevelListenerCount(level) != 0) {
final String notifType = logLevelToNotificationType(level);
final NotificationBuilder builder =
notificationTypeToNotificationBuilder(notifType);
// Notification.getMessage() will be the formatted log record
final String logRecordAsString = formatter.format(logRecord);
final Map<String, Serializable> userData =
logRecordToMap(logRecord, logRecordAsString);
final Notification notif =
builder.buildNewWithMap(logRecordAsString, userData);
debug("privateLoggingHook: sending: " + notif);
sendNotification(notif);
} else {
// debug( "privateLogHook: no listeners for level " + level );