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.core; 015 016import ch.qos.logback.core.spi.ContextAwareBase; 017 018abstract public class LayoutBase<E> extends ContextAwareBase implements Layout<E> { 019 020 protected boolean started; 021 022 String fileHeader; 023 String fileFooter; 024 String presentationHeader; 025 String presentationFooter; 026 027 public void setContext(Context context) { 028 this.context = context; 029 } 030 031 public Context getContext() { 032 return this.context; 033 } 034 035 public void start() { 036 started = true; 037 } 038 039 public void stop() { 040 started = false; 041 } 042 043 public boolean isStarted() { 044 return started; 045 } 046 047 public String getFileHeader() { 048 return fileHeader; 049 } 050 051 public String getPresentationHeader() { 052 return presentationHeader; 053 } 054 055 public String getPresentationFooter() { 056 return presentationFooter; 057 } 058 059 public String getFileFooter() { 060 return fileFooter; 061 } 062 063 public String getContentType() { 064 return "text/plain"; 065 } 066 067 public void setFileHeader(String header) { 068 this.fileHeader = header; 069 } 070 071 public void setFileFooter(String footer) { 072 this.fileFooter = footer; 073 } 074 075 public void setPresentationHeader(String header) { 076 this.presentationHeader = header; 077 } 078 079 public void setPresentationFooter(String footer) { 080 this.presentationFooter = footer; 081 } 082}