logger.java
来自「java语言开发的P2P流媒体系统」· Java 代码 · 共 139 行
JAVA
139 行
/*
* P2P-Radio - Peer to peer streaming system
* Project homepage: http://p2p-radio.sourceforge.net/
* Copyright (C) 2003-2004 Michael Kaufmann <hallo@michael-kaufmann.ch>
*
* ---------------------------------------------------------------------------
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* ---------------------------------------------------------------------------
*/
package p2pradio.logging;
import java.util.logging.*;
/**
* The Logger is used for creating log messages.
* <P>
* The following log {@link java.util.logging.Level}s are used:
* <P>
* <TABLE>
* <TR><TD>{@link java.util.logging.Level#SEVERE}</TD><TD>For internal errors. All messages of this type should have an attached {@link java.lang.Throwable} object.</TD></TR>
* <TR><TD>{@link java.util.logging.Level#WARNING}</TD><TD>For expected but rare errors. All messages of this type should have an attached {@link java.lang.Throwable} object.</TD></TR>
* <TR><TD>{@link java.util.logging.Level#INFO}</TD><TD>For information messages.</TD></TR>
* <TR><TD>{@link java.util.logging.Level#FINE}</TD><TD>For events that are interesting for a monitor user.</TD></TR>
* <TR><TD>{@link java.util.logging.Level#FINER}</TD><TD>For events that occur so often that they aren't interesting for a monitor user.</TD></TR>
* </TABLE>
*
* @see java.util.logging.Logger
* @author Michael Kaufmann
*/
public class Logger
{
private static java.util.logging.Logger logger = java.util.logging.Logger.getLogger("p2pradio.Logger"); //$NON-NLS-1$
static
{
logger.setUseParentHandlers(false);
logger.setLevel(Level.ALL);
}
public static java.util.logging.Logger getLogger()
{
return logger;
}
public static void fine(String sourceClass, String msg)
{
logger.logp(Level.FINE, sourceClass, null, msg);
}
public static void fine(String sourceClass, String msg, Object param)
{
logger.logp(Level.FINE, sourceClass, null, msg, param);
}
public static void fine(String sourceClass, String msg, Object[] params)
{
logger.logp(Level.FINE, sourceClass, null, msg, params);
}
public static void fine(String sourceClass, String msg, Throwable throwable)
{
logger.logp(Level.FINE, sourceClass, null, msg, throwable);
}
public static void finer(String sourceClass, String msg)
{
logger.logp(Level.FINER, sourceClass, null, msg);
}
public static void finer(String sourceClass, String msg, Object param)
{
logger.logp(Level.FINER, sourceClass, null, msg, param);
}
public static void finer(String sourceClass, String msg, Object[] params)
{
logger.logp(Level.FINER, sourceClass, null, msg, params);
}
public static void finer(String sourceClass, String msg, Throwable throwable)
{
logger.logp(Level.FINER, sourceClass, null, msg, throwable);
}
public static void info(String sourceClass, String msg)
{
logger.logp(Level.INFO, sourceClass, null, msg);
}
public static void info(String sourceClass, String msg, Object param)
{
logger.logp(Level.INFO, sourceClass, null, msg, param);
}
public static void info(String sourceClass, String msg, Object[] params)
{
logger.logp(Level.INFO, sourceClass, null, msg, params);
}
public static void warning(String sourceClass, String msg)
{
logger.logp(Level.WARNING, sourceClass, null, msg);
}
public static void warning(String sourceClass, String msg, Object param)
{
logger.logp(Level.WARNING, sourceClass, null, msg, param);
}
public static void warning(String sourceClass, String msg, Object[] params)
{
logger.logp(Level.WARNING, sourceClass, null, msg, params);
}
public static void warning(String sourceClass, String msg, Throwable throwable)
{
logger.logp(Level.WARNING, sourceClass, null, msg, throwable);
}
public static void severe(String sourceClass, String msg, Throwable throwable)
{
logger.logp(Level.SEVERE, sourceClass, null, msg, throwable);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?