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.access.html; 015 016import static ch.qos.logback.core.CoreConstants.LINE_SEPARATOR; 017import ch.qos.logback.core.html.CssBuilder; 018 019/** 020 * This class helps the HTMLLayout build the CSS link. It either provides the 021 * HTMLLayout with a default css file, or builds the link to an external, 022 * user-specified, file. 023 * 024 * @author Sébastien Pennec 025 */ 026public class DefaultCssBuilder implements CssBuilder { 027 028 @Override 029 public void addCss(StringBuilder sbuf) { 030 sbuf.append("<style type=\"text/css\">"); 031 sbuf.append("table{ "); 032 sbuf.append("margin-left: 2em; "); 033 sbuf.append("margin-right: 2em; "); 034 sbuf.append("border-left: 2px solid #AAA; "); 035 sbuf.append("}"); 036 sbuf.append(LINE_SEPARATOR); 037 sbuf.append("TR.even { "); 038 sbuf.append("background: #FFFFFF; "); 039 sbuf.append("}"); 040 sbuf.append(LINE_SEPARATOR); 041 sbuf.append("TR.odd { "); 042 sbuf.append("background: #EAEAEA; "); 043 sbuf.append("}"); 044 sbuf.append(LINE_SEPARATOR); 045 sbuf.append("TD {"); 046 sbuf.append("padding-right: 1ex; "); 047 sbuf.append("padding-left: 1ex; "); 048 sbuf.append("border-right: 2px solid #AAA;"); 049 sbuf.append("}"); 050 sbuf.append(LINE_SEPARATOR); 051 sbuf.append("TD.Time, TD.Date { "); 052 sbuf.append("text-align: right; "); 053 sbuf.append("font-family: courier, monospace; "); 054 sbuf.append("font-size: smaller; "); 055 sbuf.append("}"); 056 sbuf.append(LINE_SEPARATOR); 057 sbuf.append( 058 "TD.RemoteHost, TD.RequestProtocol, TD.RequestHeader, TD.RequestURL, TD.RemoteUser, TD.RequestURI, TD.ServerName {"); 059 sbuf.append("text-align: left; "); 060 sbuf.append("}"); 061 sbuf.append(LINE_SEPARATOR); 062 sbuf.append("TD.RequestAttribute, TD.RequestCookie, TD.ResponseHeader, TD.RequestParameter {"); 063 sbuf.append("text-align: left; "); 064 sbuf.append("}"); 065 sbuf.append(LINE_SEPARATOR); 066 sbuf.append("TD.RemoteIPAddress, TD.LocalIPAddress, TD.ContentLength, TD.StatusCode, TD.LocalPort {"); 067 sbuf.append("text-align: right; "); 068 sbuf.append("}"); 069 sbuf.append(LINE_SEPARATOR); 070 sbuf.append("TR.header { "); 071 sbuf.append("background: #596ED5; "); 072 sbuf.append("color: #FFF; "); 073 sbuf.append("font-weight: bold; "); 074 sbuf.append("font-size: larger; "); 075 sbuf.append("}"); 076 sbuf.append(LINE_SEPARATOR); 077 sbuf.append("</style>"); 078 } 079}