001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.access.pattern; 015 016import ch.qos.logback.access.spi.IAccessEvent; 017import ch.qos.logback.core.Context; 018import ch.qos.logback.core.pattern.DynamicConverter; 019import ch.qos.logback.core.spi.ContextAware; 020import ch.qos.logback.core.spi.ContextAwareBase; 021import ch.qos.logback.core.status.Status; 022 023abstract public class AccessConverter extends DynamicConverter<IAccessEvent> implements ContextAware { 024 025 public final static char SPACE_CHAR = ' '; 026 public final static char QUESTION_CHAR = '?'; 027 028 ContextAwareBase cab = new ContextAwareBase(); 029 030 @Override 031 public void setContext(Context context) { 032 cab.setContext(context); 033 } 034 035 @Override 036 public Context getContext() { 037 return cab.getContext(); 038 } 039 040 @Override 041 public void addStatus(Status status) { 042 cab.addStatus(status); 043 } 044 045 @Override 046 public void addInfo(String msg) { 047 cab.addInfo(msg); 048 } 049 050 @Override 051 public void addInfo(String msg, Throwable ex) { 052 cab.addInfo(msg, ex); 053 } 054 055 @Override 056 public void addWarn(String msg) { 057 cab.addWarn(msg); 058 } 059 060 @Override 061 public void addWarn(String msg, Throwable ex) { 062 cab.addWarn(msg, ex); 063 } 064 065 @Override 066 public void addError(String msg) { 067 cab.addError(msg); 068 } 069 070 @Override 071 public void addError(String msg, Throwable ex) { 072 cab.addError(msg, ex); 073 } 074 075}