1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.access.common.pattern;
15  
16  import ch.qos.logback.access.common.spi.IAccessEvent;
17  import ch.qos.logback.core.Context;
18  import ch.qos.logback.core.pattern.DynamicConverter;
19  import ch.qos.logback.core.spi.ContextAware;
20  import ch.qos.logback.core.spi.ContextAwareBase;
21  import ch.qos.logback.core.status.Status;
22  
23  abstract public class AccessConverter extends DynamicConverter<IAccessEvent> implements ContextAware {
24  
25      public final static char SPACE_CHAR = ' ';
26      public final static char QUESTION_CHAR = '?';
27  
28      ContextAwareBase cab = new ContextAwareBase();
29  
30      @Override
31      public void setContext(Context context) {
32          cab.setContext(context);
33      }
34  
35      @Override
36      public Context getContext() {
37          return cab.getContext();
38      }
39  
40      @Override
41      public void addStatus(Status status) {
42          cab.addStatus(status);
43      }
44  
45      @Override
46      public void addInfo(String msg) {
47          cab.addInfo(msg);
48      }
49  
50      @Override
51      public void addInfo(String msg, Throwable ex) {
52          cab.addInfo(msg, ex);
53      }
54  
55      @Override
56      public void addWarn(String msg) {
57          cab.addWarn(msg);
58      }
59  
60      @Override
61      public void addWarn(String msg, Throwable ex) {
62          cab.addWarn(msg, ex);
63      }
64  
65      @Override
66      public void addError(String msg) {
67          cab.addError(msg);
68      }
69  
70      @Override
71      public void addError(String msg, Throwable ex) {
72          cab.addError(msg, ex);
73      }
74  
75  }