1 : <?php
2 : /**
3 : * Licensed to the Apache Software Foundation (ASF) under one or more
4 : * contributor license agreements. See the NOTICE file distributed with
5 : * this work for additional information regarding copyright ownership.
6 : * The ASF licenses this file to You under the Apache License, Version 2.0
7 : * (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : *
10 : * http://www.apache.org/licenses/LICENSE-2.0
11 : *
12 : * Unless required by applicable law or agreed to in writing, software
13 : * distributed under the License is distributed on an "AS IS" BASIS,
14 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 : * See the License for the specific language governing permissions and
16 : * limitations under the License.
17 : *
18 : * @package log4php
19 : */
20 :
21 : /**
22 : * Extend this abstract class to create your own log layout format.
23 : *
24 : * @version $Revision: 1213283 $
25 : * @package log4php
26 : */
27 : abstract class LoggerLayout extends LoggerConfigurable {
28 : /**
29 : * Activates options for this layout.
30 : * Override this method if you have options to be activated.
31 : */
32 : public function activateOptions() {
33 35 : return true;
34 : }
35 :
36 : /**
37 : * Override this method to create your own layout format.
38 : *
39 : * @param LoggerLoggingEvent
40 : * @return string
41 : */
42 : public function format(LoggerLoggingEvent $event) {
43 0 : return $event->getRenderedMessage();
44 : }
45 :
46 : /**
47 : * Returns the content type output by this layout.
48 : * @return string
49 : */
50 : public function getContentType() {
51 0 : return "text/plain";
52 : }
53 :
54 : /**
55 : * Returns the footer for the layout format.
56 : * @return string
57 : */
58 : public function getFooter() {
59 22 : return null;
60 : }
61 :
62 : /**
63 : * Returns the header for the layout format.
64 : * @return string
65 : */
66 : public function getHeader() {
67 27 : return null;
68 : }
69 :
70 : /** Triggers a warning for this layout with the given message. */
71 : protected function warn($message) {
72 1 : trigger_error("log4php: [" . get_class($this) . "]: $message", E_USER_WARNING);
73 0 : }
74 : }
|