package fr.jcgay.notification.notifier.growl;

import com.google.code.jgntp.GntpErrorStatus;
import com.google.code.jgntp.GntpListener;
import com.google.code.jgntp.GntpNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

class GntpSlf4jListener implements GntpListener {

    private static final Logger LOGGER = LoggerFactory.getLogger(GntpSlf4jListener.class);

    @Override
    public void onRegistrationSuccess() {
        LOGGER.debug("Client has been successfully registered by Growl");
    }

    @Override
    public void onNotificationSuccess(GntpNotification notification) {
        LOGGER.debug("Notification success: {}", notification);
    }

    @Override
    public void onClickCallback(GntpNotification notification) {

    }

    @Override
    public void onCloseCallback(GntpNotification notification) {

    }

    @Override
    public void onTimeoutCallback(GntpNotification notification) {

    }

    @Override
    public void onRegistrationError(GntpErrorStatus status, String description) {
        LOGGER.error("Growl registration has failed.\n {}: {}", status, description);
    }

    @Override
    public void onNotificationError(GntpNotification notification, GntpErrorStatus status, String description) {
        LOGGER.error("Growl notification has failed.\n {}: {}\n {}", status, description, notification);
    }

    @Override
    public void onCommunicationError(Throwable t) {
        LOGGER.error("Cannot communicate with Growl.", t);
    }
}

@@ -377,16 +377,236 @@
 lass);%0A%0A
+    private static final String OSX_URL = %22https://github.com/jcgay/send-notification/wiki/Growl-(OS-X)%22;%0A    private static final String WINDOWS_URL = %22https://github.com/jcgay/send-notification/wiki/Growl-(Windows)%22;%0A%0A
     @Ove
@@ -1266,24 +1266,30 @@
 OGGER.error(
+error(
 %22Growl regis
@@ -1313,24 +1313,25 @@
 d.%5Cn %7B%7D: %7B%7D%22
+)
 , status, de
@@ -1493,24 +1493,30 @@
 OGGER.error(
+error(
 %22Growl notif
@@ -1549,16 +1549,17 @@
 %7B%7D%5Cn %7B%7D%22
+)
 , status
@@ -1725,11 +1725,569 @@
 );%0A    %7D
+%0A%0A    private static String error(String message) %7B%0A        return String.format(%22%25s%25n%25n For more information about the errors and possible solutions, please read the following article:%25n%25s%22,%0A                message, wikiUrl());%0A    %7D%0A%0A    private static String wikiUrl() %7B%0A        String os = System.getProperty(%22os.name%22).toLowerCase();%0A        if (os.contains(%22win%22)) %7B%0A            return WINDOWS_URL;%0A        %7D%0A        if (os.contains(%22mac%22)) %7B%0A            return OSX_URL;%0A        %7D%0A        return %22https://github.com/jcgay/send-notification/wiki%22;%0A    %7D
 %0A%7D%0A

Complete Growl error messages with wiki links