View Javadoc

1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2011, 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.pattern;
15  
16  import ch.qos.logback.access.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  
24  abstract public class AccessConverter extends DynamicConverter<IAccessEvent> implements ContextAware {
25  
26    public final static char SPACE_CHAR = ' ';
27    public final static char QUESTION_CHAR = '?';
28    
29    ContextAwareBase cab = new ContextAwareBase();
30    
31    public void setContext(Context context) {
32     cab.setContext(context);
33    }
34  
35    public Context getContext() {
36      return cab.getContext();
37    }
38    
39    public void addStatus(Status status) {
40      cab.addStatus(status);
41    }
42  
43    public void addInfo(String msg) {
44      cab.addInfo(msg);
45    }
46  
47    public void addInfo(String msg, Throwable ex) {
48      cab.addInfo(msg, ex);
49    }
50  
51    public void addWarn(String msg) {
52      cab.addWarn(msg);
53    }
54  
55    public void addWarn(String msg, Throwable ex) {
56      cab.addWarn(msg, ex);
57    }
58  
59    public void addError(String msg) {
60      cab.addError(msg);
61    }
62  
63    public void addError(String msg, Throwable ex) {
64      cab.addError(msg, ex);
65    }
66    
67  }