001/* 002 * jPOS Project [http://jpos.org] 003 * Copyright (C) 2000-2026 jPOS Software SRL 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jpos.util; 020 021/** 022 * LogSources can choose to extends this SimpleLogSource 023 * 024 * @author apr@cs.com.uy 025 * @version $Id$ 026 * @see LogSource 027 */ 028public class SimpleLogSource implements LogSource { 029 protected Logger logger; 030 protected String realm; 031 032 public SimpleLogSource () { 033 super(); 034 logger = null; 035 realm = null; 036 } 037 public SimpleLogSource (Logger logger, String realm) { 038 setLogger (logger, realm); 039 } 040 public void setLogger (Logger logger, String realm) { 041 this.logger = logger; 042 this.realm = realm; 043 } 044 public String getRealm () { 045 return realm; 046 } 047 public Logger getLogger() { 048 return logger; 049 } 050 public void setRealm (String realm) { 051 this.realm = realm; 052 } 053 public void info (String detail) { 054 Logger.log (new LogEvent (this, "info", detail)); 055 } 056 public void info (String detail, Object obj) { 057 LogEvent evt = new LogEvent (this, "info", detail); 058 evt.addMessage (obj); 059 Logger.log (evt); 060 } 061 public void warning (String detail) { 062 Logger.log (new LogEvent (this, "warning", detail)); 063 } 064 public void warning (String detail, Object obj) { 065 LogEvent evt = new LogEvent (this, "warning", detail); 066 evt.addMessage (obj); 067 Logger.log (evt); 068 } 069 public void error (String detail) { 070 Logger.log (new LogEvent (this, "error", detail)); 071 } 072 public void error (String detail, Object obj) { 073 LogEvent evt = new LogEvent (this, "error", detail); 074 evt.addMessage (obj); 075 Logger.log (evt); 076 } 077} 078