toInt ( )源码实例Demo

org.apache.log4j.Level#toInt ( )源码实例Demo

下面列出了org.apache.log4j.Level#toInt ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: n4js   文件: EclipseLogAppender.java
private int mapLevel(Level level) {
	switch (level.toInt()) {
	case Priority.DEBUG_INT:
	case Priority.INFO_INT:
		return IStatus.INFO;

	case Priority.WARN_INT:
		return IStatus.WARNING;

	case Priority.ERROR_INT:
	case Priority.FATAL_INT:
		return IStatus.ERROR;

	default:
		return IStatus.INFO;
	}
}
 
源代码2 项目: xtext-eclipse   文件: EclipseLogAppender.java
private int mapLevel(Level level) {
	switch (level.toInt()) {
		case Priority.DEBUG_INT:
		case Priority.INFO_INT:
			return IStatus.INFO;

		case Priority.WARN_INT:
			return IStatus.WARNING;

		case Priority.ERROR_INT:
		case Priority.FATAL_INT:
			return IStatus.ERROR;

		default:
			return IStatus.INFO;
	}
}
 
源代码3 项目: pegasus   文件: LogManager.java
/**
 * Sets the debug level. All those messages are logged which have a level less than equal to the
 * debug level.
 *
 * @param level the level to which the debug level needs to be set to.
 */
public void setLevel(Level level) {
    int value = level.toInt();
    switch (value) {
        case Level.DEBUG_INT:
            value = LogManager.DEBUG_MESSAGE_LEVEL;
            break;

        case Level.INFO_INT:
            value = LogManager.INFO_MESSAGE_LEVEL;
            break;

        case Level.WARN_INT:
            value = LogManager.WARNING_MESSAGE_LEVEL;
            break;

        case Level.ERROR_INT:
            value = LogManager.ERROR_MESSAGE_LEVEL;
            break;

        default:
            value = LogManager.FATAL_MESSAGE_LEVEL;
            break;
    }
    setLevel(value, false);
}
 
源代码4 项目: pegasus   文件: Default.java
/**
 * Sets the debug level. All those messages are logged which have a level less than equal to the
 * debug level.
 *
 * @param level the level to which the debug level needs to be set to.
 */
public void setLevel(Level level) {
    int value = level.toInt();
    switch (value) {
        case Level.DEBUG_INT:
            value = Default.DEBUG_MESSAGE_LEVEL;
            break;

        case Level.INFO_INT:
            value = Default.INFO_MESSAGE_LEVEL;
            break;

        case Level.WARN_INT:
            value = Default.WARNING_MESSAGE_LEVEL;
            break;

        case Level.ERROR_INT:
            value = Default.ERROR_MESSAGE_LEVEL;
            break;

        default:
            value = Default.FATAL_MESSAGE_LEVEL;
            break;
    }
    setLevel(value, false);
}
 
源代码5 项目: Bats   文件: LogWriter.java
/**
 * Constructor.
 *
 * @param logger the logger this Writer should write to
 * @param level the debug level to write to the logger with
 */
public LogWriter(final Logger logger, final Level level) {
  Preconditions.checkNotNull(logger);
  Preconditions.checkArgument((level == Level.DEBUG) || (level == Level.ERROR) ||
      (level == Level.INFO) || (level == Level.TRACE) || (level == Level.WARN),
      "level must be a logging level");

  this.logger = logger;
  this.level = level.toInt();
  stringBuilder = new StringBuilder(80);
  isClosed = false;
}
 
源代码6 项目: xian   文件: Log4jLogEvent.java
private int levelToSyslogLevel(final Level level) {
    if (level.toInt() <= Level.DEBUG.toInt()) {
        return GelfMessage.DEFAUL_LEVEL;
    }

    if (level.toInt() <= Level.INFO.toInt()) {
        return 6;
    }

    if (level.toInt() <= Level.WARN.toInt()) {
        return 4;
    }

    if (level.toInt() <= Level.ERROR.toInt()) {
        return 3;
    }

    if (level.toInt() <= Level.FATAL.toInt()) {
        return 2;
    }

    if (level.toInt() > Level.FATAL.toInt()) {
        return 0;
    }

    return GelfMessage.DEFAUL_LEVEL;
}
 
源代码7 项目: database   文件: AbstractHTree.java
public boolean dump(final Level level, final PrintStream out,
			final boolean materialize) {

        // True iff we will write out the node structure.
        final boolean info = level.toInt() <= Level.INFO.toInt();

//        final IBTreeUtilizationReport utils = getUtilization();

        if (info) {

			out.print("addressBits=" + addressBits);
			out.print(", (2^addressBits)=" + (1 << addressBits));
			out.print(", #nodes=" + getNodeCount());
			out.print(", #leaves=" + getLeafCount());
			out.print(", #entries=" + getEntryCount());
			out.println();
//                    + ", nodeUtil="
//                    + utils.getNodeUtilization() + "%, leafUtil="
//                    + utils.getLeafUtilization() + "%, utilization="
//                    + utils.getTotalUtilization() + "%"
        }

        if (root != null) {

            return root.dump(level, out, 0, true, materialize);

        } else
            return true;

    }
 
源代码8 项目: database   文件: BucketPage.java
@Override
protected boolean dump(final Level level, final PrintStream out,
		final int height, final boolean recursive, final boolean materialize) {

	final boolean debug = level.toInt() <= Level.DEBUG.toInt();

	// Set to false iff an inconsistency is detected.
	boolean ok = true;

	if (parent == null || parent.get() == null) {
		out.println(indent(height) + "ERROR: parent not set");
		ok = false;
	}

	if (globalDepth > parent.get().globalDepth) {
		out.println(indent(height)
				+ "ERROR: localDepth exceeds globalDepth of parent");
		ok = false;
	}

	/*
	 * TODO Count the #of pointers in each buddy hash table of the parent
	 * to each buddy bucket in this bucket page and verify that the
	 * globalDepth on the child is consistent with the pointers in the
	 * parent.
	 * 
	 * TODO The same check must be performed for the directory page to
	 * cross validate the parent child linking pattern with the transient
	 * cached globalDepth fields.
	 */

	if (debug || !ok) {

		out.println(indent(height) + toString());

	}

	return ok;

}
 
源代码9 项目: n4js   文件: EclipseLogAppender.java
private boolean isDoLog(Level level) {
	return level.toInt() >= Priority.WARN_INT;
}
 
源代码10 项目: xtext-eclipse   文件: EclipseLogAppender.java
private boolean isDoLog(Level level) {
	return level.toInt() >= Priority.WARN_INT;
}
 
源代码11 项目: scheduling   文件: AOSynchronization.java
@SuppressWarnings("squid:S3776")
private void logWithContext(TaskId taskId, String channel, String message, Throwable exception, Level level)
        throws InvalidChannelException {
    String channelHeader = "[" + Synchronization.class.getSimpleName() + "]" +
                           (channel != null ? "[" + Channel.class.getSimpleName() + "=" + channel + "] " : "");
    switch (level.toInt()) {
        case Level.TRACE_INT:
            if (logger.isTraceEnabled()) {
                TaskLogger.getInstance().info(taskId, channelHeader + message);
            }
            break;
        case Level.DEBUG_INT:
            if (logger.isDebugEnabled()) {
                TaskLogger.getInstance().info(taskId, channelHeader + message);
            }
            break;
        case Level.INFO_INT:
            if (logger.isInfoEnabled()) {
                TaskLogger.getInstance().info(taskId, channelHeader + message);
            }
            break;
        case Level.WARN_INT:
            if (exception != null) {
                TaskLogger.getInstance().warn(taskId, channelHeader + message, exception);
            } else {
                TaskLogger.getInstance().warn(taskId, channelHeader + message);
            }
            break;
        case Level.ERROR_INT:
            if (exception != null) {
                TaskLogger.getInstance().error(taskId, channelHeader + message, exception);
            } else {
                TaskLogger.getInstance().error(taskId, channelHeader + message);
            }
            break;
        default:
            // no action
    }
    if (logger.isTraceEnabled() && channel != null) {
        TaskLogger.getInstance().info(taskId, channelHeader + "New channel content : " + getChannel(channel));
    }
}
 
源代码12 项目: database   文件: AbstractBTree.java
public boolean dump(final Level level, final PrintStream out) {

        // True iff we will write out the node structure.
        final boolean info = level.toInt() <= Level.INFO.toInt();

        final IBTreeUtilizationReport utils = getUtilization();

        if (info) {

        	final int branchingFactor = getBranchingFactor();

            final int height = getHeight();

            final long nnodes = getNodeCount();

            final long nleaves = getLeafCount();

            final long nentries = getEntryCount();

			out.println("branchingFactor=" + branchingFactor + ", height="
					+ height + ", #nodes=" + nnodes + ", #leaves=" + nleaves
					+ ", #entries=" + nentries + ", nodeUtil="
					+ utils.getNodeUtilization() + "%, leafUtil="
					+ utils.getLeafUtilization() + "%, utilization="
					+ utils.getTotalUtilization() + "%");
        }

        if (root != null) {

            return root.dump(level, out, 0, true);

        } else
            return true;

    }
 
源代码13 项目: pegasus   文件: Log4j.java
/**
 * Sets the debug level. All those messages are logged which have a level less than equal to the
 * debug level. In case the boolean info is set, all the info messages are also logged.
 *
 * @param level the level to which the debug level needs to be set to.
 * @param info boolean denoting whether the INFO messages need to be logged or not.
 */
protected void setLevel(Level level, boolean info) {
    mDebugLevel = level.toInt();
    mLogger.setLevel(level);
}