| 1 | /* |
| 2 | * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 17 | */ |
| 18 | |
| 19 | package org.lttng.ust.agent.utils; |
| 20 | |
| 21 | /** |
| 22 | * Interface to match the log level values used by LTTng to their representation |
| 23 | * (name and integer value) used by the logging APIs. |
| 24 | * |
| 25 | * @author Alexandre Montplaisir |
| 26 | */ |
| 27 | public interface ILogLevelStrings { |
| 28 | |
| 29 | /** |
| 30 | * @return The string representation of the "warning" level |
| 31 | */ |
| 32 | String warningName(); |
| 33 | |
| 34 | /** |
| 35 | * @return The integer representation of the "warning" level |
| 36 | */ |
| 37 | int warningInt(); |
| 38 | |
| 39 | /** |
| 40 | * @return The string representation of the "info" level |
| 41 | */ |
| 42 | String infoName(); |
| 43 | |
| 44 | /** |
| 45 | * @return The integer representation of the "info" level |
| 46 | */ |
| 47 | int infoInt(); |
| 48 | |
| 49 | /** |
| 50 | * Values for JUL |
| 51 | */ |
| 52 | ILogLevelStrings JUL_LOGLEVEL_STRINGS = new ILogLevelStrings() { |
| 53 | |
| 54 | @Override |
| 55 | public String warningName() { |
| 56 | return "warning"; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public int warningInt() { |
| 61 | return 900; |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public String infoName() { |
| 66 | return "info"; |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public int infoInt() { |
| 71 | return 800; |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * Values for log4j 1.x |
| 77 | */ |
| 78 | ILogLevelStrings LOG4J_LOGLEVEL_STRINGS = new ILogLevelStrings() { |
| 79 | |
| 80 | @Override |
| 81 | public String warningName() { |
| 82 | return "warn"; |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public int warningInt() { |
| 87 | return 30000; |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public String infoName() { |
| 92 | return "info"; |
| 93 | } |
| 94 | |
| 95 | @Override |
| 96 | public int infoInt() { |
| 97 | return 20000; |
| 98 | } |
| 99 | }; |
| 100 | |
| 101 | } |