LoggerUtility.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.pdd.logger;

  21. import org.slf4j.Logger;

  22. /**    
  23.  * LoggerUtility
  24.  *
  25.  * @author Poli Andrea (poli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public class LoggerUtility {

  30.     private Logger log = null;
  31.     private boolean debug = false;
  32.    
  33.     public boolean isDebug() {
  34.         return this.debug;
  35.     }
  36.     public Logger getLog() {
  37.         return this.log;
  38.     }

  39.     public LoggerUtility(Logger log,boolean debug){
  40.         this.log = log;
  41.         this.debug = debug;
  42.     }

  43.     public void error(String msg){
  44.         this.log.error(msg);
  45.     }
  46.     public void error(String msg,Exception e){
  47.         this.log.error(msg,e);
  48.     }
  49.     public void error(String msg,Throwable e){
  50.         this.log.error(msg,e);
  51.     }
  52.    
  53.     public void info(String msg){
  54.         this.log.info(msg);
  55.     }
  56.     public void info(String msg,Exception e){
  57.         this.log.info(msg,e);
  58.     }
  59.     public void info(String msg,Throwable e){
  60.         this.log.info(msg,e);
  61.     }
  62.    
  63.     public void debug(String msg){
  64.         if(this.debug){
  65.             this.log.debug(msg);
  66.         }
  67.     }
  68.     public void debug(String msg,Exception e){
  69.         if(this.debug){
  70.             this.log.debug(msg,e);
  71.         }
  72.     }
  73.     public void debug(String msg,Throwable e){
  74.         if(this.debug){
  75.             this.log.debug(msg,e);
  76.         }
  77.     }
  78. }