001/** 002 * Copyright 2010-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.common.util.log; 017 018import org.kuali.common.util.Assert; 019import org.kuali.common.util.nullify.NullUtils; 020 021public final class LogMsg { 022 023 public static final LoggerLevel DEFAULT_LOGGER_LEVEL = LoggerLevel.INFO; 024 public static final String NO_MSG = NullUtils.NONE; 025 public static final Object[] NO_ARGS = new Object[] {}; 026 public static final LogMsg NOOP = new LogMsg(NO_MSG, NO_ARGS); 027 028 private final LoggerLevel level; 029 private final String message; 030 private final Object[] args; 031 032 public LogMsg(String message, Object[] args) { 033 this(message, args, DEFAULT_LOGGER_LEVEL); 034 } 035 036 public LogMsg(String message) { 037 this(message, NO_ARGS, DEFAULT_LOGGER_LEVEL); 038 } 039 040 public LogMsg(String message, Object[] args, LoggerLevel level) { 041 Assert.noBlanks(message); 042 Assert.noNulls(args, level); 043 this.message = message; 044 this.args = args; 045 this.level = level; 046 } 047 048 public LoggerLevel getLevel() { 049 return level; 050 } 051 052 public String getMessage() { 053 return message; 054 } 055 056 public Object[] getArgs() { 057 return args; 058 } 059 060}