annotate src/goodjava/logger/Level.java @ 1815:3dabc11da660

xml minor
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 11 Jun 2024 17:34:27 -0600
parents dd14d2dce7ee
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1448
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 package goodjava.logger;
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3
1449
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents: 1448
diff changeset
4 public final class Level {
1448
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 public final static int DEBUG = 0;
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 public final static int INFO = 1;
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 public final static int WARN = 2;
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 public final static int ERROR = 3;
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 public final static int OFF = 4;
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 private static final String[] names = {"DEBUG","INFO","WARN","ERROR"};
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 public static String toString(int level) {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 return names[level];
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 }
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 private static final String[] paddedNames = {"DEBUG","INFO ","WARN ","ERROR"};
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 public static String toPaddedString(int level) {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 return paddedNames[level];
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 }
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 }