View Javadoc
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.core;
15  
16  import ch.qos.logback.core.spi.ContextAwareBase;
17  
18  abstract public class LayoutBase<E> extends ContextAwareBase implements Layout<E> {
19  
20      protected boolean started;
21  
22      String fileHeader;
23      String fileFooter;
24      String presentationHeader;
25      String presentationFooter;
26  
27      public void setContext(Context context) {
28          this.context = context;
29      }
30  
31      public Context getContext() {
32          return this.context;
33      }
34  
35      public void start() {
36          started = true;
37      }
38  
39      public void stop() {
40          started = false;
41      }
42  
43      public boolean isStarted() {
44          return started;
45      }
46  
47      public String getFileHeader() {
48          return fileHeader;
49      }
50  
51      public String getPresentationHeader() {
52          return presentationHeader;
53      }
54  
55      public String getPresentationFooter() {
56          return presentationFooter;
57      }
58  
59      public String getFileFooter() {
60          return fileFooter;
61      }
62  
63      public String getContentType() {
64          return "text/plain";
65      }
66  
67      public void setFileHeader(String header) {
68          this.fileHeader = header;
69      }
70  
71      public void setFileFooter(String footer) {
72          this.fileFooter = footer;
73      }
74  
75      public void setPresentationHeader(String header) {
76          this.presentationHeader = header;
77      }
78  
79      public void setPresentationFooter(String footer) {
80          this.presentationFooter = footer;
81      }
82  }