1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 }