⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ozonedebuglevel.java

📁 Java的面向对象数据库系统的源代码
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of
// the Ozone Library License version 1 published by ozone-db.org.
//
// Copyright (C) Nordic Wave Inc, All rights reserved
// $Id: OzoneDebugLevel.java,v 1.4 2002/12/29 11:15:58 per_nyfelt Exp $

package org.ozoneDB.util;

import org.apache.log4j.Level;

/**
 * Extends Logging capability by adding three finer debug levels
 * to the Log4J Level class.
 * @author Per Nyfelt
 */
public class OzoneDebugLevel extends Level {

    static public final int DEBUG1_INT = Level.DEBUG_INT - 100;
    static public final int DEBUG2_INT = Level.DEBUG_INT - 200;
    static public final int DEBUG3_INT = Level.DEBUG_INT - 300;

    /* Log4j does not set these as constants in Priority, so the following ones
     * matches those used internally by Priority */

    /** The least verbose level */
    public static final String FATAL_STR = "FATAL";
    /** One step finer (more verbose) than fatal */
    public static final String ERROR_STR = "ERROR";
    /** One step finer (more verbose) than error */
    public static final String WARN_STR = "WARN";
    /** One step finer (more verbose) than warn */
    public static final String INFO_STR = "INFO";
    /** One step finer (more verbose) than info */
    public static final String DEBUG_STR = "DEBUG";

    /** One step finer (more verbose) than debug */
    public static final String DEBUG1_STR = "DEBUG1";
    /** One step finer (more verbose) than debug1 */
    public static final String DEBUG2_STR = "DEBUG2";
    /** One step finer (more verbose) than debug2 */
    public static final String DEBUG3_STR = "DEBUG3";

    public static final OzoneDebugLevel DEBUG1 = new OzoneDebugLevel(DEBUG1_INT, DEBUG1_STR, 7);
    public static final OzoneDebugLevel DEBUG2 = new OzoneDebugLevel(DEBUG2_INT, DEBUG2_STR, 7);
    public static final OzoneDebugLevel DEBUG3 = new OzoneDebugLevel(DEBUG3_INT, DEBUG3_STR, 7);


    protected OzoneDebugLevel(int level, String strLevel, int syslogEquiv) {
        super(level, strLevel, syslogEquiv);
    }

    /**
     Convert the string passed as argument to a level. If the
     conversion fails, then this method returns {@link #DEBUG1}.
     */
    public static Level toLevel(String sArg) {
        return (Level) toLevel(sArg, OzoneDebugLevel.DEBUG1);
    }


    public static Level toLevel(String sArg, Level defaultValue) {

        if (sArg == null) {
            return defaultValue;
        }
        String stringVal = sArg.toUpperCase();

        if (stringVal.equals(DEBUG1_STR)) {
            return OzoneDebugLevel.DEBUG1;
        } else if (stringVal.equals(DEBUG2_STR)) {
            return OzoneDebugLevel.DEBUG2;
        } else if (stringVal.equals(DEBUG3_STR)) {
            return OzoneDebugLevel.DEBUG3;
        }

        return Level.toLevel(sArg, (Level) defaultValue);
    }


    public static Level toLevel(int i) throws IllegalArgumentException {
        switch (i) {
            case DEBUG1_INT:
                return OzoneDebugLevel.DEBUG1;
            case DEBUG2_INT:
                return OzoneDebugLevel.DEBUG2;
            case DEBUG3_INT:
                return OzoneDebugLevel.DEBUG3;
        }
        return Level.toLevel(i);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -