1 /**
2 * Logback: the reliable, generic, fast and flexible logging framework.
3 * Copyright (C) 1999-2009, 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.ContextAware;
17 import ch.qos.logback.core.spi.LifeCycle;
18
19 public interface Layout<E> extends ContextAware, LifeCycle {
20
21 /**
22 * Transform an event (of type Object) and return it as a String after
23 * appropriate formatting.
24 *
25 * <p>Taking in an object and returning a String is the least sophisticated
26 * way of formatting events. However, it is remarkably CPU-effective.
27 * </p>
28 *
29 * @param event The event to format
30 * @return the event formatted as a String
31 */
32 String doLayout(E event);
33
34 /**
35 * Return the file header for this layout. The returned value may be null.
36 * @return The header.
37 */
38 String getFileHeader();
39
40 /**
41 * Return the header of the logging event formatting. The returned value
42 * may be null.
43 *
44 * @return The header.
45 */
46 String getPresentationHeader();
47
48 /**
49 * Return the footer of the logging event formatting. The returned value
50 * may be null.
51 *
52 * @return The footer.
53 */
54
55 String getPresentationFooter();
56
57 /**
58 * Return the file footer for this layout. The returned value may be null.
59 * @return The footer.
60 */
61 String getFileFooter();
62
63 /**
64 * Returns the content type as appropriate for the implementation.
65 *
66 * @return
67 */
68 String getContentType();
69
70 }