View Javadoc
1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.log;
17  
18  import org.kuali.common.util.Assert;
19  import org.kuali.common.util.nullify.NullUtils;
20  
21  public final class LogMsg {
22  
23  	public static final LoggerLevel DEFAULT_LOGGER_LEVEL = LoggerLevel.INFO;
24  	public static final String NO_MSG = NullUtils.NONE;
25  	public static final Object[] NO_ARGS = new Object[] {};
26  	public static final LogMsg NOOP = new LogMsg(NO_MSG, NO_ARGS);
27  
28  	private final LoggerLevel level;
29  	private final String message;
30  	private final Object[] args;
31  
32  	public LogMsg(String message, Object[] args) {
33  		this(message, args, DEFAULT_LOGGER_LEVEL);
34  	}
35  
36  	public LogMsg(String message) {
37  		this(message, NO_ARGS, DEFAULT_LOGGER_LEVEL);
38  	}
39  
40  	public LogMsg(String message, Object[] args, LoggerLevel level) {
41  		Assert.noBlanks(message);
42  		Assert.noNulls(args, level);
43  		this.message = message;
44  		this.args = args;
45  		this.level = level;
46  	}
47  
48  	public LoggerLevel getLevel() {
49  		return level;
50  	}
51  
52  	public String getMessage() {
53  		return message;
54  	}
55  
56  	public Object[] getArgs() {
57  		return args;
58  	}
59  
60  }