fix karaf runtime log console
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / LoggingFuturesCallBack.java
1 /*
2  * Copyright © 2017 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.transportpce.servicehandler;
10
11 import com.google.common.util.concurrent.FutureCallback;
12 import org.slf4j.Logger;
13
14 /**
15  * Class to log future logging from datastore actions (write,modify and  delete..).
16  *
17  * @author <a href="mailto:martial.coulibaly@gfi.com">Martial Coulibaly</a> on behalf of Orange
18  */
19
20 public class LoggingFuturesCallBack<V> implements FutureCallback<V> {
21
22     private Logger log;
23     private String message;
24
25     public LoggingFuturesCallBack(String message, Logger log) {
26         this.message = message;
27         this.log = log;
28     }
29
30     @Override
31     public void onFailure(Throwable ex) {
32         log.warn(message, ex);
33
34     }
35
36     @Override
37     public void onSuccess(V arg0) {
38         log.info("Success! {} ", arg0);
39
40     }
41
42 }