2 * ================================================================================
3 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ============LICENSE_END=========================================================
20 package org.onap.dcae.utils.eelf.logger.logback.log;
23 import org.onap.dcae.utils.eelf.logger.api.log.AuditLog;
24 import org.onap.dcae.utils.eelf.logger.api.log.DebugLog;
25 import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger;
26 import org.onap.dcae.utils.eelf.logger.api.log.EELFLoggerContext;
27 import org.onap.dcae.utils.eelf.logger.api.log.ErrorLog;
28 import org.onap.dcae.utils.eelf.logger.api.log.MetricLog;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
33 * EELF Logger Logback Implementation
35 * @author Rajiv Singla
37 public class EELFLoggerImpl implements EELFLogger {
39 private Logger logger;
40 private Class<?> clazz;
42 public EELFLoggerImpl() {
43 // no arg constructor required for Service Loader discovery
46 public EELFLoggerImpl(final Class<?> clazz) {
47 logger = LoggerFactory.getLogger(clazz);
53 public AuditLog auditLog() {
54 return new AuditLogImpl(logger, clazz);
58 public MetricLog metricLog() {
59 return new MetricLogImpl(logger, clazz);
63 public ErrorLog errorLog() {
64 return new ErrorLogImpl(logger, clazz);
68 public DebugLog debugLog() {
69 return new DebugLogImpl(logger, clazz);
73 public EELFLoggerContext loggingContext() {
74 return new EELFLoggerContextImpl();
78 public String toString() {
79 return "EELF LOGBACK IMP";