2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.logging;
23 import org.openecomp.sdc.logging.api.Logger;
24 import org.openecomp.sdc.logging.api.LoggerCreationService;
25 import org.slf4j.LoggerFactory;
31 public class SLF4JLoggerCreationService implements LoggerCreationService {
34 public Logger getLogger(String className) {
35 return new SFL4JWrapper(className);
39 public Logger getLogger(Class<?> clazz) {
40 return new SFL4JWrapper(clazz);
43 private class SFL4JWrapper implements Logger {
45 private final org.slf4j.Logger logger;
47 public SFL4JWrapper(Class<?> clazz) {
48 logger = LoggerFactory.getLogger(clazz);
51 public SFL4JWrapper(String className) {
52 logger = LoggerFactory.getLogger(className);
56 public String getName() {
57 return logger.getName();
61 public boolean isMetricsEnabled() {
62 return logger.isInfoEnabled(Markers.METRICS);
66 public void metrics(String msg) {
67 logger.info(Markers.METRICS, msg);
71 public void metrics(String msg, Object arg) {
72 logger.info(Markers.METRICS, msg, arg);
76 public void metrics(String msg, Object arg1, Object arg2) {
77 logger.info(Markers.METRICS, msg, arg1, arg2);
81 public void metrics(String msg, Object... arguments) {
82 logger.info(Markers.METRICS, msg, arguments);
86 public void metrics(String msg, Throwable t) {
87 logger.info(Markers.METRICS, msg, t);
91 public boolean isAuditEnabled() {
92 return logger.isInfoEnabled(Markers.AUDIT);
96 public void audit(String msg) {
97 logger.info(Markers.AUDIT, msg);
101 public void audit(String msg, Object arg) {
102 logger.info(Markers.AUDIT, msg, arg);
106 public void audit(String msg, Object arg1, Object arg2) {
107 logger.info(Markers.AUDIT, msg, arg1, arg2);
111 public void audit(String msg, Object... arguments) {
112 logger.info(Markers.AUDIT, msg, arguments);
116 public void audit(String msg, Throwable t) {
117 logger.info(Markers.AUDIT, msg, t);
121 public boolean isDebugEnabled() {
122 return logger.isDebugEnabled();
126 public void debug(String msg) {
131 public void debug(String format, Object arg) {
132 logger.debug(format, arg);
136 public void debug(String format, Object arg1, Object arg2) {
137 logger.debug(format, arg1, arg2);
141 public void debug(String format, Object... arguments) {
142 logger.debug(format, arguments);
146 public void debug(String msg, Throwable t) {
147 logger.debug(msg, t);
151 public boolean isInfoEnabled() {
152 return logger.isInfoEnabled();
156 public void info(String msg) {
161 public void info(String format, Object arg) {
162 logger.info(format, arg);
166 public void info(String format, Object arg1, Object arg2) {
167 logger.info(format, arg1, arg2);
171 public void info(String format, Object... arguments) {
172 logger.info(format, arguments);
176 public void info(String msg, Throwable t) {
181 public boolean isWarnEnabled() {
182 return logger.isWarnEnabled();
186 public void warn(String msg) {
191 public void warn(String format, Object arg) {
192 logger.warn(format, arg);
196 public void warn(String format, Object... arguments) {
197 logger.warn(format, arguments);
201 public void warn(String format, Object arg1, Object arg2) {
202 logger.warn(format, arg1, arg2);
206 public void warn(String msg, Throwable t) {
211 public boolean isErrorEnabled() {
212 return logger.isErrorEnabled();
216 public void error(String msg) {
221 public void error(String format, Object arg) {
222 logger.error(format, arg);
226 public void error(String format, Object arg1, Object arg2) {
227 logger.error(format, arg1, arg2);
231 public void error(String format, Object... arguments) {
232 logger.error(format, arguments);
236 public void error(String msg, Throwable t) {
237 logger.error(msg, t);